Protobuf Adapter Save

Google Protocol Buffers adapter for Casbin

Project README

Protobuf Adapter Build Status Coverage Status Godoc

Protobuf Adapter is the Google Protocol Buffers adapter for Casbin. With this library, Casbin can load policy from Protocol Buffers or save policy to it.


go get

Simple Example

package main

import (

func main() {
	// Initialize a Protobuf adapter and use it in a Casbin enforcer:
	b := []byte{} // b stores Casbin policy in Protocol Buffers.
	a := protobufadapter.NewProtobufAdapter(&b) // Use b as the data source. 
	e := casbin.NewEnforcer("examples/rbac_model.conf", a)
	// Load the policy from Protocol Buffers bytes b.
	// Check the permission.
	e.Enforce("alice", "data1", "read")
	// Modify the policy.
	// e.AddPolicy(...)
	// e.RemovePolicy(...)
	// Save the policy back to Protocol Buffers bytes b.

Getting Help


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

Open Source Agenda is not affiliated with "Protobuf Adapter" Project. README Source: casbin/protobuf-adapter
Open Issues
Last Commit
1 month ago

Open Source Agenda Badge

Open Source Agenda Rating