accesscontrol
Advanced tools
Comparing version 1.5.2 to 1.5.3
## AccessControl - Change Log | ||
### **v1.5.3** (2017-08-25) | ||
- Errors thrown with more [meaningful messages](https://github.com/onury/accesscontrol/issues/13#issuecomment-324755478). | ||
### **v1.5.2** (2017-07-02) | ||
- Fixed an issue where the grants were not processed into the inner grants object structure; if an array is passed to `AccessControl` constructor. Fixes [issue #10](https://github.com/onury/accesscontrol/issues/10). | ||
- Fixed an issue where the grants were not processed into the inner grants model structure; if an array is passed to `AccessControl` constructor; instead of using `.setGrants()`. Fixes [issue #10](https://github.com/onury/accesscontrol/issues/10). | ||
@@ -7,0 +11,0 @@ ### **v1.5.1** (2017-05-24) |
@@ -20,5 +20,8 @@ "use strict"; | ||
return value.trim().split(/\s*[;,]\s*/); | ||
throw new core_1.AccessControlError('Cannot convert value to array!'); | ||
// throw new Error('Cannot convert value to array!'); | ||
return null; | ||
}, | ||
isFilledStringArray: function (arr) { | ||
if (!arr || !Array.isArray(arr)) | ||
return false; | ||
for (var _i = 0, arr_1 = arr; _i < arr_1.length; _i++) { | ||
@@ -56,5 +59,9 @@ var s = arr_1[_i]; | ||
roles = utils.toStringArray(roles); | ||
if (!roles) | ||
throw new core_1.AccessControlError("Invalid role(s): " + JSON.stringify(roles)); | ||
var arr = roles.concat(); | ||
roles.forEach(function (roleName) { | ||
var role = grants[roleName]; | ||
if (!role) | ||
throw new core_1.AccessControlError("Role not found: \"" + roleName + "\""); | ||
if (Array.isArray(role.$extend)) { | ||
@@ -199,7 +206,2 @@ arr = utils.uniqConcat(arr, role.$extend); | ||
}); | ||
// console.log('======================'); | ||
// console.log('committing >>> ', JSON.stringify(access)); | ||
// console.log('----------------------'); | ||
// console.log('committed >>>\n', JSON.stringify(grants, null, ' ')); | ||
// console.log('======================'); | ||
}, | ||
@@ -296,2 +298,4 @@ /** | ||
var arrExtRoles = utils.toStringArray(extenderRoles); | ||
if (!arrExtRoles) | ||
throw new core_1.AccessControlError("Invalid extender role(s): " + JSON.stringify(extenderRoles)); | ||
var nonExistentExtRoles = utils.getNonExistentRoles(grants, arrExtRoles); | ||
@@ -301,3 +305,6 @@ if (nonExistentExtRoles.length > 0) { | ||
} | ||
utils.toStringArray(roles).forEach(function (role) { | ||
roles = utils.toStringArray(roles); | ||
if (!roles) | ||
throw new core_1.AccessControlError("Invalid role(s): " + JSON.stringify(roles)); | ||
roles.forEach(function (role) { | ||
if (arrExtRoles.indexOf(role) >= 0) { | ||
@@ -304,0 +311,0 @@ throw new core_1.AccessControlError("Attempted to extend role \"" + role + "\" by itself."); |
{ | ||
"name": "accesscontrol", | ||
"version": "1.5.2", | ||
"version": "1.5.3", | ||
"description": "Role and Attribute based Access Control for Node.js", | ||
@@ -57,5 +57,5 @@ "main": "./index.js", | ||
"devDependencies": { | ||
"@types/node": "^8.0.7", | ||
"@types/node": "^8.0.24", | ||
"docma": "^1.5.1", | ||
"jasmine": "^2.6.0", | ||
"jasmine": "^2.7.0", | ||
"jasmine-console-reporter": "^1.2.7", | ||
@@ -65,3 +65,3 @@ "mkdirp": "^0.5.1", | ||
"rimraf": "^2.6.1", | ||
"typescript": "^2.3.3" | ||
"typescript": "^2.4.2" | ||
}, | ||
@@ -68,0 +68,0 @@ "dependencies": { |
<p align="center"><img width="465" height="170" src="https://raw.github.com/onury/accesscontrol/master/ac-logo.png" /></p> | ||
[![build-status](https://img.shields.io/travis/onury/accesscontrol.svg?branch=master)](https://travis-ci.org/onury/accesscontrol) | ||
[![npm](http://img.shields.io/npm/v/accesscontrol.svg)](https://www.npmjs.com/package/accesscontrol) | ||
[![release](https://img.shields.io/github/release/onury/accesscontrol.svg)](https://github.com/onury/accesscontrol) | ||
[![license](http://img.shields.io/npm/l/accesscontrol.svg)](https://github.com/onury/accesscontrol/blob/master/LICENSE) | ||
[![dependencies](https://david-dm.org/onury/accesscontrol.svg)](https://david-dm.org/onury/accesscontrol) | ||
[![maintained](https://img.shields.io/maintenance/yes/2017.svg)](https://github.com/onury/accesscontrol/graphs/commit-activity) | ||
[![TypeScript](https://img.shields.io/badge/written%20in-%20TypeScript%20-6575ff.svg)](https://www.typescriptlang.org) | ||
![npm](https://img.shields.io/npm/v/accesscontrol.svg) | ||
![release](https://img.shields.io/github/release/onury/accesscontrol.svg) | ||
![license](http://img.shields.io/npm/l/accesscontrol.svg) | ||
![maintained](https://img.shields.io/maintenance/yes/2017.svg) | ||
![TypeScript](https://img.shields.io/badge/written%20in-%20TypeScript%20-6575ff.svg) | ||
> © 2017, Onur Yıldırım ([@onury](https://github.com/onury)). MIT License. | ||
> © 2017, Onur Yıldırım (@onury). MIT License. | ||
Role and Attribute based Access Control for Node.js | ||
@@ -232,3 +233,3 @@ | ||
See [CHANGELOG](https://github.com/onury/accesscontrol/blob/master/CHANGELOG.md). | ||
See [CHANGELOG][changelog]. | ||
@@ -245,2 +246,3 @@ ## License | ||
[nist-paper]:http://csrc.nist.gov/groups/SNS/rbac/documents/kuhn-coyne-weil-10.pdf | ||
[changelog]:https://github.com/onury/accesscontrol/blob/master/CHANGELOG.md | ||
[license]:https://github.com/onury/accesscontrol/blob/master/LICENSE |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
144142
3371
247