add api for per app builder and help function
This commit is contained in:
parent
3dea081fdf
commit
8d5f6cf7af
|
@ -250,4 +250,26 @@ export const buildUserEndpoints = API => ({
|
|||
url: `/api/global/users/count/${appId}`,
|
||||
})
|
||||
},
|
||||
|
||||
/**
|
||||
* Adds a per app builder to the selected app
|
||||
* @param appId the applications id
|
||||
* @param userId The id of the user to add as a builder
|
||||
*/
|
||||
addAppBuilder: async ({ userId, appId }) => {
|
||||
return await API.post({
|
||||
url: `/api/global/users/${userId}/app/${appId}/builder`,
|
||||
})
|
||||
},
|
||||
|
||||
/**
|
||||
* Removes a per app builder to the selected app
|
||||
* @param appId the applications id
|
||||
* @param userId The id of the user to remove as a builder
|
||||
*/
|
||||
removeAppBuilder: async ({ userId, appId }) => {
|
||||
return await API.delete({
|
||||
url: `/api/global/users/${userId}/app/${appId}/builder`,
|
||||
})
|
||||
},
|
||||
})
|
||||
|
|
|
@ -71,6 +71,7 @@ export const Features = {
|
|||
BRANDING: "branding",
|
||||
SCIM: "scim",
|
||||
SYNC_AUTOMATIONS: "syncAutomations",
|
||||
APP_BUILDERS: "appBuilders",
|
||||
}
|
||||
|
||||
// Role IDs
|
||||
|
@ -80,6 +81,7 @@ export const Roles = {
|
|||
BASIC: "BASIC",
|
||||
PUBLIC: "PUBLIC",
|
||||
BUILDER: "BUILDER",
|
||||
CREATOR: "CREATOR",
|
||||
}
|
||||
|
||||
export const Themes = [
|
||||
|
|
|
@ -35,6 +35,13 @@ export function isAdminOrBuilder(
|
|||
return isBuilder(user, appId) || isAdmin(user)
|
||||
}
|
||||
|
||||
export function isAdminOrGlobalBuilder(
|
||||
user: User | ContextUser,
|
||||
appId?: string
|
||||
): boolean {
|
||||
return isGlobalBuilder(user) || isAdmin(user)
|
||||
}
|
||||
|
||||
// check if they are a builder within an app (not necessarily a global builder)
|
||||
export function hasAppBuilderPermissions(user?: User | ContextUser): boolean {
|
||||
if (!user) {
|
||||
|
|
Loading…
Reference in New Issue