Skip to content
Permalink
Browse files
adding permissions for applications
  • Loading branch information
skondram committed Nov 26, 2021
1 parent 76c9837 commit c7536581a7772460cc25d488c3e71b1d1adcd901
Showing 1 changed file with 47 additions and 0 deletions.
@@ -0,0 +1,47 @@
const AccessControl = require('role-acl');
const ac = new AccessControl();


ac
.grant('user')
.condition({Fn:'EQUALS', args: {'requester':'$.owner'}})
.execute('update')
.on('application');

ac
.grant('user')
.execute('delete')
.on('application');

ac
.grant('admin')
.execute('update')
.on('application');


ac
.grant('admin')
.execute('delete')
.on('application');




exports.update = (requester, data) => {
console.log(requester)
console.log(data)
return ac
.can(requester.role)
.context({requester:requester.ID, owner:data.authorID})
.execute('update')
.sync()
.on('application');
}

exports.delete = (requester) => {
return ac
.can(requester.role)
.execute('delete')
.sync()
.on('application');
}

0 comments on commit c753658

Please sign in to comment.