Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,553,566
Community Members
 
Community Events
184
Community Groups

Find all Users that not have "Jira Software" as Applications

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

1 answer

0 votes
Florian Bonniec
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Apr 20, 2023

Hi @Frank Lohfeld 

 

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)

https://docs.atlassian.com/software/jira/docs/api/7.6.1/com/atlassian/jira/security/groups/GroupManager.html

 

Regards

Suggest an answer

Log in or Sign up to answer