mirror of
https://github.com/django/django.git
synced 2025-04-01 20:16:43 +00:00
Made modwsgi groups_for_user consistent with check_password
2b5f848207b1dab35afd6f63d0107629c76d4d9a based its changes on #19061 that made the is_active attribute mandatory for user models. The try/except was not removed for the groups_for_user function. refs #19780
This commit is contained in:
parent
718afcafc2
commit
0e18fb04ba
@ -40,11 +40,7 @@ def groups_for_user(environ, username):
|
||||
user = UserModel._default_manager.get_by_natural_key(username)
|
||||
except UserModel.DoesNotExist:
|
||||
return []
|
||||
try:
|
||||
if not user.is_active:
|
||||
return []
|
||||
except AttributeError as e:
|
||||
# a custom user may not support is_active
|
||||
if not user.is_active:
|
||||
return []
|
||||
return [force_bytes(group.name) for group in user.groups.all()]
|
||||
finally:
|
||||
|
Loading…
x
Reference in New Issue
Block a user