Hello,
I try to find inactive users from one of our 3 User Directories that aren't in our "notused" group. For now my script looks like this
import com.atlassian.jira.component.ComponentAccessor import com.atlassian.jira.user.util.UserUtil import com.atlassian.crowd.embedded.api.CrowdService import com.atlassian.crowd.embedded.core.util.StaticCrowdServiceFactory UserUtil userUtil = ComponentAccessor.getUserUtil() CrowdService crowdService = StaticCrowdServiceFactory.getCrowdService() result = "<table style=\"width:100%\">" userUtil.getUsers().findAll{!it.isActive()}.each{ user -> if (!crowdService.isUserMemberOfGroup(user.getName(), "notused")){ result += "<tr><th>" + user.name + "</th>" + "<th>" + user.displayName + </th>" + "<th>" + user.emailAddress + "</th>" + "</th></tr>" } } result += "</table>" result
But i don't know (and can't find) how to check if user is in target user directory.
Thanks in advance,
Maciej O.
Try this code to get DirectorId:
import com.atlassian.jira.component.ComponentAccessor import com.atlassian.jira.user.ApplicationUser for(ApplicationUser user: ComponentAccessor.getUserManager().getAllApplicationUsers()){ user.getDirectoryId() }
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.