Open jensens opened 3 years ago
This happens because the function then calls get(username=username)
and this requires at least one of username
or userid
.
I can imagine this code in revoke_roles
:
if user is None:
if username is None:
user = get_current()
else:
user = get(username=username)
That seems the easiest way out of this.
I do wonder if it makes sense to be able to revoke roles from yourself...
Yes, it does make sense in my case. I remove the Owner
role after adding content (in a subscriber) as manager (with plone.api.env.adopt_roles
).
Documentation says:
But if I omit the user and username like so:
api.user.revoke_roles(obj=item, roles=["Owner"])
I got an
Now, question is - is the documentation wrong or is it the implemenation?