Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions docs/api-usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -411,6 +411,27 @@ user. For example:

p = gl.projects.create({'name': 'awesome_project'}, sudo='user1')

.. warning::
When using ``sudo``, its usage is not remembered. If you use ``sudo`` to
retrieve an object and then later use ``save()`` to modify the object, it
will not use ``sudo``. You should use ``save(sudo='user1')`` if you want to
perform subsequent actions as the user.

Updating with ``sudo``
----------------------

An example of how to ``get`` an object (using ``sudo``), modify the object, and
then ``save`` the object (using ``sudo``):

.. code-block:: python

group = gl.groups.get('example-group')
notification_setting = group.notificationsettings.get(sudo='user1')
notification_setting.level = gitlab.const.NOTIFICATION_LEVEL_GLOBAL
# Must use `sudo` again when doing the save.
notification_setting.save(sudo='user1')


Logging
=======

Expand Down