Awesome Open Source
Awesome Open Source

Ent-Adapter

Go Report Card Go Coverage Status

Ent Adapter is the ent adapter for 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

    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

License

This project is under Apache 2.0 License. See the LICENSE file for the full license text.


Get A Weekly Email With Trending Projects For These Topics
No Spam. Unsubscribe easily at any time.
Go (198,127
Orm (2,110
Authorization (1,336
Auth (884
Adapter (610
Rbac (495
Acl (436
Access Control (398
Casbin (193
Abac (119
Authz (72
Storage Driver (25
Ent (15
Related Projects