adapter

package
v0.0.0-...-1978810 Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2020 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Adapter

type Adapter struct {
	// contains filtered or unexported fields
}

Adapter represents the adapter for policy storage

func NewAdapter

func NewAdapter(arg interface{}) (*Adapter, error)

NewAdapter creates the adapter object from a postgres url string

func NewAdapterByDB

func NewAdapterByDB(db *sql.DB, schemaName string) (*Adapter, error)

NewAdapterByDB creates a new casbin adapter with the db pointer supplied as an argument

func (*Adapter) AddPolicy

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

AddPolicy adds a rule to a user (g format: g, user, project, role)

func (*Adapter) Close

func (a *Adapter) Close() error

Close closes the db connection in the adapter

func (*Adapter) LoadPolicy

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

LoadPolicy loads data from the database and generates the access policy according to casbin requirements

func (*Adapter) RemoveFilteredPolicy

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

RemoveFilteredPolicy removes a filtered policy from database

func (*Adapter) RemovePolicy

func (a *Adapter) RemovePolicy(sec string, ptype string, policy []string) error

RemovePolicy removes a filtered policy from database

func (*Adapter) SavePolicy

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

SavePolicy saves policy to database.

Jump to

Keyboard shortcuts

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