Skip to content

Commit

Permalink
Add more error messages
Browse files Browse the repository at this point in the history
  • Loading branch information
danniel committed Nov 22, 2024
1 parent be87b50 commit 0cd387b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions backend/hub/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -933,20 +933,20 @@ def get_success_url(self):

def post(self, request, *args, **kwargs):
if not FeatureFlag.flag_enabled(PHASE_CHOICES.enable_candidate_editing):
raise PermissionDenied
raise PermissionDenied(_("Candidate editing disabled"))

user = self.request.user
user_org: Organization = user.organization
candidate: Candidate = self.get_object()

if not user_org:
raise PermissionDenied
raise PermissionDenied(_("No user organization"))

if not candidate:
raise PermissionDenied
raise PermissionDenied(_("No candidate"))

if not candidate == user_org.candidate:
raise PermissionDenied
raise PermissionDenied(_("Candidate does not belong to user organization"))

return super().post(request, *args, **kwargs)

Expand Down

0 comments on commit 0cd387b

Please sign in to comment.