Commit 82df4241 authored by Skia's avatar Skia

core: put User.group's names in cache

parent af3e2fb9
......@@ -366,7 +366,11 @@ class User(AbstractBaseUser):
return False
if group_id == settings.SITH_GROUP_ROOT_ID and self.is_superuser:
return True
return self.groups.filter(name=group_name).exists()
return group_name in self.cached_groups_names
@cached_property
def cached_groups_names(self):
return [g.name for g in self.groups.all()]
@cached_property
def is_root(self):
......
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