File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -411,6 +411,27 @@ user. For example:
411
411
412
412
p = gl.projects.create({' name' : ' awesome_project' }, sudo = ' user1' )
413
413
414
+ .. warning ::
415
+ When using ``sudo ``, its usage is not remembered. If you use ``sudo `` to
416
+ retrieve an object and then later use ``save() `` to modify the object, it
417
+ will not use ``sudo ``. You should use ``save(sudo='user1') `` if you want to
418
+ perform subsequent actions as the user.
419
+
420
+ Updating with ``sudo ``
421
+ ----------------------
422
+
423
+ An example of how to ``get `` an object (using ``sudo ``), modify the object, and
424
+ then ``save `` the object (using ``sudo ``):
425
+
426
+ .. code-block :: python
427
+
428
+ group = gl.groups.get(' example-group' )
429
+ notification_setting = group.notificationsettings.get(sudo = ' user1' )
430
+ notification_setting.level = gitlab.const.NOTIFICATION_LEVEL_GLOBAL
431
+ # Must use `sudo` again when doing the save.
432
+ notification_setting.save(sudo = ' user1' )
433
+
434
+
414
435
Logging
415
436
=======
416
437
You can’t perform that action at this time.
0 commit comments