Comparing version 5.14.0-beta.1 to 5.14.0
@@ -1,20 +0,15 @@ | ||
# [5.14.0-beta.1](https://github.com/casbin/node-casbin/compare/v5.13.1...v5.14.0-beta.1) (2022-02-27) | ||
# [5.14.0](https://github.com/casbin/node-casbin/compare/v5.13.2...v5.14.0) (2022-03-18) | ||
### Bug Fixes | ||
### Features | ||
* fix logic error and add unittests ([e36cc23](https://github.com/casbin/node-casbin/commit/e36cc239b1588e884453e5441eda184350fdae39)) | ||
* rename StringAdapter to MemoryAdapter ([0b1019a](https://github.com/casbin/node-casbin/commit/0b1019aa2324ea4ea4c37119728dadac1bcf1fc3)) | ||
* use csv-like format ([3b54c93](https://github.com/casbin/node-casbin/commit/3b54c934d0d9d08a4af18799c1292f9dc728e6a4)) | ||
* **rbac:** add `getUsersForRoleInDomain` & `getRolesForUserInDomain` ([#351](https://github.com/casbin/node-casbin/issues/351)) ([4896ca2](https://github.com/casbin/node-casbin/commit/4896ca260c2f35672b9b520969898155ec616f0b)), closes [#304](https://github.com/casbin/node-casbin/issues/304) | ||
## [5.13.2](https://github.com/casbin/node-casbin/compare/v5.13.1...v5.13.2) (2022-03-02) | ||
### Features | ||
* add policyArrayToString and policyStringToArray to util ([0f66bc1](https://github.com/casbin/node-casbin/commit/0f66bc1b2fcddfd9c6e847dd06fd4a5f53c55fa9)) | ||
* Extend multiple sections type of escapeAssertion ([#180](https://github.com/casbin/node-casbin/issues/180)) ([33c784c](https://github.com/casbin/node-casbin/commit/33c784cbdc0d650ba75b8177b69f41dc0ca11fae)) | ||
* implement csv parser ([968a232](https://github.com/casbin/node-casbin/commit/968a23237b3193e594910f5f798bf349d6bff04c)) | ||
* implement string adapater ([0c59cae](https://github.com/casbin/node-casbin/commit/0c59cae0eba851509ff754b6f523a4feafc11f80)) | ||
* Multiple sections type ([cc58c57](https://github.com/casbin/node-casbin/commit/cc58c57ae4a7c3202c7217497bef8016df93fe26)) | ||
* RBAC with Domains API ([3e38bb5](https://github.com/casbin/node-casbin/commit/3e38bb5a7223657fae21896ba2e0b9b39e099481)) | ||
### Bug Fixes | ||
* *matcher result should be boolean or number* for KeyGet2 ([#347](https://github.com/casbin/node-casbin/issues/347)) ([0257078](https://github.com/casbin/node-casbin/commit/0257078e1302f5ef081ec143afe5c470f4f862e9)) | ||
## [5.13.1](https://github.com/casbin/node-casbin/compare/v5.13.0...v5.13.1) (2022-02-22) | ||
@@ -21,0 +16,0 @@ |
{ | ||
"name": "casbin", | ||
"version": "5.14.0-beta.1", | ||
"description": "An authorization library that supports access control models like ACL, RBAC, ABAC in JavaScript", | ||
"main": "lib/index.js", | ||
"typings": "lib/index.d.ts", | ||
"module": "es/index.js", | ||
"version": "5.14.0", | ||
"description": "An authorization library that supports access control models like ACL, RBAC, ABAC in Node.JS", | ||
"main": "lib/cjs/index.js", | ||
"typings": "lib/cjs/index.d.ts", | ||
"module": "lib/esm/index.js", | ||
"scripts": { | ||
"prepack": "run-s lint test build", | ||
"postpack": "run-s clean", | ||
"build": "run-s clean && run-p build:**", | ||
"build:lib:cjs": "tsc -p tsconfig.cjs.json", | ||
"build:lib:esm": "tsc -p tsconfig.esm.json", | ||
"build:dist": "rollup -c", | ||
"build": "run-s clean && run-p build:*", | ||
"build:cjs": "tsc -p tsconfig.cjs.json", | ||
"build:esm": "tsc -p tsconfig.esm.json", | ||
"test": "jest", | ||
@@ -20,7 +19,6 @@ "lint": "eslint . --ext .js,.ts", | ||
"commit": "git-cz", | ||
"clean": "rimraf lib es dist", | ||
"clean": "rimraf lib", | ||
"coverage": "jest --coverage" | ||
}, | ||
"devDependencies": { | ||
"@rollup/plugin-typescript": "^8.2.5", | ||
"@semantic-release/changelog": "^5.0.1", | ||
@@ -34,4 +32,4 @@ "@semantic-release/commit-analyzer": "^8.0.1", | ||
"@types/lodash": "^4.14.168", | ||
"@types/picomatch": "^2.2.2", | ||
"@types/node": "^10.5.3", | ||
"@types/picomatch": "^2.2.2", | ||
"@typescript-eslint/eslint-plugin": "^4.17.0", | ||
@@ -51,28 +49,18 @@ "@typescript-eslint/parser": "^4.17.0", | ||
"rimraf": "^3.0.2", | ||
"rollup": "^2.58.0", | ||
"rollup-plugin-commonjs": "^10.1.0", | ||
"rollup-plugin-node-resolve": "^5.2.0", | ||
"rollup-plugin-sourcemaps": "^0.6.3", | ||
"rollup-plugin-terser": "^7.0.2", | ||
"rollup-plugin-typescript2": "^0.30.0", | ||
"semantic-release": "^17.4.4", | ||
"ts-jest": "^26.5.3", | ||
"tslint": "^5.11.0", | ||
"typescript": "^4.3.5" | ||
"typescript": "^3.7.2" | ||
}, | ||
"peerDependencies": {}, | ||
"dependencies": { | ||
"await-lock": "^2.0.1", | ||
"buffer": "^6.0.3", | ||
"csv-parse": "^4.15.3", | ||
"expression-eval": "^4.0.0", | ||
"path-browserify": "^1.0.1", | ||
"picomatch": "^2.3.0" | ||
"picomatch": "^2.2.3" | ||
}, | ||
"files": [ | ||
"lib", | ||
"examples", | ||
"es", | ||
"dist" | ||
"examples" | ||
], | ||
"homepage": "https://casbin.org", | ||
"homepage": "http://casbin.org", | ||
"repository": { | ||
@@ -93,9 +81,3 @@ "type": "git", | ||
} | ||
}, | ||
"publishConfig": { | ||
"registry": "https://registry.npmjs.org/" | ||
}, | ||
"browser": { | ||
"path": "path-browserify" | ||
} | ||
} |
@@ -43,8 +43,2 @@ # Node-Casbin | ||
## Feature | ||
- 😎 Written in TypeScript to provide the type definitions | ||
- 🎯 Support multiple access model such as ACL, RBAC, ABAC | ||
- 🎮 Run everywhere on JavaScript platforms such as WEB, Node.js, React-Native, Electron, etc. | ||
## Installation | ||
@@ -54,6 +48,6 @@ | ||
# NPM | ||
npm install casbin@beta --save | ||
npm install casbin --save | ||
# Yarn | ||
yarn add casbin@beta | ||
yarn add casbin | ||
``` | ||
@@ -63,29 +57,11 @@ | ||
New an enforcer with a model string and a memory policy, see [Model](#official-model) section for details: | ||
New a `node-casbin` enforcer with a model file and a policy file, see [Model](#official-model) section for details: | ||
```typescript | ||
import { newEnforcer, newModel, MemoryAdapter } from 'casbin'; | ||
```node.js | ||
// For Node.js: | ||
const { newEnforcer } = require('casbin'); | ||
// For browser: | ||
// import { newEnforcer } from 'casbin'; | ||
const model = newModel(` | ||
[request_definition] | ||
r = sub, obj, act | ||
[policy_definition] | ||
p = sub, obj, act | ||
[role_definition] | ||
g = _, _ | ||
[policy_effect] | ||
e = some(where (p.eft == allow)) | ||
[matchers] | ||
m = g(r.sub, p.sub) && r.obj == p.obj && r.act == p.act | ||
`); | ||
const adapter = new MemoryAdapter(` | ||
p, alice, data1, read | ||
p, bob, data2, write | ||
p, data2_admin, data2, read | ||
p, data2_admin, data2, write | ||
g, alice, data2_admin | ||
`); | ||
const enforcer = await newEnforcer(model, adapter); | ||
const enforcer = await newEnforcer('basic_model.conf', 'basic_policy.csv'); | ||
``` | ||
@@ -97,3 +73,3 @@ | ||
```typescript | ||
```node.js | ||
const sub = 'alice'; // the user that wants to access a resource. | ||
@@ -118,3 +94,3 @@ const obj = 'data1'; // the resource that is going to be accessed. | ||
```typescript | ||
```node.js | ||
const roles = await enforcer.getRolesForUser('alice'); | ||
@@ -121,0 +97,0 @@ ``` |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
4
28
0
540793
216
12850
156
4
+ Addedcsv-parse@^4.15.3
+ Addedcsv-parse@4.16.3(transitive)
- Removedbuffer@^6.0.3
- Removedpath-browserify@^1.0.1
- Removedbase64-js@1.5.1(transitive)
- Removedbuffer@6.0.3(transitive)
- Removedieee754@1.2.1(transitive)
- Removedpath-browserify@1.0.1(transitive)
Updatedpicomatch@^2.2.3