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

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
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Kesha Thillainayagam
Posted Apr 13, 2018 in Confluence

We want to hear how your non-technical teams are using Confluence!

Hi Community! Kesha (kay-sha) from the Confluence marketing team here! Can you share stories with us on how your non-technical (think Marketing, Sales, HR, legal, etc.) teams are using Confluen...

2,922 views 27 12
Join discussion

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