Skip to content

Latest commit

 

History

History
243 lines (169 loc) · 5.04 KB

File metadata and controls

243 lines (169 loc) · 5.04 KB

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

Examples

Get the list of users:

.. literalinclude:: users.py
   :start-after: # list
   :end-before: # end list

Search users whose username match the given string:

.. literalinclude:: users.py
   :start-after: # search
   :end-before: # end search

Get a single user:

.. literalinclude:: users.py
   :start-after: # get
   :end-before: # end get

Create a user:

.. literalinclude:: users.py
   :start-after: # create
   :end-before: # end create

Update a user:

.. literalinclude:: users.py
   :start-after: # update
   :end-before: # end update

Delete a user:

.. literalinclude:: users.py
   :start-after: # delete
   :end-before: # end delete

Block/Unblock a user:

.. literalinclude:: users.py
   :start-after: # block
   :end-before: # end block

Current User

Examples

Get the current user:

.. literalinclude:: users.py
   :start-after: # currentuser get
   :end-before: # end currentuser get

GPG keys

You can manipulate GPG keys for the current user and for the other users if you are admin.

Exemples

List GPG keys for a user:

.. literalinclude:: users.py
   :start-after: # gpgkey list
   :end-before: # end gpgkey list

Get an GPG gpgkey for a user:

.. literalinclude:: users.py
   :start-after: # gpgkey get
   :end-before: # end gpgkey get

Create an GPG gpgkey for a user:

.. literalinclude:: users.py
   :start-after: # gpgkey create
   :end-before: # end gpgkey create

Delete an GPG gpgkey for a user:

.. literalinclude:: users.py
   :start-after: # gpgkey delete
   :end-before: # end gpgkey delete

SSH keys

You can manipulate SSH keys for the current user and for the other users if you are admin.

Exemples

List SSH keys for a user:

.. literalinclude:: users.py
   :start-after: # key list
   :end-before: # end key list

Get an SSH key for a user:

.. literalinclude:: users.py
   :start-after: # key get
   :end-before: # end key get

Create an SSH key for a user:

.. literalinclude:: users.py
   :start-after: # key create
   :end-before: # end key create

Delete an SSH key for a user:

.. literalinclude:: users.py
   :start-after: # key delete
   :end-before: # end key delete

Emails

You can manipulate emails for the current user and for the other users if you are admin.

Exemples

List emails for a user:

.. literalinclude:: users.py
   :start-after: # email list
   :end-before: # end email list

Get an email for a user:

.. literalinclude:: users.py
   :start-after: # email get
   :end-before: # end email get

Create an email for a user:

.. literalinclude:: users.py
   :start-after: # email create
   :end-before: # end email create

Delete an email for a user:

.. literalinclude:: users.py
   :start-after: # email delete
   :end-before: # end email delete