MongoDB Adapter
MongoDB Adapter is the Mongo DB adapter for Casbin. With this library, Casbin can load policy from MongoDB or save policy to it.
Installation
go get github.com/casbin/mongodb-adapter
Simple Example
package main
import (
"github.com/casbin/casbin"
"github.com/casbin/mongodb-adapter"
)
func main() {
a := mongodbadapter.NewAdapter("127.0.0.1:27017")
e := casbin.NewEnforcer("examples/rbac_model.conf", a)
e.LoadPolicy()
e.Enforce("alice", "data1", "read")
e.SavePolicy()
}
Getting Help
License
This project is under Apache 2.0 License. See the LICENSE file for the full license text.