metathings_identityd2_policy

package
v1.1.11 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2019 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CASBIN_BACKEND_DEFAULT_ENFORCER_HANDLER = 0
	CASBIN_BACKEND_POLICY_PTYPE             = "p"
	CASBIN_BACKEND_UNGROUPING_PTYPE         = "g2"
	CASBIN_BACKEND_SUBJECT_PTYPE            = "g2"
	CASBIN_BACKEND_OBJECT_PTYPE             = "g3"
	CASBIN_BACKEND_UNGROUPING               = "ungrouping"
)

Variables

View Source
var (
	ErrInvalidArguments          = errors.New("invalid arguments")
	ErrPermissionDenied          = errors.New("permission denied")
	ErrUnauthenticated           = errors.New("unauthenticated")
	ErrInvalidBackendDriver      = errors.New("invalid backend driver")
	ErrInvalidBackendCacheDriver = errors.New("invalid backend cache driver")
	ErrNoCached                  = errors.New("no cached")
)

Functions

func ConvertAction added in v1.1.0

func ConvertAction(act *storage.Action) string

func ConvertEntity added in v1.1.0

func ConvertEntity(ent *storage.Entity) string

func ConvertGroup added in v1.1.0

func ConvertGroup(grp *storage.Group) string

func ConvertObject added in v1.1.0

func ConvertObject(obj *storage.Entity) string

func ConvertRole added in v1.1.0

func ConvertRole(grp *storage.Group, rol *storage.Role) string

func ConvertRoleForObject added in v1.1.0

func ConvertRoleForObject(grp *storage.Group) string

func ConvertRoleForSubject added in v1.1.0

func ConvertRoleForSubject(grp *storage.Group, rol *storage.Role) string

func ConvertRolesForSubject added in v1.1.0

func ConvertRolesForSubject(grp *storage.Group) []string

func ConvertSubject added in v1.1.0

func ConvertSubject(sub *storage.Entity) string

func ConvertUngroupingRole added in v1.1.0

func ConvertUngroupingRole(rol *storage.Role) string

Types

type Backend

type Backend interface {
	Enforce(sub, obj *storage.Entity, act *storage.Action) error
	CreateGroup(*storage.Group) error
	DeleteGroup(*storage.Group) error
	AddSubjectToGroup(*storage.Group, *storage.Entity) error
	RemoveSubjectFromGroup(*storage.Group, *storage.Entity) error
	AddObjectToGroup(*storage.Group, *storage.Entity) error
	RemoveObjectFromGroup(*storage.Group, *storage.Entity) error
	AddRoleToGroup(*storage.Group, *storage.Role) error
	RemoveRoleFromGroup(*storage.Group, *storage.Role) error

	AddRoleToEntity(ent *storage.Entity, rol *storage.Role) error
	RemoveRoleFromEntity(ent *storage.Entity, rol *storage.Role) error
}

func NewBackend

func NewBackend(name string, args ...interface{}) (Backend, error)

type BackendCache added in v1.1.0

type BackendCache interface {
	Get(sub, obj *storage.Entity, act *storage.Action) (ret bool, err error)
	Set(sub, obj *storage.Entity, act *storage.Action, ret bool) (err error)
	// Remove("subject", &subject) or
	// Remove("object", &object) or
	// Remove("action", &action) or
	// Remove("subject", &subject, "object", &object) etc.
	Remove(vals ...interface{}) (err error)
}

func NewBackendCache added in v1.1.0

func NewBackendCache(name string, args ...interface{}) (BackendCache, error)

type BackendCacheFactory added in v1.1.0

type BackendCacheFactory interface {
	New(...interface{}) (BackendCache, error)
}

type BackendFactory

type BackendFactory func(...interface{}) (Backend, error)

type CacheBackend added in v1.1.0

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

func (*CacheBackend) AddObjectToGroup added in v1.1.0

func (cb *CacheBackend) AddObjectToGroup(grp *storage.Group, obj *storage.Entity) error

func (*CacheBackend) AddRoleToEntity added in v1.1.0

func (cb *CacheBackend) AddRoleToEntity(ent *storage.Entity, rol *storage.Role) error

func (*CacheBackend) AddRoleToGroup added in v1.1.0

func (cb *CacheBackend) AddRoleToGroup(grp *storage.Group, rol *storage.Role) error

func (*CacheBackend) AddSubjectToGroup added in v1.1.0

