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:
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
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
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?
I know that my question is very simple, sorry for that :)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks. You can run ad-hoc code from the Console.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.