feathers-permissions
feathers-permissions copied to clipboard
Add a client-side counterpart
After integrating feathers-permissions (backed by PostgreSQL), I want to make it possible for UI devs to use the same logic.
contrived example: class="'userInstance.can('item:remove') || 'disabled'"
I'd like to move https://github.com/feathersjs-ecosystem/feathers-permissions/blob/master/lib/index.js#L39-L60 into its own function so that it can be used by the existing hook and a more generic implementation.
e.g.
permissionsContain(permissions, roles, method);
checkPermission(permission, permissions);
checkPermission('item:get', [ 'item:*' ]);
FrontendUserModel.prototype.can = function(permission) {
return checkPermission(permission, this.permissions);
}