mirror of https://github.com/django/django.git
Fixed #35792 -- Simplified ModelBackend._get_group_permissions().
This commit is contained in:
parent
470f4c2436
commit
d4e4520efb
|
@ -99,9 +99,7 @@ class ModelBackend(BaseBackend):
|
|||
return user_obj.user_permissions.all()
|
||||
|
||||
def _get_group_permissions(self, user_obj):
|
||||
user_groups_field = get_user_model()._meta.get_field("groups")
|
||||
user_groups_query = "group__%s" % user_groups_field.related_query_name()
|
||||
return Permission.objects.filter(**{user_groups_query: user_obj})
|
||||
return Permission.objects.filter(group__in=user_obj.groups.all())
|
||||
|
||||
def _get_permissions(self, user_obj, obj, from_name):
|
||||
"""
|
||||
|
|
Loading…
Reference in New Issue