• 846
    • 28
    • We collect Confluence feedback from various sources, and we evaluate what we've collected when planning our product roadmap. To understand how this piece of feedback will be reviewed, see our Implementation of New Features Policy.

      NOTE: This suggestion is for Confluence Server. Using Confluence Cloud? See the corresponding suggestion.

      We have dozens of spaces and need ability to programmatically update space permissions. Otherwise it's a really wasteful manual effort.

      Workaround

      Note : The below mentioned workaround is not applicable for all version after Confluence v5.5 as the XML-RPC and SOAP APIs are deprecated since Confluence 5.5 as per Remote Confluence methods – Permissions

      While this is not possible through the REST API, Confluence users and administrators can still use the legacy RPC API to administrate Space Permissions.
      The following document describes the JSON-RPC API: Confluence JSON-RPC APIs.

      The following document highlights all the methods available in the RPC API to manage Space Permissions: Remote Confluence methods – Permissions.
      The following link will send you to a mapping about each space permission string and their related permission: Remote Confluence methods – Space Permissions.

      Below are a few examples of how to use this API to perform Space Permissions operations.
      This is using Shell Script just as an example, since it can be ported to your preferred coding language.
      In these examples, the jq library is used to filter and format the raw output.

      Get all permissions associated to a Space
      #######
      # Attributes to set
      #######
      ADMIN_USRNAME=<username to perform basic authentication>
      ADMIN_USRPWD=<password to perform basic authentication>
      CONFLUENCE_BASE_URL=<Confluence Base URL>
      SPACE_KEY=<Target Space Key>
      
      ####### Run the API method
      API_METHOD=getSpacePermissionSets
      curl --user $ADMIN_USRNAME:$ADMIN_USRPWD -H "Content-Type: application/json" -H "Accept: application/json" -X POST -d '{ "jsonrpc" : "2.0", "method" : "'${API_METHOD}'", "params" : ["'${SPACE_KEY}'"], "id": 7 }' ${CONFLUENCE_BASE_URL}/rpc/json-rpc/confluenceservice-v2?os_authType=basic 2>/dev/null | jq -r '.result[]'
      

      Running example and output excerpt:

      Get users and groups assigned as Space Administrators to a Space
      #######
      # Attributes to set
      #######
      ADMIN_USRNAME=<username to perform basic authentication>
      ADMIN_USRPWD=<password to perform basic authentication>
      CONFLUENCE_BASE_URL=<Confluence Base URL>
      SPACE_KEY=<Target Space Key>
      PERMISSION_TYPE=<permission type string>
      
      ####### Run the API method
      API_METHOD=getSpacePermissionSet
      curl --user $ADMIN_USRNAME:$ADMIN_USRPWD -H "Content-Type: application/json" -H "Accept: application/json" -X POST -d '{ "jsonrpc" : "2.0", "method" : "'${API_METHOD}'", "params" : ["'${SPACE_KEY}'", "'${PERMISSION_TYPE}'"], "id": 7 }' ${CONFLUENCE_BASE_URL}/rpc/json-rpc/confluenceservice-v2?os_authType=basic 2>/dev/null | jq -r '.result[]'
      

      Running example and output excerpt:

      Set Add Page permission to a specific group in a Space
      #######
      # Attributes to set
      #######
      ADMIN_USRNAME=<username to perform basic authentication>
      ADMIN_USRPWD=<password to perform basic authentication>
      CONFLUENCE_BASE_URL=<Confluence Base URL>
      SPACE_KEY=<Target Space Key>
      GROUP_NAME=<Target Group Name>
      PERMISSION_TYPE=EDITSPACE
      
      ####### Run the API method
      API_METHOD=addPermissionToSpace
      curl --user $ADMIN_USRNAME:$ADMIN_USRPWD -H "Content-Type: application/json" -H "Accept: application/json" -X POST -d '{ "jsonrpc" : "2.0", "method" : "'${API_METHOD}'", "params" : ["'${PERMISSION_TYPE}'", "'${GROUP_NAME}'", "'${SPACE_KEY}'"], "id": 7 }' ${CONFLUENCE_BASE_URL}/rpc/json-rpc/confluenceservice-v2?os_authType=basic 2>/dev/null | jq -r '.'
      

      Running example and output excerpt:

      Set Delete Attachments to a specific user in a Space
      #######
      # Attributes to set
      #######
      ADMIN_USRNAME=<username to perform basic authentication>
      ADMIN_USRPWD=<password to perform basic authentication>
      CONFLUENCE_BASE_URL=<Confluence Base URL>
      SPACE_KEY=<Target Space Key>
      USER_NAME=<Target Username>
      PERMISSION_TYPE=<permission type string>
      
      ####### Run the API method
      API_METHOD=addPermissionToSpace
      curl --user $ADMIN_USRNAME:$ADMIN_USRPWD -H "Content-Type: application/json" -H "Accept: application/json" -X POST -d '{ "jsonrpc" : "2.0", "method" : "'${API_METHOD}'", "params" : ["'${PERMISSION_TYPE}'", "'${USER_NAME}'", "'${SPACE_KEY}'"], "id": 7 }' ${CONFLUENCE_BASE_URL}/rpc/json-rpc/confluenceservice-v2?os_authType=basic 2>/dev/null | jq -r '.'
      

      Running example and output excerpt:

        1. addPermissionToSpace-img001.png
          247 kB
          Thiago Masutti
        2. addPermissionToSpace-img002.png
          162 kB
          Thiago Masutti
        3. getSpacePermissionSet-img001.png
          231 kB
          Thiago Masutti
        4. getSpacePermissionSets-img001.png
          264 kB
          Thiago Masutti

            [CONFSERVER-44329] Ability to set space permissions via REST API

            A fix for this issue is available in Confluence Data Center 9.1.0.
            Upgrade now or check out the Release Notes to see what other issues are resolved.

            Jordan Anslow added a comment - A fix for this issue is available in Confluence Data Center 9.1.0. Upgrade now or check out the Release Notes to see what other issues are resolved.

            Thanks, 03cb0c04aa4f - I was hopeful (but was expecting as much).
            Please consider this a request for backporting to previous LTS releases, if you are taking requests .

            Also, please, do not deprecate the other methods to change the permissions until this has been available for a while - it takes us at least a few months to validate the next LTS release after it has been released.

            Rick Carini added a comment - Thanks, 03cb0c04aa4f - I was hopeful (but was expecting as much). Please consider this a request for backporting to previous LTS releases, if you are taking requests . Also, please, do not deprecate the other methods to change the permissions until this has been available for a while - it takes us at least a few months to validate the next LTS release after it has been released.

            Hi, 7675e03adf45,

            Unfortunately you will need to wait for 9.2 LTS to have this feature, it will not be backported to the existing LTS releases. In majority of cases backports would only have bug fixes, we rarely (almost never) include new features into them.

            Irina Tiapchenko added a comment - Hi, 7675e03adf45 , Unfortunately you will need to wait for 9.2 LTS to have this feature, it will not be backported to the existing LTS releases. In majority of cases backports would only have bug fixes, we rarely (almost never) include new features into them.

            Since this is listed as a "Suggestion"/"Feature" will this be backported to the LTS releases (8.5 or 7.19 ) or are we expected to have to wait until the expected LTS 9.2 release?

            Rick Carini added a comment - Since this is listed as a "Suggestion"/"Feature" will this be backported to the LTS releases (8.5 or 7.19 ) or are we expected to have to wait until the expected LTS 9.2 release?

            Mehul Talati added a comment - unable to access confluence Eg: https://confluence.dynamo.prd.aws.jpmchase.net/display/~v761882/Issue+600941+closure+evidence

            Doug added a comment -

            @KenMcClean - this ticket is for Data Center version of Confluence. The API endpoint you have listed in your blog post doesn't exist in the DC version of Confluence at all.

            Doug added a comment - @KenMcClean - this ticket is for Data Center version of Confluence. The API endpoint you have listed in your blog post doesn't exist in the DC version of Confluence at all.

            For clarity's sake #2, the fact that this suggestion exists since 2016 in an enterprise app is insane, and nothing else needs to be said on this topic other than to stare in disbelief.

            So long as there are paid apps to plug the gaps, Atlassian won't do it.

            Radek Dostál added a comment - For clarity's sake #2, the fact that this suggestion exists since 2016 in an enterprise app is insane, and nothing else needs to be said on this topic other than to stare in disbelief. So long as there are paid apps to plug the gaps, Atlassian won't do it.

            For clarity's sake, please note that the REST API endpoint works if you're not using an App within Confluence.   That is, you can reach the API and manage Space Permissions, but you need to use an external tool or script.

            https://www.kennethmcclean.com/blog/scripting-confluence-cloud-space-permissions/

            Ken McClean added a comment - For clarity's sake, please note that the REST API endpoint works if you're not using an App within Confluence .   That is, you can reach the API and manage Space Permissions, but you need to use an external tool or script. https://www.kennethmcclean.com/blog/scripting-confluence-cloud-space-permissions/

            Andrea added a comment -

            please, implement this!

            what good is the ability to create a page if you cannot set permissions at create-time? if I have to do an additional manual job, then why use api at all? SO cumbersome!

            Andrea added a comment - please, implement this! what good is the ability to create a page if you cannot set permissions at create-time? if I have to do an additional manual job, then why use api at all? SO cumbersome!

            Hi @Richard Bukovansky

            unfortunately I don't know that, but I assume Atlassian is working on other important features.

            BTW, if anyone is interested in this functionality, of course, I recommend my plugin Extender for Confluence - from November 26 to November 29, 2021, a 25% discount applies - links and codes are available in the description of the application in Atlassian Marketplace

             

            Best regards

            Adam Labus

            Adam Labus [it.Lab] added a comment - Hi @ Richard Bukovansky unfortunately I don't know that, but I assume Atlassian is working on other important features. BTW, if anyone is interested in this functionality, of course, I recommend my plugin Extender for Confluence - from November 26 to November 29, 2021, a 25% discount applies - links and codes are available in the description of the application in Atlassian Marketplace   Best regards Adam Labus

              03cb0c04aa4f Irina Tiapchenko
              a7d8cf71caed Pavel Chernikov
              Votes:
              523 Vote for this issue
              Watchers:
              326 Start watching this issue

                Created:
                Updated:
                Resolved: