mirror of
https://github.com/ae-utbm/sith.git
synced 2024-12-23 00:01:16 +00:00
Clean permission check for alcohol and counter ban
This commit is contained in:
parent
2daaf992f2
commit
c40171fe86
@ -243,11 +243,11 @@ class User(AbstractBaseUser):
|
||||
|
||||
@property
|
||||
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
|
||||
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):
|
||||
create = False
|
||||
@ -439,6 +439,14 @@ class AnonymousUser(AuthAnonymousUser):
|
||||
def is_launderette_manager(self):
|
||||
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):
|
||||
"""
|
||||
The anonymous user is only the public group
|
||||
|
Loading…
Reference in New Issue
Block a user