We have 500 plus users in gitlab , we are looking for script to extract the users details in Gitlab which ones are created/mapped through LDAP and users created through gitlab portal directly.
Hi,
Not got LDAP integrated, so if they don’t show differences in the Gitlab Admin UI under Users, then suggest using the Gitlab API: Users API | GitLab
Perhaps on the Users API command it will show the differences between standard and LDAP users. You can use that docs link on your Gitlab install to find out what details are provided. Also, max of 100 results can be returned at any one time, so you’ll need to use the API functionality for page numbers to get the next 100 - 400 users.
All the relevant information to that you should be able to find in the Gitlab API docs on how to do that. Then script and experiment and see what you get
@iwalker i m able to get the users list but i m only able to retrieve the user list which was created by me and not all the users.Let me know any possible solution.
Note i m the admin too of gitlab
Hi Team, Please help , i m able to get user details through script but i m getting result for the users which was only created by me and not all the users present in Gitlab.
#!/bin/bash
echo “Username,Email,State,Created At,Last sign in at, last activity on” > user_activity.csv
curl -s --header “PRIVATE-TOKEN: ***********" https://git-test-.-.com/api/v4/users | jq ‘.’ | jq “select ((.web_url | contains("bot") | not))” | jq '”(.username) (.email) (.state) (.created_at) (.last_sign_in_at) (.last_activity_on)“’ | sed 's/^”(.*)"$/\1/’ | sed ‘s/ {1,}/,/g’ >> user_activity.csv
ssconvert user_activity.csv user_activity.xls