Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -199,3 +199,27 @@
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

The IP address handling implementation is derived from node-ip by Fedor Indutny.
Its original and generated forms are licensed under the MIT License below.

Copyright Fedor Indutny, 2012.

Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to permit
persons to whom the Software is furnished to do so, subject to the
following conditions:

The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
USE OR OTHER DEALINGS IN THE SOFTWARE.
56 changes: 46 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,45 @@
# Node-Casbin
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at

https://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->

# Apache Casbin (Incubating) — Node-Casbin

Apache Casbin (Incubating) is an effort undergoing incubation at the Apache Software Foundation (ASF), sponsored by the Apache Incubator PMC.

Incubation is required of all newly accepted projects until a further review indicates that the infrastructure, communications, and decision making process have stabilized in a manner consistent with other successful ASF projects.

While incubation status is not necessarily a reflection of the completeness or stability of the code, it does indicate that the project has yet to be fully endorsed by the ASF.

Earlier package publications form the legacy Casbin community release history. Their presence in a registry does not establish Apache release approval. Apache releases require project and Incubator approval of the exact source distribution.


[![GitHub Actions](https://github.com/apache/casbin-node-casbin/workflows/main/badge.svg)](https://github.com/apache/casbin-node-casbin/actions)
[![Coverage Status](https://codecov.io/gh/apache/casbin-node-casbin/branch/master/graph/badge.svg)](https://codecov.io/gh/apache/casbin-node-casbin)
[![Release](https://img.shields.io/github/release/apache/casbin-node-casbin.svg)](https://github.com/apache/casbin-node-casbin/releases/latest)
[![NPM version][npm-image]][npm-url]
[![NPM download][download-image]][download-url]
[![install size](https://packagephobia.now.sh/badge?p=casbin)](https://packagephobia.now.sh/result?p=casbin)
[![install size](https://packagephobia.now.sh/badge?p=apache-casbin)](https://packagephobia.now.sh/result?p=apache-casbin)
[![Discord](https://img.shields.io/discord/1022748306096537660?logo=discord&label=discord&color=5865F2)](https://discord.gg/S5UjpzGZjN)

[npm-image]: https://img.shields.io/npm/v/casbin.svg?style=flat-square
[npm-url]: https://npmjs.org/package/casbin
[download-image]: https://img.shields.io/npm/dm/casbin.svg?style=flat-square
[download-url]: https://npmjs.org/package/casbin
[npm-image]: https://img.shields.io/npm/v/apache-casbin.svg?style=flat-square
[npm-url]: https://npmjs.org/package/apache-casbin
[download-image]: https://img.shields.io/npm/dm/apache-casbin.svg?style=flat-square
[download-url]: https://npmjs.org/package/apache-casbin

**News**: still worry about how to write the correct `node-casbin` policy? [Casbin online editor](https://casbin.apache.org/editor) is coming to help!

Expand Down Expand Up @@ -39,10 +67,10 @@ https://casbin.apache.org/docs/overview

```shell script
# NPM
npm install casbin --save
npm install apache-casbin --save

# Yarn
yarn add casbin
yarn add apache-casbin
```

## Get started
Expand All @@ -51,9 +79,9 @@ New a `node-casbin` enforcer with a model file and a policy file, see [Model](#o

```node.js
// For Node.js:
const { newEnforcer } = require('casbin');
const { newEnforcer } = require('apache-casbin');
// For browser:
// import { newEnforcer } from 'casbin';
// import { newEnforcer } from 'apache-casbin';

const enforcer = await newEnforcer('basic_model.conf', 'basic_policy.csv');
```
Expand Down Expand Up @@ -130,3 +158,11 @@ If you have any issues or feature requests, please contact us. PR is welcomed.

- https://github.com/apache/casbin-node-casbin/issues
- https://discord.gg/S5UjpzGZjN

## Runtime requirements

The runtime dependency supports Node.js 20 or 22 and later. Build and development tools require a current Node.js 20 LTS release or later.

## Package-name migration

The next approved distribution uses `apache-casbin` in place of the historical npm package `casbin`. The API is unchanged by the name migration. After the approved package is published, update dependency declarations and imports to `apache-casbin`, regenerate your lockfile and check that adapters use the same core package instance. Existing `casbin` releases remain available; updating that old dependency does not automatically switch packages. Do not install both core identities in one application. Candidates are for review, not installation from npm.
11 changes: 7 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "casbin",
"version": "5.43.0",
"description": "An authorization library that supports access control models like ACL, RBAC, ABAC in Node.JS",
"name": "apache-casbin",
"version": "5.52.0",
"description": "Apache Casbin (Incubating): 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.mjs",
Expand Down Expand Up @@ -57,7 +57,10 @@
},
"files": [
"lib",
"examples"
"examples",
"LICENSE",
"NOTICE",
"DISCLAIMER"
],
"homepage": "https://casbin.apache.org",
"repository": {
Expand Down
Loading