diff --git a/packages/shared-core/src/sdk/documents/users.ts b/packages/shared-core/src/sdk/documents/users.ts index b58994aa46..ccd88bf854 100644 --- a/packages/shared-core/src/sdk/documents/users.ts +++ b/packages/shared-core/src/sdk/documents/users.ts @@ -87,13 +87,21 @@ export function hasAdminPermissions(user?: User | ContextUser): boolean { return !!user.admin?.global } +export function hasCreatorPermissions(user?: User | ContextUser): boolean { + if (!user) { + return false + } + return !!user.builder?.creator +} + export function isCreator(user?: User | ContextUser): boolean { if (!user) { return false } return ( - isGlobalBuilder(user) || + isGlobalBuilder(user!) || hasAdminPermissions(user) || + hasCreatorPermissions(user) || hasAppBuilderPermissions(user) || hasAppCreatorPermissions(user) ) diff --git a/packages/types/src/documents/global/user.ts b/packages/types/src/documents/global/user.ts index 9769661cd5..337855787f 100644 --- a/packages/types/src/documents/global/user.ts +++ b/packages/types/src/documents/global/user.ts @@ -44,6 +44,7 @@ export interface User extends Document { builder?: { global?: boolean apps?: string[] + creator?: boolean } admin?: { global: boolean