Last active
August 29, 2015 13:59
-
-
Save dvdsmpsn/10985359 to your computer and use it in GitHub Desktop.
show all user's email addresses
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## From: https://confluence.cornell.edu/display/SANDBOX/Show+User+Email+Addresses# | |
{beanshell:output=wiki} | |
import com.atlassian.confluence.user.UserAccessor; | |
import bucket.container.ContainerManager; | |
import com.atlassian.user.search.page.Pager; | |
import java.util.Iterator; | |
import com.atlassian.user.impl.osuser.OSUUser; | |
import com.atlassian.user.impl.osuser.OSUGroup; | |
UserAccessor userAccessor = (UserAccessor) ContainerManager.getInstance().getContainerContext().getComponent("userAccessor"); | |
Pager users = userAccessor.getUsers(); | |
Iterator userIterator = users.iterator(); | |
while (userIterator.hasNext()) { | |
OSUUser user = (OSUUser) userIterator.next(); | |
Pager groupList = userAccessor.getGroups(user); | |
Iterator groupIterator = groupList.iterator(); | |
String groups = new String(); | |
while (groupIterator.hasNext()) { | |
groups += groupIterator.next().getName() + " \\\\ "; | |
} | |
out.println(user.getEmail() + ","); | |
} | |
{beanshell} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment