Ticket #14795: ticket14795patch.diff

File ticket14795patch.diff, 902 bytes (added by Brett Haydon, 14 years ago)
  • django/contrib/auth/backends.py

    index 9d67466..2f60804 100644
    a b class ModelBackend(object):  
    2525        groups.
    2626        """
    2727        if not hasattr(user_obj, '_group_perm_cache'):
    28             perms = Permission.objects.filter(group__user=user_obj
    29                 ).values_list('content_type__app_label', 'codename'
    30                 ).order_by()
     28            if user_obj.is_superuser:
     29                perms = Permission.objects.all()
     30            else:
     31                perms = Permission.objects.filter(group__user=user_obj)
     32            perms = perms.values_list('content_type__app_label', 'codename').order_by()
    3133            user_obj._group_perm_cache = set(["%s.%s" % (ct, name) for ct, name in perms])
    3234        return user_obj._group_perm_cache
    3335
Back to Top