feat: Add initial scope checks via decorators (#7737)

This commit is contained in:
Val
2023-11-28 11:41:34 +00:00
committed by GitHub
parent 753cbc1e96
commit a37f1cb0ba
22 changed files with 233 additions and 89 deletions

View File

@@ -109,8 +109,7 @@ EEWorkflowController.get(
}
const userSharing = workflow.shared?.find((shared) => shared.user.id === req.user.id);
if (!userSharing && req.user.globalRole.name !== 'owner') {
if (!userSharing && !(await req.user.hasGlobalScope('workflow:read'))) {
throw new UnauthorizedError(
'You do not have permission to access this workflow. Ask the owner to share it with you',
);