string_adapter

package module
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 28, 2023 License: MIT Imports: 6 Imported by: 0

README

string-adapter

license

String Adapter is the String adapter for Casbin.

With this library:

  • Casbin can load policy from string or save policy to it.
  • Build a mock casbin object used to unit test.

Installation

go get github.com/always-farmer/string-adapter

Simple Example

Refer to example

License

string-adapter is licensed under the MIT license.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Adapter

type Adapter struct {
	persist.BatchAdapter
	// contains filtered or unexported fields
}

func NewAdapter

func NewAdapter(policy *string) *Adapter

func (*Adapter) AddPolicies

func (sa *Adapter) AddPolicies(sec string, ptype string, rules [][]string) error

func (*Adapter) AddPolicy

func (sa *Adapter) AddPolicy(sec string, ptype string, rule []string) error

func (*Adapter) LoadPolicy

func (sa *Adapter) LoadPolicy(model model.Model) error

func (*Adapter) RemoveFilteredPolicy

func (sa *Adapter) RemoveFilteredPolicy(sec string, ptype string, fieldIndex int, fieldValues ...string) error

func (*Adapter) RemovePolicies

func (sa *Adapter) RemovePolicies(sec string, ptype string, rules [][]string) error

func (*Adapter) RemovePolicy

func (sa *Adapter) RemovePolicy(sec string, ptype string, rule []string) error

func (*Adapter) SavePolicy

func (sa *Adapter) SavePolicy(model model.Model) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL