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,456,891
Community Members
 
Community Events
176
Community Groups

Managing users and roles

Edited

Good day. 

We audit roles and permissions in all Jira projects. Users, who have project admin add other employees to project roles locally. 

Every project has AD group and we want that all users request this groups from company portal. We want to get away from local rights. 

So, we have many projects with users, who added locally by project admin. 

For example: 

jira.jpg

g_jira_123 - AD group;

Valeriya - employee, who was added by project admin. 

 

Is there any way to remove all this users from all projects? 

 

Jira Server 8.5.3

 

2 answers

1 accepted

0 votes
Answer accepted

Hi @Andrey Butuzov 

Do you have ScriptRunner for Jira on your server instance? If yes then doing this is quite straight forward using ProjectRoleService.


ProjectRoleService projectRoleService = ComponentAccessor.getComponent(ProjectRoleService)
projectRoleService.removeActorsFromProjectRole(..)

This post has a good example.

Ravi

Hi @Ravi Sagar _Sparxsys_ 

Thanks for your reply and tutorials from YouTube :) 

Yes, we have ScriptRunner. 

Will try to study. 

I'm beginner in ScriptRunner. Can you suggest where I should to place this code? 

Screenshot 2021-08-20 at 11.02.33.png

I know that my question is very simple, sorry for that :) 

Like Ravi Sagar _Sparxsys_ likes this

Thanks. You can run ad-hoc code from the Console.

Like Andrey Butuzov likes this
0 votes

You could do some data mining with REST https://docs.atlassian.com/software/jira/docs/api/REST/8.18.2/#project/{projectIdOrKey}/role

 

Each "project role member", aka "actor" has a type property, whether it's a user or a group, so for example:

// https://jiraurl.com/rest/api/2/project/13004/role/10002

{
"self": "https://jiraurl.com/rest/api/2/project/13004/role/10002",
"name": "Administrators",
"id": 10002,
"description": "A project role that represents administrators in a project",
"actors": [
{
"id": 146569,
"displayName": "jira-administrators",
"type": "atlassian-group-role-actor",
"name": "jira-administrators",
"avatarUrl": "https://jiraurl.com/secure/useravatar?size=xsmall&avatarId=10123"
},
{
"id": 238429,
"displayName": "Radek Dostal",
"type": "atlassian-user-role-actor",
"name": "supersecretname",
"avatarUrl": "https://jiraurl.com/secure/useravatar?size=xsmall&avatarId=14725"
}
]
}

 

The types are either 'atlassian-group-role-actor' or 'atlassian-user-role-actor'. So doing some data mining you would get something akin to project:role:user list(s) and then you could delete those actors with REST again https://docs.atlassian.com/software/jira/docs/api/REST/8.18.2/#project/{projectIdOrKey}/role-deleteActor

 

You could do the same thing with java/groovy if you have a plugin allowing you to run groovy scripts, but it's essentially the same thing as with REST, get role actors, identify which ones are users, delete.

 

Other than that there is no way to do any such a purge like this in bulk through Web UI. 

Suggest an answer

Log in or Sign up to answer
TAGS

Atlassian Community Events