Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Adding user to space using power script

Poojaa Sudhakaran
Contributor
August 8, 2020 edited

Hello there,

I'm trying to build a code snippet using Power Script for Confluence for bulk addition for users to a Confluence space. Below is my code snippet for adding user "sample" to a space with key "TEST". This script always returns a false value and the user is not assigned to the space with the mentioned permission.

string loglevel = "WARN";
logPrint(loglevel, addUserToSpacePermission("VIEWSPACE", "TEST", "sample"));

 But after, adding the user to space manually, the below code snippet work fine in removing the user from space.

string loglevel = "WARN";
logPrint(loglevel, removeUserFromSpacePermission("VIEWSPACE", "TEST", "sample"));

 Could you please help me in adding user to space using the script?

Regards,

Poojaa

1 answer

0 votes
Ivan Lima
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 1, 2020

Hey @Poojaa Sudhakaran , assuming you've got all the parameters correct, this should work just fine. The only reason I see that it doesn't work is that your user "sample" is also a member of a group that already has the VIEWSPACE permission.

Hope it helps.
IL.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events