Comparing version 5.13.1 to 5.14.0-beta.1
@@ -0,1 +1,20 @@ | ||
# [5.14.0-beta.1](https://github.com/casbin/node-casbin/compare/v5.13.1...v5.14.0-beta.1) (2022-02-27) | ||
### Bug Fixes | ||
* 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)) | ||
### 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)) | ||
## [5.13.1](https://github.com/casbin/node-casbin/compare/v5.13.0...v5.13.1) (2022-02-22) | ||
@@ -2,0 +21,0 @@ |
{ | ||
"name": "casbin", | ||
"version": "5.13.1", | ||
"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", | ||
"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", | ||
"scripts": { | ||
"prepack": "run-s lint test build", | ||
"postpack": "run-s clean", | ||
"build": "run-s clean && run-p build:*", | ||
"build:cjs": "tsc -p tsconfig.cjs.json", | ||
"build:esm": "tsc -p tsconfig.esm.json", | ||
"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", | ||
"test": "jest", | ||
@@ -19,6 +20,7 @@ "lint": "eslint . --ext .js,.ts", | ||
"commit": "git-cz", | ||
"clean": "rimraf lib", | ||
"clean": "rimraf lib es dist", | ||
"coverage": "jest --coverage" | ||
}, | ||
"devDependencies": { | ||
"@rollup/plugin-typescript": "^8.2.5", | ||
"@semantic-release/changelog": "^5.0.1", | ||
@@ -32,4 +34,4 @@ "@semantic-release/commit-analyzer": "^8.0.1", | ||
"@types/lodash": "^4.14.168", | ||
"@types/node": "^10.5.3", | ||
"@types/picomatch": "^2.2.2", | ||
"@types/node": "^10.5.3", | ||
"@typescript-eslint/eslint-plugin": "^4.17.0", | ||
@@ -49,18 +51,28 @@ "@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": "^3.7.2" | ||
"typescript": "^4.3.5" | ||
}, | ||
"peerDependencies": {}, | ||
"dependencies": { | ||
"await-lock": "^2.0.1", | ||
"csv-parse": "^4.15.3", | ||
"buffer": "^6.0.3", | ||
"expression-eval": "^4.0.0", | ||
"picomatch": "^2.2.3" | ||
"path-browserify": "^1.0.1", | ||
"picomatch": "^2.3.0" | ||
}, | ||
"files": [ | ||
"lib", | ||
"examples" | ||
"examples", | ||
"es", | ||
"dist" | ||
], | ||
"homepage": "http://casbin.org", | ||
"homepage": "https://casbin.org", | ||
"repository": { | ||
@@ -81,3 +93,9 @@ "type": "git", | ||
} | ||
}, | ||
"publishConfig": { | ||
"registry": "https://registry.npmjs.org/" | ||
}, | ||
"browser": { | ||
"path": "path-browserify" | ||
} | ||
} |
@@ -43,2 +43,8 @@ # 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 | ||
@@ -48,6 +54,6 @@ | ||
# NPM | ||
npm install casbin --save | ||
npm install casbin@beta --save | ||
# Yarn | ||
yarn add casbin | ||
yarn add casbin@beta | ||
``` | ||
@@ -57,11 +63,29 @@ | ||
New a `node-casbin` enforcer with a model file and a policy file, see [Model](#official-model) section for details: | ||
New an enforcer with a model string and a memory policy, see [Model](#official-model) section for details: | ||
```node.js | ||
// For Node.js: | ||
const { newEnforcer } = require('casbin'); | ||
// For browser: | ||
// import { newEnforcer } from 'casbin'; | ||
```typescript | ||
import { newEnforcer, newModel, MemoryAdapter } from 'casbin'; | ||
const enforcer = await newEnforcer('basic_model.conf', 'basic_policy.csv'); | ||
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); | ||
``` | ||
@@ -73,3 +97,3 @@ | ||
```node.js | ||
```typescript | ||
const sub = 'alice'; // the user that wants to access a resource. | ||
@@ -94,3 +118,3 @@ const obj = 'data1'; // the resource that is going to be accessed. | ||
```node.js | ||
```typescript | ||
const roles = await enforcer.getRolesForUser('alice'); | ||
@@ -97,0 +121,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
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
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
1909581
217
13746
180
0
5
35
2
1
+ Addedbuffer@^6.0.3
+ Addedpath-browserify@^1.0.1
+ Addedbase64-js@1.5.1(transitive)
+ Addedbuffer@6.0.3(transitive)
+ Addedieee754@1.2.1(transitive)
+ Addedpath-browserify@1.0.1(transitive)
- Removedcsv-parse@^4.15.3
- Removedcsv-parse@4.16.3(transitive)
Updatedpicomatch@^2.3.0