🚑 (editor) Fix typebot update permission
This commit is contained in:
@ -58,7 +58,7 @@ export const getLinkedTypebots = authenticatedProcedure
|
||||
createdAt: true,
|
||||
workspace: {
|
||||
select: {
|
||||
isQuarantined: true,
|
||||
isSuspended: true,
|
||||
isPastDue: true,
|
||||
members: {
|
||||
select: {
|
||||
@ -109,7 +109,7 @@ export const getLinkedTypebots = authenticatedProcedure
|
||||
createdAt: true,
|
||||
workspace: {
|
||||
select: {
|
||||
isQuarantined: true,
|
||||
isSuspended: true,
|
||||
isPastDue: true,
|
||||
members: {
|
||||
select: {
|
||||
|
@ -34,7 +34,7 @@ export const getCollaborators = authenticatedProcedure
|
||||
collaborators: true,
|
||||
workspace: {
|
||||
select: {
|
||||
isQuarantined: true,
|
||||
isSuspended: true,
|
||||
isPastDue: true,
|
||||
members: {
|
||||
select: {
|
||||
|
@ -39,7 +39,7 @@ export const deleteResults = authenticatedProcedure
|
||||
groups: true,
|
||||
workspace: {
|
||||
select: {
|
||||
isQuarantined: true,
|
||||
isSuspended: true,
|
||||
isPastDue: true,
|
||||
members: {
|
||||
select: {
|
||||
|
@ -36,7 +36,7 @@ export const getResult = authenticatedProcedure
|
||||
groups: true,
|
||||
workspace: {
|
||||
select: {
|
||||
isQuarantined: true,
|
||||
isSuspended: true,
|
||||
isPastDue: true,
|
||||
members: {
|
||||
select: {
|
||||
|
@ -31,7 +31,7 @@ export const getResultLogs = authenticatedProcedure
|
||||
groups: true,
|
||||
workspace: {
|
||||
select: {
|
||||
isQuarantined: true,
|
||||
isSuspended: true,
|
||||
isPastDue: true,
|
||||
members: {
|
||||
select: {
|
||||
|
@ -53,7 +53,7 @@ export const getResults = authenticatedProcedure
|
||||
},
|
||||
workspace: {
|
||||
select: {
|
||||
isQuarantined: true,
|
||||
isSuspended: true,
|
||||
isPastDue: true,
|
||||
members: {
|
||||
select: {
|
||||
|
@ -36,7 +36,7 @@ export const deleteTypebot = authenticatedProcedure
|
||||
groups: true,
|
||||
workspace: {
|
||||
select: {
|
||||
isQuarantined: true,
|
||||
isSuspended: true,
|
||||
isPastDue: true,
|
||||
members: {
|
||||
select: {
|
||||
|
@ -54,7 +54,7 @@ export const getPublishedTypebot = authenticatedProcedure
|
||||
publishedTypebot: true,
|
||||
workspace: {
|
||||
select: {
|
||||
isQuarantined: true,
|
||||
isSuspended: true,
|
||||
isPastDue: true,
|
||||
members: {
|
||||
select: {
|
||||
|
@ -43,7 +43,7 @@ export const getTypebot = authenticatedProcedure
|
||||
collaborators: true,
|
||||
workspace: {
|
||||
select: {
|
||||
isQuarantined: true,
|
||||
isSuspended: true,
|
||||
isPastDue: true,
|
||||
members: {
|
||||
select: {
|
||||
|
@ -46,7 +46,7 @@ export const publishTypebot = authenticatedProcedure
|
||||
workspace: {
|
||||
select: {
|
||||
plan: true,
|
||||
isQuarantined: true,
|
||||
isSuspended: true,
|
||||
isPastDue: true,
|
||||
members: {
|
||||
select: {
|
||||
|
@ -34,7 +34,7 @@ export const unpublishTypebot = authenticatedProcedure
|
||||
publishedTypebot: true,
|
||||
workspace: {
|
||||
select: {
|
||||
isQuarantined: true,
|
||||
isSuspended: true,
|
||||
isPastDue: true,
|
||||
members: {
|
||||
select: {
|
||||
|
@ -89,7 +89,7 @@ export const updateTypebot = authenticatedProcedure
|
||||
select: {
|
||||
id: true,
|
||||
plan: true,
|
||||
isQuarantined: true,
|
||||
isSuspended: true,
|
||||
isPastDue: true,
|
||||
members: {
|
||||
select: {
|
||||
|
@ -10,13 +10,13 @@ export const isReadTypebotForbidden = async (
|
||||
typebot: {
|
||||
collaborators: Pick<CollaboratorsOnTypebots, 'userId'>[]
|
||||
} & {
|
||||
workspace: Pick<Workspace, 'isQuarantined' | 'isPastDue'> & {
|
||||
workspace: Pick<Workspace, 'isSuspended' | 'isPastDue'> & {
|
||||
members: Pick<MemberInWorkspace, 'userId'>[]
|
||||
}
|
||||
},
|
||||
user: Pick<User, 'email' | 'id'>
|
||||
) =>
|
||||
typebot.workspace.isQuarantined ||
|
||||
typebot.workspace.isSuspended ||
|
||||
typebot.workspace.isPastDue ||
|
||||
(env.ADMIN_EMAIL !== user.email &&
|
||||
!typebot.collaborators.some(
|
||||
|
@ -10,22 +10,22 @@ export const isWriteTypebotForbidden = async (
|
||||
typebot: {
|
||||
collaborators: Pick<CollaboratorsOnTypebots, 'userId' | 'type'>[]
|
||||
} & {
|
||||
workspace: Pick<Workspace, 'isQuarantined' | 'isPastDue'> & {
|
||||
workspace: Pick<Workspace, 'isSuspended' | 'isPastDue'> & {
|
||||
members: Pick<MemberInWorkspace, 'userId' | 'role'>[]
|
||||
}
|
||||
},
|
||||
user: Pick<User, 'id'>
|
||||
) => {
|
||||
return (
|
||||
typebot.workspace.isQuarantined ||
|
||||
typebot.workspace.isSuspended ||
|
||||
typebot.workspace.isPastDue ||
|
||||
!(
|
||||
typebot.collaborators.find(
|
||||
(collaborator) => collaborator.userId === user.id
|
||||
)?.type === CollaborationType.WRITE &&
|
||||
typebot.workspace.members.some(
|
||||
(!typebot.collaborators.some(
|
||||
(collaborator) =>
|
||||
collaborator.userId === user.id &&
|
||||
collaborator.type === CollaborationType.WRITE
|
||||
) &&
|
||||
!typebot.workspace.members.some(
|
||||
(m) => m.userId === user.id && m.role !== 'GUEST'
|
||||
)
|
||||
)
|
||||
))
|
||||
)
|
||||
}
|
||||
|
@ -150,7 +150,7 @@ const parseFilePath = async ({
|
||||
workspace: {
|
||||
select: {
|
||||
plan: true,
|
||||
isQuarantined: true,
|
||||
isSuspended: true,
|
||||
isPastDue: true,
|
||||
members: {
|
||||
select: {
|
||||
|
@ -59,7 +59,7 @@ export const startWhatsAppPreview = authenticatedProcedure
|
||||
id: true,
|
||||
workspace: {
|
||||
select: {
|
||||
isQuarantined: true,
|
||||
isSuspended: true,
|
||||
isPastDue: true,
|
||||
members: {
|
||||
select: {
|
||||
|
Reference in New Issue
Block a user