This article explains how to replace group permissions with individual permissions in spaces using Confluence Command Line Interface (CLI).
Instructions
Run the below following CLI command to get CSV file of all space permissions:
Code Block theme Midnight --action runFromSpaceList --common "--action getSpacePermissionList --file permissions.csv --append"
Import the
above "newly created CSV file, permissions.csv
", to SQL database table named
"spacepermissions
". Be sure to preserve the column names.
Export Run the below following SQL query to export the output to a CSV file (, with column headers) , named "groups.csv":
Code Block language sql select distinct Id as `group` from confluence.spacepermissions where `Id Type` = 'group'
Run the below following CLI command to create a list of users for the groups:
Code Block theme Midnight --action runFromGroupList --file groups.csv --common "--action getUserList --columns \"1,2,3\" --file spaceusers.csv --append"
Import the
above "newly created spaceusers.csv
" toto an SQL database table named
"spaceusers
". Be sure to preserve the column names.
Export Run the below following SQL query to export the output to a CSV (file, with column headers) file , named "spaceuserpermissions.csv":
Code Block language sql select distinct space,User as "userId", concat_ws(',', if(`View`='Yes','VIEWSPACE',''), if(`Delete Own`='Yes','REMOVEOWNCONTENT',''), if(`Pages Add`='Yes','EDITSPACE',''), if(`Pages Delete`='Yes','REMOVEPAGE',''), if(`Blog Add`='Yes','EDITBLOG',''), if(`Blog Delete`='Yes','REMOVEBLOG',''), if(`Attachments Add`='Yes','CREATEATTACHMENT',''), if(`Attachments Delete`='Yes','REMOVEATTACHMENT',''), if(`Comments Add`='Yes','COMMENT',''), if(`Comments Remove`='Yes','REMOVECOMMENT',''), if(`Restrictions`='Yes','SETPAGEPERMISSIONS',''), if(`Mail Delete`='Yes','REMOVEMAIL',''), if(`Space Export`='Yes','EXPORTSPACE',''), if(`Admin`='Yes','SETSPACEPERMISSIONS','') ) as "permissions" from confluence.spacepermissions, confluence.spaceusers where confluence.spacepermissions.Id = confluence.spaceusers.User and confluence.spacepermissions.`Id Type` = 'user'
Run the following CLI command to add user permissions:
Code Block theme Midnight --action runFromCsv --file "spaceuserpermissions.csv" --common "--action addPermissions"
Export the below SQL query output to a CSV file (, with column headers) , named "groupspaces.csv":
Code Block select distinct Space, Id as "group" from confluence.spacepermissions where `Id Type` = 'group'
Run the following CLI command to remove group permissions:
Code Block theme Midnight --action runFromCsv --file groupspaces.csv --common "--action removePermissions --permissions @all"
Info |
---|
|
...