Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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: 3 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 (over 3 years ago)
- Default Branch: master
- Last Pushed: 2024-08-19T08:07:18.000Z (3 months ago)
- Last Synced: 2024-10-29T22:37:45.417Z (14 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: 68.4 KB
- Stars: 53
- Watchers: 5
- Forks: 17
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Ent-Adapter
===
[![Go Report Card](https://goreportcard.com/badge/github.com/casbin/gorm-adapter)](https://goreportcard.com/report/github.com/casbin/ent-adapter)
[![Go](https://github.com/casbin/ent-adapter/actions/workflows/ci.yml/badge.svg)](https://github.com/casbin/ent-adapter/actions/workflows/ci.yml)
[![Coverage Status](https://coveralls.io/repos/github/casbin/ent-adapter/badge.svg?branch=master)](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 adapter(like casbin) 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.