All Projects → adityapandey9 → Rethinkdb Adapter

adityapandey9 / Rethinkdb Adapter

Licence: mit
RethinkDB adapter for Casbin https://github.com/casbin/casbin

Programming Languages

go
31211 projects - #10 most used programming language
golang
3204 projects

Projects that are alternatives of or similar to Rethinkdb Adapter

casbin-pg-adapter
A go-pg adapter for casbin
Stars: ✭ 23 (-84.46%)
Mutual labels:  adapter, casbin
Mongodb Adapter
MongoDB adapter for Casbin
Stars: ✭ 194 (+31.08%)
Mutual labels:  adapter, casbin
Redis Adapter
Redis adapter for Casbin
Stars: ✭ 167 (+12.84%)
Mutual labels:  adapter, casbin
Gorm Adapter
Gorm adapter for Casbin
Stars: ✭ 373 (+152.03%)
Mutual labels:  adapter, casbin
sequelize-adapter
Sequelize adapter for Casbin
Stars: ✭ 51 (-65.54%)
Mutual labels:  adapter, casbin
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
Xorm Adapter
Xorm adapter for Casbin
Stars: ✭ 329 (+122.3%)
Mutual labels:  adapter, casbin
Rethinkdb ecto
RethinkDB adapter for Ecto.
Stars: ✭ 112 (-24.32%)
Mutual labels:  rethinkdb, adapter
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
Spectrum
Simple, powerful online communities.
Stars: ✭ 10,315 (+6869.59%)
Mutual labels:  rethinkdb
Rethinkdb Go
Go language driver for RethinkDB
Stars: ✭ 1,582 (+968.92%)
Mutual labels:  rethinkdb
Jcasbin
An authorization library that supports access control models like ACL, RBAC, ABAC in Java
Stars: ✭ 1,335 (+802.03%)
Mutual labels:  casbin
Botframework Hubot
Hubot adapter for botframework
Stars: ✭ 91 (-38.51%)
Mutual labels:  adapter
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].