Update SDK to account for new creator builder flag

This commit is contained in:
Andrew Kingston 2023-11-23 14:01:58 +00:00
parent 778104d6e6
commit 9b99991b2e
2 changed files with 10 additions and 1 deletions

View File

@ -87,13 +87,21 @@ export function hasAdminPermissions(user?: User | ContextUser): boolean {
return !!user.admin?.global 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 { export function isCreator(user?: User | ContextUser): boolean {
if (!user) { if (!user) {
return false return false
} }
return ( return (
isGlobalBuilder(user) || isGlobalBuilder(user!) ||
hasAdminPermissions(user) || hasAdminPermissions(user) ||
hasCreatorPermissions(user) ||
hasAppBuilderPermissions(user) || hasAppBuilderPermissions(user) ||
hasAppCreatorPermissions(user) hasAppCreatorPermissions(user)
) )

View File

@ -44,6 +44,7 @@ export interface User extends Document {
builder?: { builder?: {
global?: boolean global?: boolean
apps?: string[] apps?: string[]
creator?: boolean
} }
admin?: { admin?: {
global: boolean global: boolean