Add permission check for deleting job

This commit is contained in:
inexcode 2022-08-25 22:42:37 +04:00
parent 0e68ef1386
commit 4f2332f8a0

View file

@ -3,6 +3,7 @@
import strawberry import strawberry
from selfprivacy_api.graphql.mutations.mutation_interface import GenericMutationReturn from selfprivacy_api.graphql.mutations.mutation_interface import GenericMutationReturn
from selfprivacy_api.graphql import IsAuthenticated
from selfprivacy_api.jobs import Jobs from selfprivacy_api.jobs import Jobs
@ -10,7 +11,7 @@ from selfprivacy_api.jobs import Jobs
class JobMutations: class JobMutations:
"""Mutations related to jobs""" """Mutations related to jobs"""
@strawberry.mutation @strawberry.mutation(permission_classes=[IsAuthenticated])
def remove_job(self, job_id: str) -> GenericMutationReturn: def remove_job(self, job_id: str) -> GenericMutationReturn:
"""Remove a job from the queue""" """Remove a job from the queue"""
result = Jobs().remove_by_uuid(job_id) result = Jobs().remove_by_uuid(job_id)