How to create pages from template pages - self service

Description

This is the same scenario as How to create pages from template pages, but uses the Run CLI Actions in Confluence to make is significantly easier to manage and potentially delegate to non-admin users. 

Delegating

Using the Run Self-Service Reports for Confluence and Macro Security for Confluence, a user form can be created to allow non-administrators to run the actions to create pages.

Confluence Download only

Example - user dialog to create a standard personal space



Source for copy/paste convenience

CLI macro body
--action run --continue --findReplace "@userId@:$user,@managerId@:$manager"
 
@DATA:
--action addSpace --userId @userId@

# add admin permission for the user to their own space
--action addpermissions --space "~@userId@" --permissions "SETSPACEPERMISSIONS" --userId @userId@

# add space permissions to allow general user access to personal space
--action addPermissions --space "~@userId@" --group confluence-users --permissions "VIEWSPACE, COMMENT"

# add space permissions to all manager more access
--action addPermissions --space "~@userId@" --userId @managerId@ --permissions "VIEWSPACE, EDITSPACE, EXPORTPAGE, SETPAGEPERMISSIONS, REMOVEPAGE, COMMENT, REMOVECOMMENT, CREATEATTACHMENT, REMOVEATTACHMENT, EXPORTSPACE"

# add pages by copying template pages
--action copyPage --space templateSpace --title @home           --newSpace "~@userId@" --descendents --replace --noConvert
--action copyPage --space templateSpace --title "Public stuff"  --newSpace "~@userId@" --descendents --parent @home --replace --noConvert
--action copyPage --space templateSpace --title "Private stuff" --newSpace "~@userId@" --descendents --parent @home --replace --noConvert
--action copyPage --space templateSpace --title "Manager stuff" --newSpace "~@userId@" --descendents --parent @home --replace --noConvert

# add page permission to protect private section
--action addPermissions --space "~@userId@" --title "Private stuff" --permissions "view, edit" --userId @userId@

# add page permission to protect manager section
--action addPermissions --space "~@userId@" --title "Manager stuff" --permissions "view" --userId @userId@
--action addPermissions --space "~@userId@" --title "Manager stuff" --permissions "view, edit" --userId @managerId@