mirror of
https://github.com/ae-utbm/sith.git
synced 2024-11-22 22:23:23 +00:00
core: put User.group's names in cache
This commit is contained in:
parent
af3e2fb951
commit
82df424146
@ -366,7 +366,11 @@ class User(AbstractBaseUser):
|
|||||||
return False
|
return False
|
||||||
if group_id == settings.SITH_GROUP_ROOT_ID and self.is_superuser:
|
if group_id == settings.SITH_GROUP_ROOT_ID and self.is_superuser:
|
||||||
return True
|
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
|
@cached_property
|
||||||
def is_root(self):
|
def is_root(self):
|
||||||
|
Loading…
Reference in New Issue
Block a user