Comparing version 1.1.5 to 1.1.6
@@ -199,3 +199,3 @@ "use strict"; | ||
if (this.watcher) { | ||
return this.watcher.update(); | ||
return yield this.watcher.update(); | ||
} | ||
@@ -292,7 +292,7 @@ return true; | ||
this.model.model.get('r').get('r').tokens.forEach((token, j) => { | ||
parameters[token] = rvals[j].trim(); | ||
parameters[token] = rvals[j]; | ||
}); | ||
// @ts-ignore | ||
this.model.model.get('p').get('p').tokens.forEach((token, j) => { | ||
parameters[token] = pvals[j].trim(); | ||
parameters[token] = pvals[j]; | ||
}); | ||
@@ -299,0 +299,0 @@ const result = expression(Object.assign({}, parameters, functions)); |
{ | ||
"name": "casbin", | ||
"version": "1.1.5", | ||
"version": "1.1.6", | ||
"description": "An authorization library that supports access control models like ACL, RBAC, ABAC in Node.JS", | ||
@@ -5,0 +5,0 @@ "main": "lib/casbin.js", |
@@ -1,2 +0,2 @@ | ||
node-casbin | ||
node-Casbin | ||
==== | ||
@@ -17,8 +17,15 @@ [![NPM version][npm-image]][npm-url] | ||
**News**: still worry about how to write the correct node-casbin policy? ``Casbin online editor`` is coming to help! Try it at: http://casbin.org/editor/ | ||
**News**: still worry about how to write the correct node-Casbin policy? ``Casbin online editor`` is coming to help! Try it at: http://casbin.org/editor/ | ||
![casbin Logo](casbin-logo.png) | ||
node-casbin is a powerful and efficient open-source access control library for Node.JS projects. It provides support for enforcing authorization based on various [access control models](https://en.wikipedia.org/wiki/Computer_security_model). | ||
node-Casbin is a powerful and efficient open-source access control library for Node.JS projects. It provides support for enforcing authorization based on various [access control models](https://en.wikipedia.org/wiki/Computer_security_model). | ||
## All the languages supported by Casbin: | ||
[![golang](https://casbin.org/docs/assets/langs/golang.png)](https://github.com/casbin/casbin) | [![java](https://casbin.org/docs/assets/langs/java.png)](https://github.com/casbin/jcasbin) | [![nodejs](https://casbin.org/docs/assets/langs/nodejs.png)](https://github.com/casbin/node-casbin) | [![php](https://casbin.org/docs/assets/langs/php.png)](https://github.com/php-casbin/php-casbin) | ||
----|----|----|---- | ||
[Casbin](https://github.com/casbin/casbin) | [jCasbin](https://github.com/casbin/jcasbin) | [node-Casbin](https://github.com/casbin/node-casbin) | [PHP-Casbin](https://github.com/php-casbin/php-casbin) | ||
production-ready | production-ready | production-ready | production-ready | ||
## Installation | ||
@@ -32,3 +39,3 @@ | ||
1. New a node-casbin enforcer with a model file and a policy file: | ||
1. Initialize a new node-Casbin enforcer with a model file and a policy file: | ||
@@ -38,5 +45,5 @@ ```typescript | ||
``` | ||
Note: you can also initialize an enforcer with policy in DB instead of file, see [Persistence](#policy-persistence) section for details. | ||
Note: you can also initialize an enforcer with policy in DB instead of file, see [Persistence](#persistence) section for details. | ||
2. Add an enforcement hook into your code right before the access happens: | ||
@@ -56,3 +63,3 @@ | ||
3. Besides the static policy file, node-casbin also provides API for permission management at run-time. For example, You can get all the roles assigned to a user as below: | ||
3. Besides the static policy file, node-Casbin also provides API for permission management at run-time. For example, You can get all the roles assigned to a user as below: | ||
@@ -62,15 +69,7 @@ ```typescript | ||
``` | ||
See [Policy management APIs](#policy-management) for more usage. | ||
See [Policy management APIs](#policy-management) for more usage. | ||
4. Please refer to the [src/test](https://github.com/casbin/node-casbin/tree/master/test) package for more usage. | ||
## All the languages supported by node-casbin: | ||
- Golang: [Casbin](https://github.com/casbin/casbin) (production-ready) | ||
- Java: [jCasbin](https://github.com/casbin/jcasbin) (production-ready) | ||
- Node.js: [node-casbin](https://github.com/casbin/node-casbin) (production-ready) | ||
- PHP: [PHP-Casbin](https://github.com/php-casbin/php-casbin) (experimental) | ||
- C++: xCasbin (WIP) | ||
## Table of contents | ||
@@ -106,5 +105,5 @@ | ||
In node-casbin, an access control model is abstracted into a CONF file based on the **PERM metamodel (Policy, Effect, Request, Matchers)**. So switching or upgrading the authorization mechanism for a project is just as simple as modifying a configuration. You can customize your own access control model by combining the available models. For example, you can get RBAC roles and ABAC attributes together inside one model and share one set of policy rules. | ||
In node-Casbin, an access control model is abstracted into a CONF file based on the **PERM metamodel (Policy, Effect, Request, Matchers)**. So switching or upgrading the authorization mechanism for a project is just as simple as modifying a configuration. You can customize your own access control model by combining the available models. For example, you can get RBAC roles and ABAC attributes together inside one model and share one set of policy rules. | ||
The most basic and simplest model in node-casbin is ACL. ACL's model CONF is: | ||
The most basic and simplest model in node-Casbin is ACL. ACL's model CONF is: | ||
@@ -143,3 +142,3 @@ ```ini | ||
What node-casbin does: | ||
What node-Casbin does: | ||
@@ -152,6 +151,6 @@ 1. enforce the policy in the classic ``{subject, object, action}`` form or a customized form as you defined, both allow and deny authorizations are supported. | ||
What node-casbin does NOT do: | ||
What node-Casbin does NOT do: | ||
1. authentication (aka verify ``username`` and ``password`` when a user logs in) | ||
2. manage the list of users or roles. I believe it's more convenient for the project itself to manage these entities. Users usually have their passwords, and node-casbin is not designed as a password container. However, node-casbin stores the user-role mapping for the RBAC scenario. | ||
2. manage the list of users or roles. I believe it's more convenient for the project itself to manage these entities. Users usually have their passwords, and node-Casbin is not designed as a password container. However, node-Casbin stores the user-role mapping for the RBAC scenario. | ||
@@ -164,3 +163,3 @@ ## Documentation | ||
You can also use the online editor (http://casbin.org/editor/) to write your node-casbin model and policy in your web browser. It provides functionality such as ``syntax highlighting`` and ``code completion``, just like an IDE for a programming language. | ||
You can also use the online editor (http://casbin.org/editor/) to write your node-Casbin model and policy in your web browser. It provides functionality such as ``syntax highlighting`` and ``code completion``, just like an IDE for a programming language. | ||
@@ -173,5 +172,5 @@ ## Tutorials | ||
node-casbin provides two sets of APIs to manage permissions: | ||
node-Casbin provides two sets of APIs to manage permissions: | ||
- [Management API](https://github.com/casbin/node-casbin/blob/master/src/main/java/org/casbin/node-casbin/main/ManagementEnforcer.java): the primitive API that provides full support for node-casbin policy management. See [here](https://github.com/casbin/node-casbin/blob/master/src/test/java/org/casbin/node-casbin/main/ManagementAPIUnitTest.java) for examples. | ||
- [Management API](https://github.com/casbin/node-casbin/blob/master/src/main/java/org/casbin/node-casbin/main/ManagementEnforcer.java): the primitive API that provides full support for node-Casbin policy management. See [here](https://github.com/casbin/node-casbin/blob/master/src/test/java/org/casbin/node-casbin/main/ManagementAPIUnitTest.java) for examples. | ||
- [RBAC API](https://github.com/casbin/node-casbin/blob/master/src/main/java/org/casbin/node-casbin/main/Enforcer.java): a more friendly API for RBAC. This API is a subset of Management API. The RBAC users could use this API to simplify the code. See [here](https://github.com/casbin/node-casbin/blob/master/src/test/java/org/casbin/node-casbin/main/RbacAPIUnitTest.java) for examples. | ||
@@ -187,10 +186,10 @@ | ||
In node-casbin, the policy storage is implemented as an adapter (aka middleware for node-casbin). To keep light-weight, we don't put adapter code in the main library (except the default file adapter). A complete list of node-casbin adapters is provided as below. Any 3rd-party contribution on a new adapter is welcomed, please inform us and I will put it in this list:) | ||
In node-Casbin, the policy storage is implemented as an adapter (aka middleware for node-Casbin). To keep light-weight, we don't put adapter code in the main library (except the default file adapter). A complete list of node-Casbin adapters is provided as below. Any 3rd-party contribution on a new adapter is welcomed, please inform us and I will put it in this list:) | ||
Adapter | Type | Author | Description | ||
----|------|----|---- | ||
[File Adapter (built-in)](https://github.com/casbin/casbin/wiki/Policy-persistence#file-adapter) | File | node-casbin | Persistence for [.CSV (Comma-Separated Values)](https://en.wikipedia.org/wiki/Comma-separated_values) files | ||
[Sequelize Adapter](https://github.com/node-casbin/sequelize-adapter) | ORM | Casbin | MySQL, PostgreSQL, SQLite, Microsoft SQL Server are supported by [Sequelize](https://github.com/sequelize/sequelize) | ||
[Waterline Adapter](https://github.com/node-casbin/waterline-adapter) | ORM | Casbin | MySQL, MongoDB, neDB, Postgres are supported by [Waterline](https://github.com/balderdashy/waterline) | ||
[TypeORM Adapter](https://github.com/node-casbin/typeorm-adapter) | ORM | Casbin | MySQL, PostgreSQL, MariaDB, SQLite, MS SQL Server, Oracle, WebSQL, MongoDB are supported by [TypeORM](https://github.com/typeorm/typeorm) | ||
[File Adapter (built-in)](https://github.com/casbin/casbin/wiki/Policy-persistence#file-adapter) | File | node-Casbin | Persistence for [.CSV (Comma-Separated Values)](https://en.wikipedia.org/wiki/Comma-separated_values) files | ||
[Sequelize Adapter](https://github.com/node-casbin/sequelize-adapter) | ORM | node-Casbin | MySQL, PostgreSQL, SQLite, Microsoft SQL Server are supported by [Sequelize](https://github.com/sequelize/sequelize) | ||
[Waterline Adapter](https://github.com/node-casbin/waterline-adapter) | ORM | node-Casbin | MySQL, MongoDB, neDB, Postgres are supported by [Waterline](https://github.com/balderdashy/waterline) | ||
[TypeORM Adapter](https://github.com/node-casbin/typeorm-adapter) | ORM | node-Casbin | MySQL, PostgreSQL, MariaDB, SQLite, MS SQL Server, Oracle, WebSQL, MongoDB are supported by [TypeORM](https://github.com/typeorm/typeorm) | ||
@@ -201,7 +200,7 @@ For details of adapters, please refer to the documentation: https://github.com/casbin/casbin/wiki/Policy-persistence | ||
The role manager is used to manage the RBAC role hierarchy (user-role mapping) in node-casbin. A role manager can retrieve the role data from node-casbin policy rules or external sources such as LDAP, Okta, Auth0, Azure AD, etc. We support different implementations of a role manager. To keep light-weight, we don't put role manager code in the main library (except the default role manager). A complete list of node-casbin role managers is provided as below. Any 3rd-party contribution on a new role manager is welcomed, please inform us and I will put it in this list:) | ||
The role manager is used to manage the RBAC role hierarchy (user-role mapping) in node-Casbin. A role manager can retrieve the role data from node-Casbin policy rules or external sources such as LDAP, Okta, Auth0, Azure AD, etc. We support different implementations of a role manager. To keep light-weight, we don't put role manager code in the main library (except the default role manager). A complete list of node-Casbin role managers is provided as below. Any 3rd-party contribution on a new role manager is welcomed, please inform us and I will put it in this list:) | ||
Role manager | Author | Description | ||
----|----|---- | ||
[Default Role Manager (built-in)](https://github.com/casbin/node-casbin/blob/master/src/rbac/defaultRoleManager.ts) | node-casbin | Supports role hierarchy stored in node-casbin policy | ||
[Default Role Manager (built-in)](https://github.com/casbin/node-casbin/blob/master/src/rbac/defaultRoleManager.ts) | node-Casbin | Supports role hierarchy stored in node-Casbin policy | ||
@@ -232,4 +231,6 @@ For developers: all role managers must implement the [RoleManager](https://github.com/casbin/node-casbin/blob/master/src/rbac/roleManager.ts) interface. [Default Role Manager](https://github.com/casbin/node-casbin/blob/master/src/rbac/defaultRoleManager.ts) can be used as a reference implementation. | ||
- [Koa](https://github.com/koajs/koa): Expressive middleware for node.js using ES2017 async functions, via plugin: [koa-authz](https://github.com/node-casbin/koa-authz) | ||
- [Egg](https://github.com/eggjs/egg): Born to build better enterprise frameworks and apps with Node.js & Koa , via plugin: [egg-authz](https://github.com/node-casbin/egg-authz) | ||
- [Egg](https://github.com/eggjs/egg): Born to build better enterprise frameworks and apps with Node.js & Koa, via plugin: [egg-authz](https://github.com/node-casbin/egg-authz) | ||
- [Casbin JWT Express](https://github.com/tiagostutz/casbin-jwt-express): Authorization middleware that uses stateless JWT token to validate ACL rules using Casbin | ||
## License | ||
@@ -236,0 +237,0 @@ |
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
166362
233