📄 Add Commercial License for ee folder (#1532)
This commit is contained in:
13
packages/db-rules/isAdminWriteWorkspaceForbidden.ts
Normal file
13
packages/db-rules/isAdminWriteWorkspaceForbidden.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
import { MemberInWorkspace, User } from '@typebot.io/prisma'
|
||||
|
||||
export const isAdminWriteWorkspaceForbidden = (
|
||||
workspace: {
|
||||
members: Pick<MemberInWorkspace, 'role' | 'userId'>[]
|
||||
},
|
||||
user: Pick<User, 'email' | 'id'>
|
||||
) => {
|
||||
const userRole = workspace.members.find(
|
||||
(member) => member.userId === user.id
|
||||
)?.role
|
||||
return !userRole || userRole !== 'ADMIN'
|
||||
}
|
||||
Reference in New Issue
Block a user