casbin

package
v0.0.0-...-b4bec84 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2022 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddGroupingPolicy

func AddGroupingPolicy(gPolicy *GroupingPolicy) (ok bool, err error)

func AddPolicy

func AddPolicy(pPolicy *Policy) (ok bool, err error)

func Enforce

func Enforce(r *RequestPolicy) (ok bool, err error)

func HasRoleInDomain

func HasRoleInDomain(userID, role, domain string) bool

func NewRBACOperator

func NewRBACOperator(conf *MysqlConf) (enforcer *casbin.SyncedEnforcer, err error)

Types

type GroupingPolicy

type GroupingPolicy struct {
	Subject string
	Role    string
	Domain  string
}

func (*GroupingPolicy) Valid

func (g *GroupingPolicy) Valid() error

type MysqlConf

type MysqlConf struct {
	DBName   string `json:"dbname" yaml:"dbname"`
	User     string `json:"user" yaml:"user"`
	Password string `json:"password" yaml:"password"`
	Host     string `json:"host" yaml:"host"`
	Port     string `json:"port" yaml:"port"`
}

type Policy

type Policy struct {
	Role   string
	Domain string
	Object string
	Action string
}

func (*Policy) Valid

func (p *Policy) Valid() error

type RequestPolicy

type RequestPolicy struct {
	Subject string
	Domain  string
	Object  string
	Action  string
}

func (*RequestPolicy) Valid

func (r *RequestPolicy) Valid() error

Jump to

Keyboard shortcuts

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