( workflowId: string, userId: string )
| 83 | * Check if user has permission to create a chat for a specific workflow |
| 84 | */ |
| 85 | export async function checkWorkflowAccessForChatCreation( |
| 86 | workflowId: string, |
| 87 | userId: string |
| 88 | ): Promise<{ hasAccess: boolean; workflow?: any }> { |
| 89 | const authorization = await authorizeWorkflowByWorkspacePermission({ |
| 90 | workflowId, |
| 91 | userId, |
| 92 | action: 'admin', |
| 93 | }) |
| 94 | |
| 95 | if (!authorization.workflow) { |
| 96 | return { hasAccess: false } |
| 97 | } |
| 98 | |
| 99 | if (authorization.allowed) { |
| 100 | return { hasAccess: true, workflow: authorization.workflow } |
| 101 | } |
| 102 | |
| 103 | return { hasAccess: false } |
| 104 | } |
| 105 | |
| 106 | /** |
| 107 | * Check if user has access to view/edit/delete a specific chat |
no test coverage detected