Comparing version 1.1.4 to 1.1.5
@@ -97,8 +97,18 @@ "use strict"; | ||
getUsers(name, ...domain) { | ||
if (domain.length === 1) { | ||
name = domain[0] + '::' + name; | ||
} | ||
else if (domain.length > 1) { | ||
throw new Error('error: domain should be 1 parameter'); | ||
} | ||
if (!this.hasRole(name)) { | ||
throw new Error('error: name does not exist'); | ||
} | ||
return [...this.allRoles.values()] | ||
let users = [...this.allRoles.values()] | ||
.filter(n => n.hasDirectRole(name)) | ||
.map(n => n.name); | ||
if (domain.length === 1) { | ||
users = users.map(n => n.substring(domain[0].length + 2, n.length)); | ||
} | ||
return users; | ||
} | ||
@@ -105,0 +115,0 @@ /** |
{ | ||
"name": "casbin", | ||
"version": "1.1.4", | ||
"version": "1.1.5", | ||
"description": "An authorization library that supports access control models like ACL, RBAC, ABAC in Node.JS", | ||
@@ -5,0 +5,0 @@ "main": "lib/casbin.js", |
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
165801
3536