Hello,
Is there a way to get a list of all users that are not assigned to any group? Maybe a user macro that can list all users without group?
Best Regards
Artur Siwakowski
Hi Artur,
Here is a quick way you can find the users without groups: Just paste this code into the javascript console of your browser when you are logged into your Confluence instance (usually brought up by pressing F12 and finding the console tab)
getGroups = function( userArray ) { if (userArray.length !== 0) { var currentUser = userArray.shift(); jQuery.ajax({ contentType: 'application/json', type: 'POST', url: contextPath + '/rpc/json-rpc/confluenceservice-v2/getUserGroups', data: '["' + currentUser + '"]', success: function( response ) { if (response.length === 0) { console.log(currentUser); } getGroups(userArray); } }); } else { console.log("Done!"); } } jQuery.ajax({ contentType: 'application/json', type: 'POST', url: contextPath + '/rpc/json-rpc/confluenceservice-v2/getActiveUsers', data: '[false]', success: function( response ) { getGroups(response); } });
It will make a list of all users who have no groups and will display the word "Done!" when it's done. Note that this only finds the active users without groups. If you also want to figure out the disabled users without groups, change the word 'false' above to 'true'.
EDIT: It appears the order of the functions makes a difference in the Firefox console. Also, you have to be logged in as an administrator (forgot to mention).
Seems like it worked, there might not be any active users who don't have any groups. You can use this slightly modified version to show a list of all users and the number of groups they have:
getGroups = function( userArray ) { if (userArray.length !== 0) { var currentUser = userArray.shift(); jQuery.ajax({ contentType: 'application/json', type: 'POST', url: contextPath + '/rpc/json-rpc/confluenceservice-v2/getUserGroups', data: '["' + currentUser + '"]', success: function( response ) { console.log(currentUser + ' - ' + response.length); getGroups(userArray); } }); } else { console.log("Done!"); } } jQuery.ajax({ contentType: 'application/json', type: 'POST', url: contextPath + '/rpc/json-rpc/confluenceservice-v2/getActiveUsers', data: '[false]', success: function( response ) { getGroups(response); } });
Like I said, if you want to also show for non-active users you have to change the false to true in the code above.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Stephen,
When I'm pasting this code into FF or IE10 console and press Enter, I get the code doubled without results.
Screenshot - 2015-03-11 , 16_25_29.png
Maybe I'm doing something wrong?
I've logged into the Production server and started IE10 (and FF), passed the code and click on Enter.
Best Regards
Artur
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I changed the code above slightly, you could try again; I tested it and it worked with FF and IE now.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
This time I got different error. Please see the second post below.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Alex,
Thank you for the answer!
I don't know if I can handle the mentioned solution, because I'm not a developer. I guess I will have to look for other ways to achieve the goal.
Best Regards
Artur
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
The only way off the top of my head that I can think of is to use the API to retrieve all the users and then check to see if any don't belong a group.
First I would use getActiveUsers() to get all the users and then loop through them using getUserGroups() to see which come back with an empty set.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.