Skip to content

Commit

Permalink
Merge pull request #481 from awf-dbca/wl-surrender-fix
Browse files Browse the repository at this point in the history
WL surrender fix
  • Loading branch information
xzzy authored Oct 31, 2024
2 parents 0c4b7ad + 3115caa commit 64f56aa
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion mooringlicensing/components/approvals/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -698,7 +698,7 @@ def approval_reinstate(self, request, *args, **kwargs):
else:
raise serializers.ValidationError("User not authorised to reinstate approval")

@detail_route(methods=['POST',], detail=True, permission_classes=[InternalApprovalPermission])
@detail_route(methods=['POST',], detail=True)
@basic_exception_handler
def approval_surrender(self, request, *args, **kwargs):
instance = self.get_object()
Expand Down
4 changes: 4 additions & 0 deletions mooringlicensing/components/approvals/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -924,6 +924,10 @@ def approval_surrender(self,request,details):
'surrender_date' : details.get('surrender_date').strftime('%d/%m/%Y'),
'details': details.get('surrender_details'),
}

if not (self.applicant_obj == request.user or request.user in self.allowed_assessors):
raise ValidationError("User not authorised to surrender approval")

today = timezone.now().date()
surrender_date = datetime.datetime.strptime(self.surrender_details['surrender_date'],'%d/%m/%Y')
surrender_date = surrender_date.date()
Expand Down

0 comments on commit 64f56aa

Please sign in to comment.