Comparing version 2.0.1 to 2.0.2
@@ -5,3 +5,3 @@ { | ||
"description": "Permissions checking and handling for zsapi", | ||
"version": "2.0.1" | ||
"version": "2.0.2" | ||
}, | ||
@@ -8,0 +8,0 @@ "files": { |
@@ -540,4 +540,4 @@ // Copyright 2016 Zipscene, LLC | ||
if ( | ||
(!curTree.perms[i].match && !remainingMatchHasKeys) || | ||
JSON.stringify(curTree.perms[i].match || null) === | ||
(!curTree.perms[i].remainingMatch && !remainingMatchHasKeys) || | ||
JSON.stringify(curTree.perms[i].remainingMatch || null) === | ||
JSON.stringify(remainingMatch) | ||
@@ -588,3 +588,2 @@ ) { | ||
} | ||
return permissionsByTarget; | ||
@@ -591,0 +590,0 @@ } |
{ | ||
"name": "flexperm", | ||
"version": "2.0.1", | ||
"version": "2.0.2", | ||
"description": "Flexible, granular, and fast permissions", | ||
@@ -5,0 +5,0 @@ "main": "./lib/index.js", |
@@ -185,2 +185,30 @@ // Copyright 2016 Zipscene, LLC | ||
it('getTargetGrant() combines non-exact match permissions correctly', function() { | ||
let permissions = [ { | ||
target: 'pet', | ||
match: { | ||
$or: [ | ||
{ animalType: 'dog' }, | ||
{ animalType: 'cat' } | ||
] | ||
}, | ||
grant: { | ||
play: true | ||
} | ||
}, { | ||
target: 'pet', | ||
match: {}, | ||
grant: { | ||
feed: true | ||
} | ||
} ]; | ||
let permissionSet = new PermissionSet(permissions); | ||
testGrantValue(permissionSet.getTargetGrant('pet', {}), { feed: true }); | ||
testGrantValue(permissionSet.getTargetGrant('pet', { animalType: 'horse' }), { feed: true }); | ||
testGrantValue(permissionSet.getTargetGrant('pet', { animalType: 'cat' }), { | ||
feed: true, | ||
play: true | ||
}); | ||
}); | ||
it('getTargetGrant() on admin permission', function() { | ||
@@ -187,0 +215,0 @@ let weirdObject = { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
472859
45
5015
5
2