permitio / permit-node Goto Github PK
View Code? Open in Web Editor NEWNode.js SDK for Permit.io: Plug & Play Application Level Authorization
License: MIT License
Node.js SDK for Permit.io: Plug & Play Application Level Authorization
License: MIT License
The Permit object is initialized with the 'org' or 'project' keys.
When I try to perform --> permit.api.environments.create(project-key, {name: "test"}) --> the response is an empty exception.
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);
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.