Giter Site home page Giter Site logo

permitio / permit-node Goto Github PK

View Code? Open in Web Editor NEW
14.0 3.0 0.0 2.56 MB

Node.js SDK for Permit.io: Plug & Play Application Level Authorization

License: MIT License

TypeScript 100.00% Shell 0.01%
attribute-based-access-control authorization javascript permissions rbac role-based-access-control sdk typescript

permit-node's People

Contributors

asafc avatar gemanor avatar obsd avatar omer9564 avatar orishavit avatar orweis avatar razcodev avatar snyk-bot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

permit-node's Issues

[Bug] Resource parameters on getUserPermissions method do not work

  • I'm submitting a ...
    [x] bug report
    [ ] feature request
    [ ] question about the decisions made in the repository
    [ ] question about how to use this project

  • Summary
    The resources and resource_types filter do not work for the getUserPermissions method.

  • Other information (e.g. detailed explanation, stack traces, related issues, suggestions how to fix, links for us to have context, eg. StackOverflow, personal fork, etc.)

The interface IGetUserPermissionsInput is not defined correctly and also not used to check typing in enforcer.ts.
Fix:

src/enforcement/interfaces.ts line 18-23

export interface IGetUserPermissionsInput {
  user: IUser;
  tenants?: string[];
  resources?: string[];
  resource_types?: string[];
}

src/enforcement/enforcer.ts line 171-176

const input: IGetUserPermissionsInput = {
  user: isString(user) ? { key: user } : user,
  tenants,
  resources,
  resource_types,
};

And adding a simple extra test:
rbac.e2e.spec.ts

logger.info('testing get user permissions with resource types parameter set');
userPermissions = await permit.getUserPermissions(user.key, undefined, undefined, [
  'nonExistingResource',
]);
t.is(Object.keys(userPermissions).length, 0);

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.