mirror of
https://github.com/ae-utbm/sith.git
synced 2024-11-22 22:23:23 +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
|
@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):
|
|||||||
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
|
||||||
|
Loading…
Reference in New Issue
Block a user