func (cb *CacheBackend) AddSubjectToGroup(grp *storage.Group, sub *storage.Entity) error

func (*CacheBackend) CreateGroup added in v1.1.0

func (cb *CacheBackend) CreateGroup(grp *storage.Group) error

func (*CacheBackend) DeleteGroup added in v1.1.0

func (cb *CacheBackend) DeleteGroup(grp *storage.Group) error

func (*CacheBackend) Enforce added in v1.1.0

func (cb *CacheBackend) Enforce(sub, obj *storage.Entity, act *storage.Action) error

func (*CacheBackend) RemoveObjectFromGroup added in v1.1.0

func (cb *CacheBackend) RemoveObjectFromGroup(grp *storage.Group, obj *storage.Entity) error

func (*CacheBackend) RemoveRoleFromEntity added in v1.1.0

func (cb *CacheBackend) RemoveRoleFromEntity(ent *storage.Entity, rol *storage.Role) error

func (*CacheBackend) RemoveRoleFromGroup added in v1.1.0

func (cb *CacheBackend) RemoveRoleFromGroup(grp *storage.Group, rol *storage.Role) error

func (*CacheBackend) RemoveSubjectFromGroup added in v1.1.0

func (cb *CacheBackend) RemoveSubjectFromGroup(grp *storage.Group, sub *storage.Entity) error

type CacheBackendOption added in v1.1.0

type CacheBackendOption struct {
	Mongo struct {
		Uri        string
		Database   string
		Collection string
	}
}

type CasbinBackend

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

func (*CasbinBackend) AddObjectToGroup

func (cb *CasbinBackend) AddObjectToGroup(grp *storage.Group, obj *storage.Entity) error

func (*CasbinBackend) AddRoleToEntity

func (cb *CasbinBackend) AddRoleToEntity(ent *storage.Entity, rol *storage.Role) error

func (*CasbinBackend) AddRoleToGroup

func (cb *CasbinBackend) AddRoleToGroup(grp *storage.Group, rol *storage.Role) error

func (*CasbinBackend) AddSubjectToGroup

func (cb *CasbinBackend) AddSubjectToGroup(grp *storage.Group, sub *storage.Entity) error

func (*CasbinBackend) CreateGroup

func (cb *CasbinBackend) CreateGroup(grp *storage.Group) error

func (*CasbinBackend) DeleteGroup

func (cb *CasbinBackend) DeleteGroup(grp *storage.Group) error

func (*CasbinBackend) Enforce

func (cb *CasbinBackend) Enforce(sub, obj *storage.Entity, act *storage.Action) error

func (*CasbinBackend) RemoveObjectFromGroup

func (cb *CasbinBackend) RemoveObjectFromGroup(grp *storage.Group, obj *storage.Entity) error

func (*CasbinBackend) RemoveRoleFromEntity

func (cb *CasbinBackend) RemoveRoleFromEntity(ent *storage.Entity, rol *storage.Role) error

func (*CasbinBackend) RemoveRoleFromGroup

func (cb *CasbinBackend) RemoveRoleFromGroup(grp *storage.Group, rol *storage.Role) error

func (*CasbinBackend) RemoveSubjectFromGroup

func (cb *CasbinBackend) RemoveSubjectFromGroup(grp *storage.Group, sub *storage.Entity) error

type CasbinBackendOption

type CasbinBackendOption struct {
	EnforcerHandler int32
}

type MongoBackendCache added in v1.1.0

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

func (*MongoBackendCache) Get added in v1.1.0

func (mbc *MongoBackendCache) Get(sub, obj *storage.Entity, act *storage.Action) (ret bool, err error)

func (*MongoBackendCache) Remove added in v1.1.0

func (mbc *MongoBackendCache) Remove(vals ...interface{}) (err error)

func (*MongoBackendCache) Set added in v1.1.0

func (mbc *MongoBackendCache) Set(sub, obj *storage.Entity, act *storage.Action, ret bool) (err error)

type MongoBackendCacheFactory added in v1.1.0

type MongoBackendCacheFactory struct{}

func (*MongoBackendCacheFactory) New added in v1.1.0

func (*MongoBackendCacheFactory) New(args ...interface{}) (BackendCache, error)

type MongoBackendCacheOption added in v1.1.0

type MongoBackendCacheOption struct {
	MongoUri        string
	MongoDatabase   string
	MongoCollection string
}

Jump to

Keyboard shortcuts

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