Uploaded image for project: 'Jira Platform Cloud'
  1. Jira Platform Cloud
  2. JRACLOUD-68146

Need to export all the project permissions assigned to users to Excel or CSV file

    • 12
    • 54
    • Our product teams collect and evaluate feedback from a number of different sources. To learn more about how we use customer feedback in the planning process, check out our new feature policy.

      Customer would like to export this project permissions in a CSV or Excel file.

            [JRACLOUD-68146] Need to export all the project permissions assigned to users to Excel or CSV file

            Ian Butler added a comment -

            Hi Jose, not sure what is wrong here but when i run this script im getting error 

            jq: error (at <stdin>:0): Cannot index array with string "permission"

            Ian Butler added a comment - Hi Jose, not sure what is wrong here but when i run this script im getting error  jq: error (at <stdin>:0): Cannot index array with string "permission"

            Jose Luis Gonzalez added a comment - - edited

            Hello,

            I would like to contribute by adding one workaround for this query for all users can retrieve the report, since permissions are constantly changing, I think it is good to have at least one automatic option. 

             

            # file audit-permissions.sh
            # Requirments: install jq and curl
            # bash script to run in MacOS, linux or similar terminal
            # How to run: ./audit-permissions.sh
            
            projectkeys=(SCRUM BIT3 BUS3)  # insert here the list of project keys 
            APItoken="PutAPITOken" #generate here https://id.atlassian.com/manage-profile/security/api-tokens
            AdminEmail="email@domain.com"
            tenant="your-cloud-url.atlassian.net"
            
            for pkey in "${projectkeys[@]}"
            do
            echo "" > $pkey.csv
            echo "working on project: $pkey"
            echo -e "NAME;accountID;email* (public profiles);permission type" >> $pkey.csv
            # put the desired permission for this endpoint https://developer.atlassian.com/cloud/jira/platform/rest/v2/api-group-user-search/#api-rest-api-2-user-permission-search-get
            permissions=(BROWSE_PROJECTS PROJECT_ADMIN ASSIGN_ISSUE CREATE_ISSUE DELETE_ISSUE EDIT_ISSUE SCHEDULE_ISSUE COMMENT_ISSUE TRANSITION_ISSUE)
              for permission in "${permissions[@]}"
              do
              curl -s --request GET --url "https://$tenant/rest/api/2/user/permission/search?permissions=$permission&projectKey=$pkey" --header 'Accept: application/json' --user $AdminEmail:$APItoken | jq --arg perm "$permission" '.[] | ."permission"=$perm | "\(.displayName); \(.accountId); \(.emailAddress); \(.permission)"' | tr -d '"' >> $pkey.csv
              done
            done
            

             

            the Output is a CSV file for each project with the list of users with the listed permissions.

            NAME accountID email* (public profiles) permission type
            102085dd-1ee2-4322-bc20-23dc18779e1d 60455b6e2b3f9a006a1943d2 BROWSE_PROJECTS
            Atlassian Assist 5cb4ae0e4b97ab11a18e00c7 BROWSE_PROJECTS
            Automation for Jira 557058:f58131cb-b67d-43c7-b30d-6b58d40bd077 BROWSE_PROJECTS
            Azure pipelines DevTest1 5cc2f78de2c4390f04d3195b ASSIGN_ISSUE
            BigPicture - for ppm, project management 557058:46121f43-e58d-4ff4-83fd-a79fb4b71b45 PROJECT_ADMIN

             

            thank you, and it is important to mention that script assistance is not part of the cloud support offerings.  

            Jose Luis Gonzalez added a comment - - edited Hello, I would like to contribute by adding one workaround for this query for all users can retrieve the report, since permissions are constantly changing, I think it is good to have at least one automatic option.    # file audit-permissions.sh # Requirments: install jq and curl # bash script to run in MacOS, linux or similar terminal # How to run: ./audit-permissions.sh projectkeys=(SCRUM BIT3 BUS3) # insert here the list of project keys APItoken= "PutAPITOken" #generate here https: //id.atlassian.com/manage-profile/security/api-tokens AdminEmail= "email@domain.com" tenant= "your-cloud-url.atlassian.net" for pkey in "${projectkeys[@]}" do echo "" > $pkey.csv echo "working on project: $pkey" echo -e "NAME;accountID;email* ( public profiles);permission type" >> $pkey.csv # put the desired permission for this endpoint https: //developer.atlassian.com/cloud/jira/platform/ rest /v2/api-group-user-search/#api- rest -api-2-user-permission-search-get permissions=(BROWSE_PROJECTS PROJECT_ADMIN ASSIGN_ISSUE CREATE_ISSUE DELETE_ISSUE EDIT_ISSUE SCHEDULE_ISSUE COMMENT_ISSUE TRANSITION_ISSUE) for permission in "${permissions[@]}" do curl -s --request GET --url "https: //$tenant/ rest /api/2/user/permission/search?permissions=$permission&projectKey=$pkey" --header 'Accept: application/json' --user $AdminEmail:$APItoken | jq --arg perm "$permission" '.[] | . "permission" =$perm | "\(.displayName); \(.accountId); \(.emailAddress); \(.permission)" ' | tr -d '"' >> $pkey.csv done done   the Output is a CSV file for each project with the list of users with the listed permissions. NAME accountID email* (public profiles) permission type 102085dd-1ee2-4322-bc20-23dc18779e1d 60455b6e2b3f9a006a1943d2 BROWSE_PROJECTS Atlassian Assist 5cb4ae0e4b97ab11a18e00c7 BROWSE_PROJECTS Automation for Jira 557058:f58131cb-b67d-43c7-b30d-6b58d40bd077 BROWSE_PROJECTS Azure pipelines DevTest1 5cc2f78de2c4390f04d3195b ASSIGN_ISSUE BigPicture - for ppm, project management 557058:46121f43-e58d-4ff4-83fd-a79fb4b71b45 PROJECT_ADMIN   thank you, and it is important to mention that script assistance is not part of the cloud support offerings.  

            This would be really helpful in being able to track permissions.

            David Innes added a comment - This would be really helpful in being able to track permissions.

            Rory Tarabay added a comment - - edited

            Agreed it would be useful. Ties in with this request for the same information to be made available over an API

            Rory Tarabay added a comment - - edited Agreed it would be useful. Ties in with  this request for the same information to be made available over an API

            This would be very useful for Site Admins to have a single view. Maybe even a Dashboard widget that only SIte Admins can use if the collation of the data export is too much?

            Lee Calladine added a comment - This would be very useful for Site Admins to have a single view. Maybe even a Dashboard widget that only SIte Admins can use if the collation of the data export is too much?

              Unassigned Unassigned
              gsenna Gabriel Senna
              Votes:
              42 Vote for this issue
              Watchers:
              47 Start watching this issue

                Created:
                Updated: