mirror of
https://github.com/ae-utbm/sith.git
synced 2024-11-22 14:13:21 +00:00
Remove nested exception for stats and added property on AnonymusUser
This commit is contained in:
parent
f7722ed564
commit
3c408551aa
@ -423,6 +423,14 @@ class AnonymousUser(AuthAnonymousUser):
|
|||||||
def is_root(self):
|
def is_root(self):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
@property
|
||||||
|
def is_board_member(self):
|
||||||
|
return False
|
||||||
|
|
||||||
|
@property
|
||||||
|
def is_launderette_manager(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
|
||||||
|
@ -728,12 +728,10 @@ class CounterStatView(DetailView, CanEditMixin):
|
|||||||
try:
|
try:
|
||||||
return super(CounterStatView, self).dispatch(request, *args, **kwargs)
|
return super(CounterStatView, self).dispatch(request, *args, **kwargs)
|
||||||
except:
|
except:
|
||||||
try:
|
if (request.user.is_root
|
||||||
if (request.user.is_root
|
or request.user.is_board_member
|
||||||
or request.user.is_board_member
|
or self.object.is_owned_by(request.user)):
|
||||||
or self.object.is_owned_by(request.user)):
|
return super(CanEditMixin, self).dispatch(request, *args, **kwargs)
|
||||||
return super(CanEditMixin, self).dispatch(request, *args, **kwargs)
|
|
||||||
except:pass
|
|
||||||
raise PermissionDenied
|
raise PermissionDenied
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user