Skip to content

Commit

Permalink
bugfix: job execution role check
Browse files Browse the repository at this point in the history
  • Loading branch information
jlarsson committed Sep 27, 2023
1 parent 51de35e commit a9e96f4
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/jobs/jobs-gql-module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@ export const createJobsGqlModule = ({
// https://www.graphql-tools.com/docs/resolvers
jobList: async ({ ctx }) => {
const { user } = ctx
if (normalizeRoles(user?.roles).canRunSystemJobs) {
if (!normalizeRoles(user?.roles).canRunSystemJobs) {
ctx.throw(HttpStatusCodes.UNAUTHORIZED)
}
return jobs.list()
},
jobFind: async ({ ctx, args: { taskId } }) => {
const { user } = ctx
if (normalizeRoles(user?.roles).canRunSystemJobs) {
if (!normalizeRoles(user?.roles).canRunSystemJobs) {
ctx.throw(HttpStatusCodes.UNAUTHORIZED)
}
return jobs.find(taskId)
Expand All @@ -36,7 +36,7 @@ export const createJobsGqlModule = ({
Mutation: {
jobRun: async ({ ctx, args: { jobName } }) => {
const { user } = ctx
if (normalizeRoles(user?.roles).canRunSystemJobs) {
if (!normalizeRoles(user?.roles).canRunSystemJobs) {
ctx.throw(HttpStatusCodes.UNAUTHORIZED)
}
return jobs.runAs(user, jobName, {
Expand Down

0 comments on commit a9e96f4

Please sign in to comment.