I have an app where multiple users are allowed to edit the data of an object, let's just say user A, B, and C. All with both Read and Write explicitly defined on the objects ACL.
When I'm logged in as user A, I can remove access for user B and C... but when I try to remove myself it throws an error:
CommunicationError {message: "The permission modification is not valid.", name: "CommunicationError", cause: {…}, reason: "Invalid Permission Modification", status: 462, …}
Is there a way to allow a user to remove his own ACLs? And if not, given this code, how can I catch this error and do alert("You can't remove your own access to this company, please have an associate remove you or contact our support team.") ?
removeManager(event, id) {
event.preventDefault();
db.Companies.load(this.props.match.params.id)
.then((company) => {
company.acl.denyReadAccess(id);
company.acl.denyWriteAccess(id);
return company.update()
.then(() => {
return company.partialUpdate()
.remove("managers", id)
.execute()
.then(() => {
this.getCompanyandManagers()
})
})
})
}