Created
July 28, 2017 13:09
-
-
Save stalniy/86fc24e8379b2aa4ca24cfa67c3af6a0 to your computer and use it in GitHub Desktop.
CASL aliases for feathersjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const { Ability, AbilityBuilder } = require('casl') | |
| Ability.addAlias('update', 'patch') | |
| Ability.addAlias('read', ['get', 'find']) | |
| Ability.addAlias('remove', 'delete') | |
| // the rest of the logic | |
| module.exports = function authorize(serviceName) { | |
| return async (hook) => { | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Line 5 should be
Ability.addAlias('delete', 'remove'). The arguments are backwards.