Skip to content
Permalink
c7536581a7
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
47 lines (36 sloc) 777 Bytes
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');
}