MCPcopy Index your code
hub / github.com/simstudioai/sim / checkWorkflowAccessForChatCreation

Function checkWorkflowAccessForChatCreation

apps/sim/app/api/chat/utils.ts:85–104  ·  view source on GitHub ↗
(
  workflowId: string,
  userId: string
)

Source from the content-addressed store, hash-verified

83 * Check if user has permission to create a chat for a specific workflow
84 */
85export 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

Callers 2

executeDeployChatFunction · 0.90
route.tsFile · 0.90

Tested by

no test coverage detected