Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Bulk change Confluence Page Permissions using CLI

John June 30, 2014

Hi, I have an extracted csv file of page permissions and I want to remove these and replace with different groups.

CLI runFromList or runFromCSV would seem a potential solution, but reading the documentation I am not sure I can pass more than one value back into the --common action as replacePermission needs --id, --userId and --permissions

Is the only option editing my CSV file to make each line an action?

2 answers

1 accepted

0 votes
Answer accepted
John July 7, 2014

There were a number of other issues that arose as I tried to script this. I'm using PowerShell ISE (but the same issues occurred with Notepad++ and a CMD window) and I had some form of character encoding issue that I couldn't resolve when using the --action run --file "test.txt" construct. There was a spurious character shown as the first character in the content of the test.txt file no matter what I tried in modifying the --encoding.

In the end I just fed a 1260 line list of commands crafted in excel and TextMate (yes, TM good for regex search and replace) into the CLI and waited for about 5 minutes for it all to complete. A bit of a hack, but it worked!

Bob Swift OSS (Bob Swift Atlassian Apps)
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.
July 7, 2014

Yes, using a simple run action can often be a good solution. I suspect your spurious character was a BOM - Byte order mark character that we have run into in another context. It should be handled in this area as well, so, I created an improvement request: ACLI-179 - Support CSV files containing a leading BOM character.

0 votes
Bob Swift OSS (Bob Swift Atlassian Apps)
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.
July 1, 2014

First, there is no replacePermission action. I assume you are talking about doing a removePermissions and addPermissions . I would recommend you try using these separately on a single example to get the parameters right. Then if you want to do runFromCsv, you will need to provide columns in your csv to match the parameters needed for the single action.

For example:

--action runFromCsv --file xxx.csv --space mySpace --common "--action addPermissions"

With CSV something like:
group, permissions
confluence-administrators, "VIEWSPACE, EDITSPACE"

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events