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)
com.riadalabs.jira.plugins.insight.services.model.RoleActorBean;
Forgot to add the link to the api https://insight-javadoc.riada.io/insight-javadoc-8.6.6/insight-core///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.ComponentAccessorimport com.riadalabs.jira.plugins.insight.channel.external.api.facade.ObjectFacadeimport com.riadalabs.jira.plugins.insight.channel.external.api.facade.ObjectTypeFacadeimport com.riadalabs.jira.plugins.insight.channel.external.api.facade.ConfigureFacadeimport com.riadalabs.jira.plugins.insight.services.model.RoleBeanimport com.riadalabs.jira.plugins.insight.services.model.MutableObjectTypeBeanimport com.riadalabs.jira.plugins.insight.services.model.ObjectTypeBeandef objectFacade = ComponentAccessor.getOSGiComponentInstanceOfType(ObjectFacade)def objectTypeFacade = ComponentAccessor.getOSGiComponentInstanceOfType(ObjectTypeFacade)def configureFacade = ComponentAccessor.getOSGiComponentInstanceOfType(ConfigureFacade
String mnemonic = 'TEST'Integer schemaId = 5List parentTypeNames = ['OT1, 'OT2', 'OT3']String userName = 'myusername'String groupName = 'jira-users'String userRoleType = "atlassian-user-role-actor"String groupRoleType = "atlassian-group-role-actor"// create setsSet<String> groupActors = new HashSet<String>()groupActors.add(groupName)// get mutable one of the object beansMutableObjectTypeBean objTypeBean = objectTypeFacade.findObjectTypeBeans(schemaId).find { it.name == parentTypeNames[1]}.createMutable()log.warn(objTypeBean.id)// find all rolesList<RoleBean> roles = configureFacade.findRoleBeansByObjectType(objTypeBean.id)roles.each {// store the actors to role beanconfigureFacade.storeActorsForRoleBean([(groupRoleType): groupActors] as java.util.Map, it?.id)}
It looks like you're new here. Sign in or register to get started.