Closed
Description
Description of the problem, including code/CLI snippet
grp = gl.groups.get('example-group')
notif = grp.notificationsettings.get(sudo=otheruser)
print("Old level:", notif.level)
notif.level = gitlab.const.NOTIFICATION_LEVEL_GLOBAL
notif.save() # missing sudo=otheruser
notif = grp.notificationsettings.get(sudo=otheruser)
print("New level:", notif.level)
Expected Behavior
I would expect this to change the notification level for the sudo'd user.
Actual Behavior
When I call notif.save()
, it has seemingly no effect, because I am missing sudo
.
Instead, the changes were applied to my admin account!
Changing the code to notif.save(sudo=otheruser)
works as expected.
Specifications
- python-gitlab version: 1.4.0
- API version you are using (v3/v4): v4
- Gitlab server version (or gitlab.com): 10.6.4
Proposal
If an object is acquired using sudo=user
, perhaps the library can attach that sudo
user to the SaveMixin
object, and automatically apply it when .save()
is called without arguments.
I consider this a bug, and I can't imagine that anyone is actually relying on the current behavior.