Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
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

How to set Confluence permission from Jira issue?

Edited

Hello,

I want to set automatically Confluence permissions from a Jira issue.


On the Issue the user select the permissions like "View Permission". When a other user run the transition for example "permission accepted", then I want to make a api call? (I'm not sure wich method is here the right way) that set permission on confluence. 

I know how to read the selection in the issue and how to set permission on confluence but I don't know how to work with REST Endpoint or how to give the parameters to confluence and execute my confluence script. By the way where i should put my Confluence script?

I have read the documenation but I'm still stuck... Please help me :O

 

Confluence Script - Where should I put this?

import com.atlassian.sal.api.component.ComponentLocator
import com.atlassian.confluence.spaces.SpaceManager
import com.atlassian.confluence.security.SpacePermissionManager
import com.atlassian.confluence.security.SpacePermission
import com.atlassian.user.GroupManager


//Manager
def spaceManager = ComponentLocator.getComponent(SpaceManager)
def spacePermissionManager = ComponentLocator.getComponent(SpacePermissionManager)
def groupManager = ComponentLocator.getComponent(GroupManager)


//Get a space
def targetSpace = spaceManager.getSpace("SPACEKEY")


//Spacepermission


//Get Group or User
def targetGroup = groupManager.getGroup("groupname")


if(!spacePermissionManager.getGroupsWithPermissions(targetSpace ).contains(targetGroup)) {
def spacePermission = SpacePermission.createGroupSpacePermission(SpacePermission.VIEWSPACE_PERMISSION, targetSpace , targetGroup.getName())
spacePermissionManager.savePermission(spacePermission)
}

 

Jira Script (On Transition)

//Import class 


//Manager


//Get Values from Issue

def cfValue = ....
def userForPermission = ...
def groupForPermission = ...


//Call confluence-Api and post data? How to do this?


 

Thank you :)

 

0 answers

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Confluence

Wouldn't it be nice to have this Jira-Confluence integration?

...ossibility became true in a not too far future, project/space access would be left in the hands of all team members. Don't get me wrong: I'd love it! However, it would also be nice to have a way in which j...

59 views 0 1
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