You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
Next: Root
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
The Atlassian Community can help you and your team get more value out of Atlassian products and practices.
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!
Hi,
You can use the JAVA API for this. You can use:
class ConfigureFacadeImpl
public void storeActorsForRoleBean(Map<String,Set<String>> newRoleActorBeans,
int roleBeanId)
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.
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.
Forgot to add the link to the api https://insight-javadoc.riada.io/insight-javadoc-8.6.6/insight-core/
//Puya
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.
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
import com.riadalabs.jira.plugins.insight.channel.external.api.facade.ObjectFacade
import com.riadalabs.jira.plugins.insight.channel.external.api.facade.ObjectTypeFacade
import com.riadalabs.jira.plugins.insight.channel.external.api.facade.ConfigureFacade
import com.riadalabs.jira.plugins.insight.services.model.RoleBean
import com.riadalabs.jira.plugins.insight.services.model.MutableObjectTypeBean
import com.riadalabs.jira.plugins.insight.services.model.ObjectTypeBean
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>()
groupActors.add(groupName)
// get mutable one of the object beans
MutableObjectTypeBean objTypeBean = objectTypeFacade.findObjectTypeBeans(schemaId).find {
it.name == parentTypeNames[1]
}.createMutable()
log.warn(objTypeBean.id)
// find all roles
List<RoleBean> roles = configureFacade.findRoleBeansByObjectType(objTypeBean.id)
roles.each {
// store the actors to role bean
configureFacade.storeActorsForRoleBean([(groupRoleType): groupActors] as java.util.Map, it?.id)
}
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.