`ModelBackend.get_all_permissions` returns permissions for inactive users
The documentation states:
Returns a set of permission strings that the user has, both through group and user permissions
Since has_perm
returns False
for an inactive user, I wouldn't think it should return an empty string.
The behaviour is not as explicitly stated as the other perm methods though, they say:
If the user is inactive, this method will always return False.
r14797 changed get_all_permissions
to return all strings for superusers, which seems to imply this should work the same way that has_perm does, not just provide a list of permission strings directly assigned (or via groups) to the user.
Change History
(11)
Triage Stage: |
Unreviewed → Design decision needed
|
Triage Stage: |
Design decision needed → Accepted
|
Owner: |
changed from nobody to jorgecarleitao
|
Status: |
new → assigned
|
Patch needs improvement: |
set
|
Patch needs improvement: |
unset
|
Patch needs improvement: |
set
|
Resolution: |
→ fixed
|
Status: |
assigned → closed
|
I checked the code, and get_all_permissions does the following:
In "user groups permissions", if the user is superuser, this returns all permissions.
So, in
has_perm
andhas_module_perms
we check foris_active
, but inget_all_permissions
we check foris_anonymous
.Shouldn't this be consistent?