Hello,
i need a Script that list and activate all users in my jira instance that don't have "Jira Software" as Applicatons in User Keys
My script
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.user.ApplicationUser
import com.atlassian.jira.user.util.UserUtil
import com.atlassian.jira.user.util.DefaultUserManager
def userManager = ComponentAccessor.getUserManager()
def userUtil = ComponentAccessor.getComponent(UserUtil)
// Get all Jira users
def allUsers = userManager.getAllUsers()
allUsers.each { user ->
def userKeys = userUtil.getUserKeysForUser(user)
if (!userKeys.contains("jira-software")) {
// Update the user to activate it
def mutableUser = userManager.getUserByName(user.getName())
mutableUser.setActive(true)
DefaultUserManager.updateUser(mutableUser)
}
}
has the following error
[Static type checking] - Cannot find matching method com.atlassian.jira.user.util.UserUtil#getUserKeysForUser(com.atlassian.jira.user.ApplicationUser). Please check if the declared type is correct and if the method exists.
and I'm to stupid to solve this problem
Could you check group that grand application access instead ? If the user is not in any group that grant Software access it will be returned.
isUserInGroup(ApplicationUser user, String groupName)
Regards
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.