Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

access-right

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

access-right - npm Package Compare versions

Comparing version 1.0.0 to 2.0.0

14

package.json

@@ -10,3 +10,3 @@ {

"build": "npm run lint && npm run test",
"semantic-release": "semantic-release pre && npm publish && semantic-release post"
"semantic-release": "semantic-release"
},

@@ -29,9 +29,9 @@ "repository": {

"devDependencies": {
"eslint": "1.7.3",
"eslint": "^6.6.0",
"eslint-config-ds82": "2.1.0",
"eslint-plugin-jasmine": "1.5.0",
"ghooks": "0.3.2",
"validate-commit-msg": "1.0.0",
"jasmine": "2.3.2",
"semantic-release": "^4.3.5"
"jasmine": "^3.5.0",
"semantic-release": "^15.13.28",
"validate-commit-msg": "1.0.0"
},

@@ -47,3 +47,3 @@ "publishConfig": {

},
"version": "1.0.0"
}
"version": "2.0.0"
}
# access-right
[![Build Status](https://travis-ci.org/ds82/access-right.svg)](https://travis-ci.org/ds82/access-right)
[![Build Status](https://img.shields.io/travis/ds82/access-right.svg?style=flat)](https://travis-ci.org/ds82/access-right) [![npm version](https://img.shields.io/npm/v/access-right.svg?style=flat)](https://www.npmjs.com/package/access-right)

@@ -5,0 +5,0 @@ This tiny library helps you to check if a user has access to somethin (e.g. a resource) in your node app.

var uut = require('../');
describe('access.js', function() {
it('should export a `isAllowed` method', function() {

@@ -11,3 +10,2 @@ expect(uut.isAllowed).toBeDefined();

describe('isAllowed()', function() {
it('should return true if required right is empty string', function() {

@@ -74,2 +72,13 @@ var bool = uut.isAllowed(['some'], '');

describe('in production issues/tests', () => {
it('test #1: is Allowed should return true', () => {
const has = ['filebrowser.local.read'];
const needs = 'filebrowser.local.read.jobs.a1.job';
const result = uut.isAllowed(has, needs);
expect(result).toBe(true);
});
});
});
var _CONST = {
'ROOT_RIGHT_SYMBOL': '*'
ROOT_RIGHT_SYMBOL: '*'
};

@@ -11,3 +11,3 @@

requires = requires || [];
requires = (isArray(requires)) ? requires : [requires];
requires = isArray(requires) ? requires : [requires];

@@ -22,4 +22,4 @@ return isEmpty(requires) || isRoot(has) || checkOr(has, requires);

function isEmpty(requires) {
var isEmptyList = (!requires || requires.length === 0);
var hasEmptyEntry = (requires[0] === '' && requires.length === 1);
var isEmptyList = !requires || requires.length === 0;
var hasEmptyEntry = requires[0] === '' && requires.length === 1;
return isEmptyList || hasEmptyEntry;

@@ -39,3 +39,3 @@ }

right = escapeRegExp(right);
var regExp = new RegExp('^' + right + '(\\.[a-zA-Z\\.]*)*$');
var regExp = new RegExp('^' + right + '(\\.[a-zA-Z0-9\\.]*)*$');
found = found || regExp.test(required);

@@ -42,0 +42,0 @@ });

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc