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
Community Members
Community Events
Community Groups

Set insight role permission on objecttypes with java


I'd like to automatize the configuration of permissions of Insight Objecttype with java or REST api. Is that supported and has anyone an idea how I can do that?

Many thanks! 

2 answers

1 accepted

1 vote
Answer accepted


You can use the JAVA API for this. You can use:

class ConfigureFacadeImpl
public void storeActorsForRoleBean(Map<String,Set<String>> newRoleActorBeans,
int roleBeanId)

Parameter newRoleActorBeans is a map where the key is a String either “atlassian-group-role-actor” or “atlassian-user-role-actor” depending on if it’s a group or a user and the value Set<String> is either a Set of userKeys or groupName.

Parameter roleBeanId is the specific id for the role, for example the id for developer role for "Your object schema" or  manager for object type "Your object type". All these roles has their own id. 

To get the roleBeanId for the specific role you are configuring you can use either of the following methods (depending on if the role is in the objectSchema and objectType):
public List<>findRoleBeansByObjectType(int objectTypeId)
public List<>findRoleBeansByObjectSchema(int objectSchemaId)

 The method will return a list of RoleBeans, one for each role (example manager, developer and user). The RoleBean will also include the id. 

Note: When storing a new user or group to a role you'll have to include all the ones that should be in the role because storeActorsForRoleBean will replace the users and groups in a specific role and not just add new ones to it. If you don't know who or which group already was included in the role and you just want to add one then you can use the info from the RoleBean when picking up the id. The RoleBean has a variable called roleActorBeans which is a List of;
for each user/group. The RoleActorBean includes variable "type" which is either “atlassian-group-role-actor” or “atlassian-user-role-actor”  and param "typeParam" which is either userKey or groupName. 

Example 1:
You have "user1" as manager for a schema or object type and would like to add "user2" as manager as well. Your Map newRoleActorBeans should then contain both "user1" and "user2" in the set of strings for the key “atlassian-user-role-actor", and the second param should be the id for manager for the specific object type or schema. 

Example 2: You have "user1" as manager for a schema or object type and would like to add group "jira-group" as manager as well. Your Map newRoleActorBeans should then contain two entries where one contains a key "atlassian-user-role-actor" and the other entire with key “atlassian-group-role-actor” and the set of strings with the key for "jira-group". 

Hope this works for you and good luck!

Cheers // Puya

Hey Puya, thank you very much for the extremely detailed answer!

I have the following code that finds a objectType I want and add a group to each role for that objecttype. If it helps someone then thats great.


import com.atlassian.jira.component.ComponentAccessor

def objectFacade = ComponentAccessor.getOSGiComponentInstanceOfType(ObjectFacade)
def objectTypeFacade = ComponentAccessor.getOSGiComponentInstanceOfType(ObjectTypeFacade)
def configureFacade = ComponentAccessor.getOSGiComponentInstanceOfType(ConfigureFacade
String mnemonic = 'TEST'
Integer schemaId = 5
List parentTypeNames = ['OT1, 'OT2', 'OT3']
String userName = 'myusername'
String groupName = 'jira-users'
String userRoleType = "atlassian-user-role-actor"
String groupRoleType = "atlassian-group-role-actor"

// create sets

Set<String> groupActors = new HashSet<String>()

// get mutable one of the object beans
MutableObjectTypeBean objTypeBean = objectTypeFacade.findObjectTypeBeans(schemaId).find { == parentTypeNames[1]

// find all roles
List<RoleBean> roles = configureFacade.findRoleBeansByObjectType(
roles.each {
// store the actors to role bean
configureFacade.storeActorsForRoleBean([(groupRoleType): groupActors] as java.util.Map, it?.id)

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Jira Service Management

Do you use Jira Service Management for non-IT teams?

To the awesome folks here on Community! My name is Jehan and I'm a product manager on Jira Service Management. We are looking to talk to any of you out there that use our product for non-technical ...

579 views 13 17
Read article

Atlassian Community Events