Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

casbin

Package Overview
Dependencies
Maintainers
3
Versions
135
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

casbin - npm Package Compare versions

Comparing version 2.0.0 to 2.0.1

6

lib/enforcer.d.ts

@@ -76,5 +76,6 @@ import { ManagementEnforcer } from './managementEnforcer';

* @param user the user.
* @param domain the domain.
* @return succeeds or not.
*/
deleteRolesForUser(user: string): Promise<boolean>;
deleteRolesForUser(user: string, domain?: string): Promise<boolean>;
/**

@@ -92,4 +93,5 @@ * deleteUser deletes a user.

* @param role the role.
* @return succeeds or not.
*/
deleteRole(role: string): Promise<void>;
deleteRole(role: string): Promise<boolean>;
/**

@@ -96,0 +98,0 @@ * deletePermission deletes a permission.

@@ -171,7 +171,13 @@ "use strict";

* @param user the user.
* @param domain the domain.
* @return succeeds or not.
*/
deleteRolesForUser(user) {
deleteRolesForUser(user, domain) {
return __awaiter(this, void 0, void 0, function* () {
return yield this.removeFilteredGroupingPolicy(0, user);
if (domain == null) {
return yield this.removeFilteredGroupingPolicy(0, user);
}
else {
return yield this.removeFilteredGroupingPolicy(0, user, '', domain);
}
});

@@ -195,7 +201,9 @@ }

* @param role the role.
* @return succeeds or not.
*/
deleteRole(role) {
return __awaiter(this, void 0, void 0, function* () {
yield this.removeFilteredGroupingPolicy(1, role);
yield this.removeFilteredPolicy(0, role);
const res1 = yield this.removeFilteredGroupingPolicy(1, role);
const res2 = yield this.removeFilteredPolicy(0, role);
return res1 || res2;
});

@@ -202,0 +210,0 @@ }

@@ -28,6 +28,8 @@ "use strict";

loadPolicy(model) {
const _super = name => super[name];
const _super = Object.create(null, {
loadPolicy: { get: () => super.loadPolicy }
});
return __awaiter(this, void 0, void 0, function* () {
this.filtered = false;
yield _super("loadPolicy").call(this, model);
yield _super.loadPolicy.call(this, model);
});

@@ -65,3 +67,5 @@ }

savePolicy(model) {
const _super = name => super[name];
const _super = Object.create(null, {
savePolicy: { get: () => super.savePolicy }
});
return __awaiter(this, void 0, void 0, function* () {

@@ -71,3 +75,3 @@ if (this.filtered) {

}
yield _super("savePolicy").call(this, model);
yield _super.savePolicy.call(this, model);
return true;

@@ -74,0 +78,0 @@ });

@@ -48,5 +48,5 @@ "use strict";

}
key2 = '^' + key2.replace(regexp, '$1[^/]+$2') + '$';
key2 = key2.replace(regexp, '$1[^/]+$2');
}
return regexMatch(key1, key2);
return regexMatch(key1, '^' + key2 + '$');
}

@@ -53,0 +53,0 @@ // keyMatch2Func is the wrapper for keyMatch2.

{
"name": "casbin",
"version": "2.0.0",
"version": "2.0.1",
"description": "An authorization library that supports access control models like ACL, RBAC, ABAC in Node.JS",

@@ -27,3 +27,3 @@ "main": "lib/index.js",

"tslint": "^5.11.0",
"typescript": "^2.9.2"
"typescript": "^3.3.3"
},

@@ -30,0 +30,0 @@ "dependencies": {

@@ -25,3 +25,3 @@ node-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)
[![golang](https://casbin.org/img/langs/golang.png)](https://github.com/casbin/casbin) | [![java](https://casbin.org/img/langs/java.png)](https://github.com/casbin/jcasbin) | [![nodejs](https://casbin.org/img/langs/nodejs.png)](https://github.com/casbin/node-casbin) | [![php](https://casbin.org/img/langs/php.png)](https://github.com/php-casbin/php-casbin)
----|----|----|----

@@ -31,2 +31,7 @@ [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)

[![python](https://casbin.org/img/langs/python.png)](https://github.com/casbin/pycasbin) | [![delphi](https://casbin.org/img/langs/delphi.png)](https://github.com/casbin4d/Casbin4D) | [![dotnet](https://casbin.org/img/langs/dotnet.png)](https://github.com/Devolutions/casbin-net) | [![rust](https://casbin.org/img/langs/rust.png)](https://github.com/Devolutions/casbin-rs)
----|----|----|----
[PyCasbin](https://github.com/casbin/pycasbin) | [Casbin4D](https://github.com/casbin4d/Casbin4D) | [Casbin-Net](https://github.com/Devolutions/casbin-net) | [Casbin-RS](https://github.com/Devolutions/casbin-rs)
production-ready | experimental | WIP | WIP
## Installation

@@ -168,4 +173,4 @@

- [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.
- [Management API](https://github.com/casbin/node-casbin/blob/master/src/managementEnforcer.ts): 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/enforcer.ts): 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.

@@ -184,7 +189,7 @@ We also provide a web-based UI for model management and policy management:

----|------|----|----
[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)
[Mongoose Adapter](https://github.com/szy0syz/casbin-mongoose-adapter) | ORM | [@szy0syz](https://github.com/szy0syz) | MongoDB is supported by [Mongoose](https://mongoosejs.com/)
[File Adapter (built-in)](https://github.com/casbin/casbin/wiki/Policy-persistence#file-adapter) | File | 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)
[Mongoose Adapter](https://github.com/elasticio/casbin-mongoose-adapter) | ORM | [elastic.io](https://github.com/elasticio) | MongoDB is supported by [Mongoose](https://mongoosejs.com/)

@@ -199,3 +204,3 @@ For details of adapters, please refer to the documentation: https://github.com/casbin/casbin/wiki/Policy-persistence

----|----|----
[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) | Casbin | Supports role hierarchy stored in node-Casbin policy

@@ -202,0 +207,0 @@ 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.

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc