Create remove permission js api
This commit is contained in:
parent
dcd8c3b289
commit
566f9ecd22
|
@ -13,6 +13,13 @@ export function createPermissionStore() {
|
||||||
level,
|
level,
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
remove: async ({ level, role, resource }) => {
|
||||||
|
return await API.removePermissionFromResource({
|
||||||
|
resourceId: resource,
|
||||||
|
roleId: role,
|
||||||
|
level,
|
||||||
|
})
|
||||||
|
},
|
||||||
forResource: async resourceId => {
|
forResource: async resourceId => {
|
||||||
return await API.getPermissionForResource(resourceId)
|
return await API.getPermissionForResource(resourceId)
|
||||||
},
|
},
|
||||||
|
|
|
@ -21,4 +21,17 @@ export const buildPermissionsEndpoints = API => ({
|
||||||
url: `/api/permission/${roleId}/${resourceId}/${level}`,
|
url: `/api/permission/${roleId}/${resourceId}/${level}`,
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove the 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 remove the role for this resource
|
||||||
|
* @return {Promise<*>}
|
||||||
|
*/
|
||||||
|
removePermissionFromResource: async ({ resourceId, roleId, level }) => {
|
||||||
|
return await API.delete({
|
||||||
|
url: `/api/permission/${roleId}/${resourceId}/${level}`,
|
||||||
|
})
|
||||||
|
},
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue