Skip to content

Commit

Permalink
fix authentication for /workflows/submit
Browse files Browse the repository at this point in the history
  • Loading branch information
gpelouze committed Sep 8, 2023
1 parent 6992897 commit 044676b
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions vreapis/workflows/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,16 @@ class WorkflowViewSet(GetSerializerMixin,
'list': serializers.WorkflowSerializer
}

def get_permissions(self):
"""
Instantiates and returns the list of permissions that this view requires.
"""
if self.action == 'submit':
permission_classes = [IsAuthenticated]
else:
permission_classes = []
return [permission() for permission in permission_classes]

def get_queryset(self):
logger.debug('----------------get_queryset-------------------------')
query_params = self.request.query_params
Expand Down Expand Up @@ -106,8 +116,6 @@ def list(self, request, *args, **kwargs):

return super().list(self, request, *args, **kwargs)

@authentication_classes([TokenAuthentication])
@permission_classes([IsAuthenticated])
@action(detail=False, methods=['POST'], name='Submit a workflow')
def submit(self, request, *args, **kwargs):
logger.debug('----------------submit-------------------------')
Expand Down

0 comments on commit 044676b

Please sign in to comment.