Skip to content

Instantly share code, notes, and snippets.

@DeadAlready
Last active March 28, 2016 12:47
Show Gist options
  • Save DeadAlready/f30733205e0232efbb4f to your computer and use it in GitHub Desktop.
Save DeadAlready/f30733205e0232efbb4f to your computer and use it in GitHub Desktop.
Functional role definitions
let roles = {
manager: {
can: ['publish'],
inherits: ['writer']
},
writer: {
can: ['write', {
name: 'edit',
when: function (params) {
return params.user.id === params.post.owner;
}
}],
inherits: ['guest']
},
guest: {
can: ['read']
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment