mirror of
https://github.com/ae-utbm/sith.git
synced 2025-07-10 11:59:23 +00:00
core: add UserIsLoggedMixin to check if an user is not anonymous
This commit is contained in:
@ -214,6 +214,17 @@ class FormerSubscriberMixin(View):
|
||||
return super(FormerSubscriberMixin, self).dispatch(request, *args, **kwargs)
|
||||
|
||||
|
||||
class UserIsLoggedMixin(View):
|
||||
"""
|
||||
This view check if the user is logged
|
||||
"""
|
||||
|
||||
def dispatch(self, request, *args, **kwargs):
|
||||
if request.user.is_anonymous:
|
||||
raise PermissionDenied
|
||||
return super(UserIsLoggedMixin, self).dispatch(request, *args, **kwargs)
|
||||
|
||||
|
||||
class TabedViewMixin(View):
|
||||
"""
|
||||
This view provide the basic functions for displaying tabs in the template
|
||||
|
Reference in New Issue
Block a user