Skip to content

Commit 210994a

Browse files
gerrod3mdellweg
authored andcommitted
Fix add_roles_for_object_creator handling of AnonymousUser
1 parent 95c8d81 commit 210994a

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fixed `add_roles_for_object_creator` not handling anonymous users.

pulpcore/app/models/access_policy.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ def add_roles_for_object_creator(self, roles):
140140

141141
roles = _ensure_iterable(roles)
142142
current_user = get_current_authenticated_user()
143-
if current_user:
143+
if current_user and isinstance(current_user, get_user_model()):
144144
for role in roles:
145145
assign_role(role, current_user, self)
146146

0 commit comments

Comments
 (0)