ARTIFACTORY: Update Edit Profile on a list of users

AuthorFullName__c
Derek Pang
articleNumber
000005704
FirstPublishedDate
2023-05-02T09:26:14Z
lastModifiedDate
2025-05-21

ARTIFACTORY: Update Edit Profile on a list of users

You may have a use case where you have a group of users that you want to allow to edit their profile in the Artifactory UI. You can just go to a particular user and enable the configuration in the UI but for a larger group of users, this can become tedious.

User-added image


In this article, I will go over a method to do this more programmatically. We will be exploring the use case of enabling the Edit Profile capability of all LDAP users in an instance of Artifactory. There is no switch in Artifactory to enable this for all LDAP users. You may enable the “Allow Created Users Access to Profile Page” in the LDAP settings. but this will only give the configuration to newly created LDAP users in Artifactory the Edit Profile ability but not the existing LDAP users in Artifactory.
 

User-added image

Walkthrough - Giving all existing LDAP users the Edit Profile ability

Please find the steps below to add the Edit Profile ability to all of your LDAP users.

First, get a backup of the access configuration:

$ curl -u admin -X GET -H "Accept: application/xml" <ART_URL>/artifactory/api/system/security > ORIGINALsecurity.xml


Next, we will parse out all LDAP users that do not have the updatable profile option enabled.
You may go through each of these grep steps at a time to see what they are doing and confirm the selections but I will be putting it all in one line.
This is filtering the access config file for all LDAP users, with updatableProfile set to false, and then getting the username and putting it into a list. Please go ahead and check the generated file to see if it looks correct.

grep -B16 "<realm>ldap</realm>" ORIGINALsecurity.xml | grep -B10 "<updatableProfile>false</updatableProfile>" | grep "<username>" | sed -E 's/^.*<username>(.*)<\/username>$/\1/g' > userList.txt


Finally, iterate through the list and give the update profile ability to each of them utilizing this rest api:

while reading -r line; do echo -e "\n\n`date` - CHANGING USER\n"; curl -H "Authorization: Bearer $TOKEN" -XPATCH "<ART_URL>/access/api/v2/users/$line" -H "Content-Type: application/json" -d '{"profile_updatable": true}'; done < userList.txt

Note that the above requires authentication with an Access Token. Before running this loop I set TOKEN with the admin access token as a variable. (i.e. export TOKEN=ey...)