mirror of
https://gitlab.com/animath/si/plateforme.git
synced 2025-06-21 01:58:23 +02:00
Fix the permission to see a user page
This commit is contained in:
@ -20,6 +20,14 @@ class VolunteerMixin(LoginRequiredMixin):
|
||||
|
||||
|
||||
class UserMixin(LoginRequiredMixin):
|
||||
def dispatch(self, request, *args, **kwargs):
|
||||
user = request.user
|
||||
if user.is_authenticated and not user.registration.is_admin and user.pk != kwargs["pk"]:
|
||||
self.handle_no_permission()
|
||||
return super().dispatch(request, *args, **kwargs)
|
||||
|
||||
|
||||
class UserRegistrationMixin(LoginRequiredMixin):
|
||||
def dispatch(self, request, *args, **kwargs):
|
||||
user = request.user
|
||||
if user.is_authenticated and not user.registration.is_admin and user.registration.pk != kwargs["pk"]:
|
||||
|
Reference in New Issue
Block a user