1
0
Fork 0
mirror of synced 2024-10-02 10:08:09 +13:00

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
}
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)
)

View file

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