[xwiki-devs] Retrieve the list of users based on the selected group
Hello, I researched the forum to see if a subject could meet my need, but I have not found a solution. My need: I want to make a day depending on the user group selection list select from a list. For lists, I use the wiki groups and users of xwiki. I want to retrieve the list of xwiki users in the selected group. To create the list of groups I used the velocity, by cons I think to create the user must use javascript because every time we change the group must make days the list of users. This is the part I select the group name but how do I find the list of users in this group? Thank you in advance, I am at your disposal for any further information! Regards, Matthieu Le Bihan -- View this message in context: http://xwiki.475771.n2.nabble.com/Retrieve-the-list-of-users-based-on-the-se... Sent from the XWiki- Dev mailing list archive at Nabble.com.
Try this: {{velocity}} {{html wiki='true'}} <form action="$doc.getURL()" method="post"> <input type="hidden" name="action" value="get_users" /> <div>Select usergroup <select name="group"> #set($rightsAPI=$xwiki.rightsmanager) #set($groupsAPI=$rightsAPI.getGroupsApi()) #set($groups=$groupsAPI.getAllLocalGroupsNames()) #foreach($group in $groups) <option value="$group">$group</option> #end </select> <input type="submit" value="Show users"/></div> </form> {{/html}} {{html wiki='true'}} #if($request.action == 'get_users') #set($group=$request.group) = Users in $group = #set($users = $xwiki.rightsmanager.usersApi.allUsersNames) #foreach($user in $users) #if($xwiki.getUser($user).isUserInGroup($group)) <div>$xwiki.getUserName($user)</div> #end #end #end {{/html}} {{/velocity}} -- View this message in context: http://xwiki.475771.n2.nabble.com/Retrieve-the-list-of-users-based-on-the-se... Sent from the XWiki- Dev mailing list archive at Nabble.com.
Merci pour ta réponse Hamster mais, depuis hier, j'ai trouvé une solution qui répond à mon besoin en utilisant du javascript! -- View this message in context: http://xwiki.475771.n2.nabble.com/Retrieve-the-list-of-users-based-on-the-se... Sent from the XWiki- Dev mailing list archive at Nabble.com.
No problem! Nice to hear you have found a solution with javascript! (yes, I can read a little bit French) If you could post your javascript solution here, you are helping the XWiki community :-) -- View this message in context: http://xwiki.475771.n2.nabble.com/Retrieve-the-list-of-users-based-on-the-se... Sent from the XWiki- Dev mailing list archive at Nabble.com.
On Thu, Nov 28, 2013 at 9:14 AM, Hamster <[email protected]> wrote:
No problem! Nice to hear you have found a solution with javascript! (yes, I can read a little bit French)
If you could post your javascript solution here, you are helping the XWiki community :-)
Or as a snippet on http://extensions.xwiki.org ;)
-- View this message in context: http://xwiki.475771.n2.nabble.com/Retrieve-the-list-of-users-based-on-the-se... Sent from the XWiki- Dev mailing list archive at Nabble.com. _______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
-- Thomas Mortagne
participants (3)
-
Hamster -
le bihan matthieu -
Thomas Mortagne