Visitar URL original
Add a client-side counterpart · Issue #40 · feathersjs/feathers-permissions · GitHub
Skip to content

Add a client-side counterpart #40

Open

Description

@Alfredo-Delgado

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);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions