diff --git a/src/users/permissions.py b/src/users/permissions.py index 92eea61..9c40619 100644 --- a/src/users/permissions.py +++ b/src/users/permissions.py @@ -5,6 +5,6 @@ class VerifiedUser(permissions.BasePermission): """ Custom permission to only allow verified users """ + def has_permission(self, request, view): + return request.user.profile.verified - def has_object_permission(self, request, view, obj): - return obj.verified diff --git a/src/users/views.py b/src/users/views.py index d0fdef0..9fd596c 100644 --- a/src/users/views.py +++ b/src/users/views.py @@ -170,7 +170,7 @@ class OwnMentorView(generics.RetrieveUpdateDestroyAPIView): """ View for turning mentor status on (post) and modifying all mentor fields """ - permission_classes = tuple() + permission_classes = (VerifiedUser,) serializer_class = MentorSerializer def get_object(self):