Skip to content

Commit 325d83b

Browse files
fix: allow users with view-only permissions to execute workflows
The SettingsPermissionGuard for WORKFLOWS was applied at the class level on WorkflowTriggerResolver, requiring the "manage workflow" settings permission for ALL mutations — including runWorkflowVersion. This prevented users with view-only access from executing active workflows they could see. Move the WORKFLOWS permission guard from class-level to method-level on the three management mutations (activateWorkflowVersion, deactivateWorkflowVersion, stopWorkflowRun). The runWorkflowVersion mutation now only requires WorkspaceAuthGuard + UserAuthGuard, allowing any authenticated workspace member to trigger workflows they have view access to. Permission model after this change: - activateWorkflowVersion: requires WORKFLOWS settings permission - deactivateWorkflowVersion: requires WORKFLOWS settings permission - stopWorkflowRun: requires WORKFLOWS settings permission - runWorkflowVersion: requires authentication only (view access) Fixes #15231 Signed-off-by: V Govindarajan <vijay.govindarajan91@gmail.com>
1 parent cb44b22 commit 325d83b

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

packages/twenty-server/src/engine/core-modules/workflow/resolvers/workflow-trigger.resolver.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,7 @@ import { WorkflowTriggerWorkspaceService } from 'src/modules/workflow/workflow-t
2626
import { WorkspaceMemberWorkspaceEntity } from 'src/modules/workspace-member/standard-objects/workspace-member.workspace-entity';
2727

2828
@CoreResolver()
29-
@UseGuards(
30-
WorkspaceAuthGuard,
31-
UserAuthGuard,
32-
SettingsPermissionGuard(PermissionFlagType.WORKFLOWS),
33-
)
29+
@UseGuards(WorkspaceAuthGuard, UserAuthGuard)
3430
@UsePipes(ResolverValidationPipe)
3531
@UseFilters(
3632
WorkflowTriggerGraphqlApiExceptionFilter,
@@ -44,6 +40,7 @@ export class WorkflowTriggerResolver {
4440
) {}
4541

4642
@Mutation(() => Boolean)
43+
@UseGuards(SettingsPermissionGuard(PermissionFlagType.WORKFLOWS))
4744
async activateWorkflowVersion(
4845
@AuthWorkspace() workspace: WorkspaceEntity,
4946
@Args('workflowVersionId', { type: () => UUIDScalarType })
@@ -56,6 +53,7 @@ export class WorkflowTriggerResolver {
5653
}
5754

5855
@Mutation(() => Boolean)
56+
@UseGuards(SettingsPermissionGuard(PermissionFlagType.WORKFLOWS))
5957
async deactivateWorkflowVersion(
6058
@AuthWorkspace() workspace: WorkspaceEntity,
6159
@Args('workflowVersionId', { type: () => UUIDScalarType })
@@ -111,6 +109,7 @@ export class WorkflowTriggerResolver {
111109
}
112110

113111
@Mutation(() => WorkflowRunDTO)
112+
@UseGuards(SettingsPermissionGuard(PermissionFlagType.WORKFLOWS))
114113
async stopWorkflowRun(
115114
@AuthWorkspace() workspace: WorkspaceEntity,
116115
@Args('workflowRunId', { type: () => UUIDScalarType })

0 commit comments

Comments
 (0)