Bulk change Confluence Page Permissions using CLI

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

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!

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.

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
Community showcase
Published Mar 12, 2019 in Confluence

Confluence Admin Certification now $150 for Community Members

More and more people are building their careers with Atlassian, and we want you to be at the front of this wave! Important Dates Start the Certification Prep Course by 2 April 2019 Take your e...

713 views 2 13
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you