New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

role-acl

Package Overview
Dependencies
Maintainers
1
Versions
68
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

role-acl - npm Package Compare versions

Comparing version

to
2.4.2

9

lib/AccessControl.d.ts

@@ -151,2 +151,9 @@ import { Access, IAccessInfo, ICondition, Query, IQueryInfo, Permission } from './core';

/**
* Get allowed grants
* @param {String | String[]} role - Role to be checked.
*
* @returns {IAccessInfo[]} - grants
*/
allowedGrants(role: string | string[]): IAccessInfo[];
/**
* Get roles which allow this permission

@@ -160,3 +167,3 @@ * @param {IQueryInfo} - permission query object we want to check

* Get allowedResources
* @param {String | String[]} role - Role to be checked.
* @param {String | String[]} role - Role to be checked.
*

@@ -163,0 +170,0 @@ * @returns {String[]} - resources

@@ -198,2 +198,11 @@ "use strict";

/**
* Get allowed grants
* @param {String | String[]} role - Role to be checked.
*
* @returns {IAccessInfo[]} - grants
*/
AccessControl.prototype.allowedGrants = function (role) {
return utils_1.default.getUnionGrantsOfRoles(this._grants, role);
};
/**
* Get roles which allow this permission

@@ -209,3 +218,3 @@ * @param {IQueryInfo} - permission query object we want to check

* Get allowedResources
* @param {String | String[]} role - Role to be checked.
* @param {String | String[]} role - Role to be checked.
*

@@ -212,0 +221,0 @@ * @returns {String[]} - resources

@@ -22,2 +22,3 @@ import { IAccessInfo, IQueryInfo, ICondition } from './core';

getUnionAttrsOfRoles(grants: any, query: IQueryInfo): string[];
getUnionGrantsOfRoles(grants: any, role: string | string[]): IAccessInfo[];
getUnionResourcesOfRoles(grants: any, role: string | string[]): string[];

@@ -24,0 +25,0 @@ areGrantsAllowing(grants: IAccessInfo[], query: IQueryInfo): boolean;

10

lib/utils.js

@@ -215,3 +215,3 @@ "use strict";

},
getUnionResourcesOfRoles: function (grants, role) {
getUnionGrantsOfRoles: function (grants, role) {
if (!grants) {

@@ -230,4 +230,8 @@ throw new core_1.AccessControlError('Grants are not set.');

return allGrants.concat(roleGrants);
}, []).map(function (grant) {
return grant.resource;
}, []);
},
getUnionResourcesOfRoles: function (grants, role) {
return utils.getUnionGrantsOfRoles(grants, role)
.map(function (grant) {
return utils.toStringArray(grant.resource);
}).reduce(Notation.Glob.union, []);

@@ -234,0 +238,0 @@ },

{
"name": "role-acl",
"version": "2.4.1",
"version": "2.4.2",
"description": "Role, Attribute and Condition based Access Control for Node.js",

@@ -5,0 +5,0 @@ "main": "./index.js",