core: add UserIsLoggedMixin to check if an user is not anonymous

This commit is contained in:
2019-07-15 12:26:04 +02:00
parent b18746e769
commit 9b7b96a310
2 changed files with 13 additions and 6 deletions

View File

@ -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