Skip to content

Commit

Permalink
fix(mis-web): 修复 scow 仅可以提交当前作业的用户来取消作业 (#972)
Browse files Browse the repository at this point in the history
修复 scow 管理系统仅可 以提交当前作业的用户来取消作业,考虑从 scow 做完全的鉴权,不放开适配器权限
slurm adapter 取消作业时会 `su userId scancel xxx`,所以不能提交执行当前操作的用户 id 来取消作业。
scow 会先校验当前用户的权限,如果具有取消用户作业的权限,则获取提交当前作业的用户,使用该用户 userId 来取消作业
  • Loading branch information
Miracle575 authored Nov 13, 2023
1 parent e20be6f commit 99d01eb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/afraid-tips-hug.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@scow/mis-web": patch
---

适应 scow slurm 适配器仅可取消提交当前作业用户的作业
3 changes: 2 additions & 1 deletion apps/mis-web/src/pages/api/job/cancelJob.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,9 @@ export default /* #__PURE__*/route(CancelJobSchema, async (req, res) => {
},
};

// Cancel the job for the user who submitted the job
return asyncUnaryCall(client, "cancelJob", {
jobId: +jobId, userId: info.identityId, cluster,
jobId: +jobId, userId: job.user, cluster,
}).then(async () => {
await callLog(logInfo, OperationResult.SUCCESS);
return { 204: null };
Expand Down

0 comments on commit 99d01eb

Please sign in to comment.