Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Deleted user
0 / 0 points
Next:
badges earned

Your Points Tracker
Challenges
Leaderboard
  • Global
  • Feed

Badge for your thoughts?

You're enrolled in our new beta rewards program. Join our group to get the inside scoop and share your feedback.

Join group
Recognition
Give the gift of kudos
You have 0 kudos available to give
Who do you want to recognize?
Why do you want to recognize them?
Kudos
Great job appreciating your peers!
Check back soon to give more kudos.

Past Kudos Given
No kudos given
You haven't given any kudos yet. Share the love above and you'll see it here.

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Set insight role permission on objecttypes with java

Reto I'm New Here May 06, 2021

Hi,

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! 

1 answer

1 accepted

1 vote
Answer accepted

Hi,

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<com.riadalabs.jira.plugins.insight.services.model.RoleBean>findRoleBeansByObjectType(int objectTypeId)
 
public List<com.riadalabs.jira.plugins.insight.services.model.RoleBean>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 
com.riadalabs.jira.plugins.insight.services.model.RoleActorBean;
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
Reto I'm New Here May 10, 2021

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

Suggest an answer

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

JSM June ask me anything (AMA)

Hello Community members! We’re wrapping up the end of JSM June with an Ask Me Anything (AMA) with the Jira Service Management product team. This is your chance to ask all your ITSM questions to o...

118 views 7 9
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you