Budibase is an open-source low-code platform for creating internal apps in minutes. Supports PostgreSQL, MySQL, MSSQL, MongoDB, Rest API, Docker, K8s 🚀
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

24 lines
767 B

export const buildPermissionsEndpoints = API => ({
/**
* Gets the permission required to access a specific resource
* @param resourceId the resource ID to check
*/
getPermissionForResource: async resourceId => {
return await API.get({
url: `/api/permission/${resourceId}`,
})
},
/**
* Updates the permissions for a certain resource
* @param resourceId the ID of the resource to update
* @param roleId the ID of the role to update the permissions of
* @param level the level to assign the role for this resource
* @return {Promise<*>}
*/
updatePermissionForResource: async ({ resourceId, roleId, level }) => {
return await API.post({
url: `/api/permission/${roleId}/${resourceId}/${level}`,
})
},
})