adityapandey9 / Rethinkdb Adapter
Licence: mit
RethinkDB adapter for Casbin https://github.com/casbin/casbin
Stars: ✭ 148
Projects that are alternatives of or similar to Rethinkdb Adapter
sqlx-adapter
Asynchronous casbin adapter for mysql, postgres, sqlite based on sqlx-rs
Stars: ✭ 27 (-81.76%)
Mutual labels: adapter, casbin
Protobuf Adapter
Google Protocol Buffers adapter for Casbin
Stars: ✭ 185 (+25%)
Mutual labels: adapter, casbin
laravel-casbin
This repository has moved to https://github.com/php-casbin/laravel-authz
Stars: ✭ 42 (-71.62%)
Mutual labels: adapter, casbin
Gin Web
由gin + gorm + jwt + casbin组合实现的RBAC权限管理脚手架Golang版, 搭建完成即可快速、高效投入业务开发
Stars: ✭ 107 (-27.7%)
Mutual labels: casbin
Poweradapter
Adapter for RecyclerView(only 21KB).RecyclerView万能适配器(仅21KB)
Stars: ✭ 112 (-24.32%)
Mutual labels: adapter
Ghost Storage Adapter S3
An AWS S3 storage adapter for Ghost
Stars: ✭ 128 (-13.51%)
Mutual labels: adapter
Laravel Authz
An authorization library that supports access control models like ACL, RBAC, ABAC in Laravel.
Stars: ✭ 136 (-8.11%)
Mutual labels: casbin
Jcasbin
An authorization library that supports access control models like ACL, RBAC, ABAC in Java
Stars: ✭ 1,335 (+802.03%)
Mutual labels: casbin
Lib.reviews
A free/libre code and information platform for reviews of anything
Stars: ✭ 90 (-39.19%)
Mutual labels: rethinkdb
Recyclerviewadapter
A RecyclerView Adapter that support load more and add headerview
Stars: ✭ 141 (-4.73%)
Mutual labels: adapter
RethinkDB Adapter
RethinkDB Adapter is the Rethink DB adapter for Casbin. With this library, Casbin can load policy from RethinkDB or save policy to it.
Installation
go get github.com/adityapandey9/rethinkdb-adapter
Simple Example
package main
import (
"os"
r "gopkg.in/gorethink/gorethink.v3"
"github.com/casbin/casbin"
"github.com/adityapandey9/rethinkdb-adapter"
)
func getConnect() r.QueryExecutor {
url := os.Getenv("RETHINKDB_URL") //Get the Rethinkdb url from system env
if url == "" {
url = "localhost:28015"
}
session, _ := r.Connect(r.ConnectOpts{
Address: url,
})
return session
}
func main() {
// Initialize a RethinkDB get session, add it to adapter and use it in a Casbin enforcer:
// The adapter will use the database named "casbin".
// If it doesn't exist, the adapter will create it automatically. (default names - Database: casbin, Table: rethinkdbpolicy)
session := getConnect()
a := rethinkadapter.NewAdapter(session) // Your RethinkDB Session.
//Or you can do this
a := rethinkadapter.NewAdapterDB(session, "database_name", "table_name") // Your RethinkDB Session.
e := casbin.NewEnforcer("examples/casbinmodel.conf", a)
// Load the policy from DB.
e.LoadPolicy()
// Check the permission.
e.Enforce("alice", "data1", "read")
// Modify the policy.
// e.AddPolicy(...)
// e.RemovePolicy(...)
// Save the policy back to DB.
e.SavePolicy()
}
Getting Help
License
This project is under MIT License. See the LICENSE file for the full license text.
Note that the project description data, including the texts, logos, images, and/or trademarks,
for each open source project belongs to its rightful owner.
If you wish to add or remove any projects, please contact us at [email protected].