Added '/api/admin/permissions' post & ajax helper
This commit is contained in:
parent
8c4d9693f5
commit
bd24aae381
9 changed files with 172 additions and 43 deletions
|
|
@ -35,6 +35,23 @@ class canopyAdminUtils{
|
|||
utils.ux.displayResponseError(await response.json());
|
||||
}
|
||||
}
|
||||
|
||||
async setPermission(permObj){
|
||||
var response = await fetch(`/api/admin/permissions`,{
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json"
|
||||
},
|
||||
//Unfortunately JSON doesn't natively handle ES6 maps, and god forbid someone update the standard in a way that's backwards compatible...
|
||||
body: JSON.stringify({permissionsMap: Object.fromEntries(permObj)})
|
||||
});
|
||||
|
||||
if(response.status == 200){
|
||||
return await response.json();
|
||||
}else{
|
||||
utils.ux.displayResponseError(await response.json());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class adminUserList{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue