Commit 33767766 authored by Michal Čihař's avatar Michal Čihař

Fix getting of permissions for anonymous user

- correctly pass obj instance so that querying on model works
- temporay set user active (without saving to database) when querying
  for permissions as with Django 1.8 not active users have no
  permissions
parent dfdc4c75
......@@ -42,7 +42,8 @@ class WeblateUserBackend(ModelBackend):
# Need to access private attribute, pylint: disable=W0212
if not hasattr(user_obj, '_perm_cache'):
anon_user = User.objects.get(username=ANONYMOUS_USER_NAME)
user_obj._perm_cache = self.get_all_permissions(anon_user)
anon_user.is_active = True
user_obj._perm_cache = self.get_all_permissions(anon_user, obj)
return user_obj._perm_cache
return super(WeblateUserBackend, self).get_all_permissions(
user_obj, obj
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment