ARTIFACTORY: How to get admin user list via Shell or SQL?
There is no REST API available to list admin users only.
You should combine the Get Users and Get User Details REST API calls.
Solution 1
Please see this KB article on how to get admin users using python script
Solution 2You can use this Shell Script. Please modify user, password and Artifactory url
#!/bin/bash
results=($(curl -u admin:password1A "http://art7.gcp:8081/artifactory/api/security/users" | jq -r '.[].name'))
for i in "${results[@]}"; do
admin_val=($(curl -uadmin:password1A "http://art7.gcp:8081/artifactory/api/security/users/$i" | jq -r '.admin'))
if [ $admin_val == "false" ]; then
echo "$i" >> non_admin_users.txt
else
echo "$i" >> admin_users.txt
fi
doneSolution 3
You can use the following SQL in DB
SELECT username FROM access_users WHERE user_id IN ( SELECT user_id FROM access_users_custom_data WHERE prop_key='artifactory_admin' AND prop_value='true');