https://github.com/casbin/ent-adapter
Ent adapter for Casbin
https://github.com/casbin/ent-adapter
abac access-control acl adapter auth authorization authz casbin ent orm rbac storage-driver
Last synced: 28 days ago
JSON representation
Ent adapter for Casbin
- Host: GitHub
- URL: https://github.com/casbin/ent-adapter
- Owner: casbin
- License: apache-2.0
- Created: 2021-05-06T14:38:56.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2025-02-25T11:50:33.000Z (2 months ago)
- Last Synced: 2025-04-10T21:44:06.869Z (28 days ago)
- Topics: abac, access-control, acl, adapter, auth, authorization, authz, casbin, ent, orm, rbac, storage-driver
- Language: Go
- Homepage: https://github.com/casbin/casbin
- Size: 87.9 KB
- Stars: 54
- Watchers: 3
- Forks: 18
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Ent Adapter
===
[](https://goreportcard.com/report/github.com/casbin/ent-adapter)
[](https://github.com/casbin/ent-adapter/actions/workflows/ci.yml)
[](https://coveralls.io/github/casbin/ent-adapter?branch=master)Ent Adapter is the [ent](https://github.com/ent/ent) adapter for [Casbin](https://github.com/casbin/casbin). With this library, Casbin can load policy from PostgresSQL/Mysql or save policy to it.
## Installation
go get github.com/casbin/ent-adapter
## Usage
```go
a, err := NewAdapter("mysql", "root:@tcp(127.0.0.1:3306)/casbin")
//a, err := NewAdapter("postgres", "user=postgres password=postgres host=127.0.0.1 port=5432 dbname=casbin")
if err != nil {
panic(err)
}
e, err := casbin.NewEnforcer("/path/to/model",a)
```## Notification
The database used in the adapter should be created manually before NewAdapter calling.
## Getting Help
- [Casbin](https://github.com/casbin/casbin)
## License
This project is under Apache 2.0 License. See the [LICENSE](LICENSE) file for the full license text.