Skip to content

Commit

Permalink
Update JobCreatePermissionMixin to use AccessMixin
Browse files Browse the repository at this point in the history
  • Loading branch information
amickan committed Dec 18, 2024
1 parent c013aa6 commit 97f2f62
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions app/grandchallenge/algorithms/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -480,19 +480,18 @@ def get_success_url(self):


class JobCreatePermissionMixin(
LoginRequiredMixin,
ObjectPermissionRequiredMixin,
VerificationRequiredMixin,
LoginRequiredMixin, VerificationRequiredMixin, AccessMixin
):
permission_required = "algorithms.execute_algorithm"
raise_exception = True

@cached_property
def algorithm(self) -> Algorithm:
return get_object_or_404(Algorithm, slug=self.kwargs["slug"])

def get_permission_object(self):
return self.algorithm
def dispatch(self, request, *args, **kwargs):
if not request.user.has_perm(
"algorithms.execute_algorithm", self.algorithm
):
return self.handle_no_permission()
return super().dispatch(request, *args, **kwargs)


class JobInterfaceSelect(
Expand Down

0 comments on commit 97f2f62

Please sign in to comment.