Users and current user¶
The Gitlab API exposes user-related method that can be manipulated by admins only.
The currently logged-in user is also exposed.
Users¶
References¶
v4 API:
gitlab.Gitlab.users
GitLab API: https://docs.gitlab.com/ce/api/users.html
Examples¶
Get the list of users:
Search users whose username match a given string:
Get a single user:
Create a user:
Update a user:
Delete a user:
Block/Unblock a user:
Set the avatar image for a user:
Set an external identity for a user:
User custom attributes¶
References¶
v4 API:
gitlab.v4.objects.User.customattributes
GitLab API: https://docs.gitlab.com/ce/api/custom_attributes.html
Examples¶
List custom attributes for a user:
Get a custom attribute for a user:
Set (create or update) a custom attribute for a user:
Delete a custom attribute for a user:
Search users by custom attribute:
User impersonation tokens¶
References¶
v4 API:
gitlab.v4.objects.User.impersonationtokens
GitLab API: https://docs.gitlab.com/ce/api/users.html#get-all-impersonation-tokens-of-a-user
List impersonation tokens for a user:
Get an impersonation token for a user:
Create and use an impersonation token for a user:
Revoke (delete) an impersonation token for a user:
Current User¶
References¶
v4 API:
gitlab.Gitlab.user
GitLab API: https://docs.gitlab.com/ce/api/users.html
GPG keys¶
References¶
You can manipulate GPG keys for the current user and for the other users if you are admin.
v4 API:
gitlab.v4.objects.CurrentUser.gpgkeys
gitlab.v4.objects.User.gpgkeys
GitLab API: https://docs.gitlab.com/ce/api/users.html#list-all-gpg-keys
Examples¶
List GPG keys for a user:
Get a GPG gpgkey for a user:
Create a GPG gpgkey for a user:
Delete a GPG gpgkey for a user:
SSH keys¶
References¶
You can manipulate SSH keys for the current user and for the other users if you are admin.
v4 API:
gitlab.v4.objects.CurrentUser.keys
gitlab.v4.objects.User.keys
GitLab API: https://docs.gitlab.com/ce/api/users.html#list-ssh-keys
Examples¶
List SSH keys for a user:
Create an SSH key for a user:
Delete an SSH key for a user:
Emails¶
References¶
You can manipulate emails for the current user and for the other users if you are admin.
v4 API:
gitlab.v4.objects.CurrentUser.emails
gitlab.v4.objects.User.emails
GitLab API: https://docs.gitlab.com/ce/api/users.html#list-emails
Examples¶
List emails for a user:
Get an email for a user:
Create an email for a user:
Delete an email for a user:
Users activities¶
References¶
admin only
v4 API:
gitlab.Gitlab.user_activities
GitLab API: https://docs.gitlab.com/ce/api/users.html#get-user-activities-admin-only
Examples¶
Get the users activities: