Skip to content

Instantly share code, notes, and snippets.

@stalniy
Created July 28, 2017 13:09
Show Gist options
  • Select an option

  • Save stalniy/86fc24e8379b2aa4ca24cfa67c3af6a0 to your computer and use it in GitHub Desktop.

Select an option

Save stalniy/86fc24e8379b2aa4ca24cfa67c3af6a0 to your computer and use it in GitHub Desktop.
CASL aliases for feathersjs
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) => {
}
}
@j2L4e
Copy link
Copy Markdown

j2L4e commented Jun 25, 2018

Line 5 should be Ability.addAlias('delete', 'remove'). The arguments are backwards.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment