Commit c40171fe authored by Sli's avatar Sli

Clean permission check for alcohol and counter ban

parent 2daaf992
Pipeline #308 failed with stage
in 6 minutes and 35 seconds
...@@ -243,11 +243,11 @@ class User(AbstractBaseUser): ...@@ -243,11 +243,11 @@ class User(AbstractBaseUser):
@property @property
def is_banned_alcohol(self): def is_banned_alcohol(self):
return self.groups.filter(name=settings.SITH_GROUPS['banned-alcohol']['name']).exists() return self.is_in_group(settings.SITH_GROUPS['banned-alcohol']['name'])
@property @property
def is_banned_counter(self): def is_banned_counter(self):
return self.groups.filter(name=settings.SITH_GROUPS['banned-from-counters']['name']).exists() return self.is_in_group(settings.SITH_GROUPS['banned-from-counters']['name'])
def save(self, *args, **kwargs): def save(self, *args, **kwargs):
create = False create = False
...@@ -439,6 +439,14 @@ class AnonymousUser(AuthAnonymousUser): ...@@ -439,6 +439,14 @@ class AnonymousUser(AuthAnonymousUser):
def is_launderette_manager(self): def is_launderette_manager(self):
return False return False
@property
def is_banned_alcohol(self):
return False
@property
def is_banned_conuter(self):
return False
def is_in_group(self, group_name): def is_in_group(self, group_name):
""" """
The anonymous user is only the public group The anonymous user is only the public group
......
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