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