metathings_identityd2_policy

package
v1.2.15 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2022 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(ctx context.Context, sub, obj *storage.Entity, act *storage.Action) error
	CreateGroup(context.Context, *storage.Group) error
	DeleteGroup(context.Context, *storage.Group) error
	AddSubjectToGroup(context.Context, *storage.Group, *storage.Entity) error
	RemoveSubjectFromGroup(context.Context, *storage.Group, *storage.Entity) error
	AddObjectToGroup(context.Context, *storage.Group, *storage.Entity) error
	RemoveObjectFromGroup(context.Context, *storage.Group, *storage.Entity) error
	AddRoleToGroup(context.Context, *storage.Group, *storage.Role) error
	RemoveRoleFromGroup(context.Context, *storage.Group, *storage.Role) error

	AddRoleToEntity(ctx context.Context, ent *storage.Entity, rol *storage.Role) error
	RemoveRoleFromEntity(ctx context.Context, 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(ctx context.Context, grp *storage.Group, obj *storage.Entity) error

func (*CacheBackend) AddRoleToEntity added in v1.1.0

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

func (*CacheBackend) AddRoleToGroup added in v1.1.0

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

func (*CacheBackend) AddSubjectToGroup added in v1.1.0

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

func (*CacheBackend) CreateGroup added in v1.1.0

func (cb *CacheBackend) CreateGroup(ctx context.Context, grp *storage.Group) error

func (*CacheBackend) DeleteGroup added in v1.1.0

func (cb *CacheBackend) DeleteGroup(ctx context.Context, grp *storage.Group) error

func (*CacheBackend) Enforce added in v1.1.0

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

func (*CacheBackend) RemoveObjectFromGroup added in v1.1.0

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

func (*CacheBackend) RemoveRoleFromEntity added in v1.1.0

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

func (*CacheBackend) RemoveRoleFromGroup added in v1.1.0

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

func (*CacheBackend) RemoveSubjectFromGroup added in v1.1.0

func (cb *CacheBackend) RemoveSubjectFromGroup(ctx context.Context, 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(ctx context.Context, grp *storage.Group, obj *storage.Entity) error

func (*CasbinBackend) AddRoleToEntity

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

func (*CasbinBackend) AddRoleToGroup

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

func (*CasbinBackend) AddSubjectToGroup

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

func (*CasbinBackend) CreateGroup

func (cb *CasbinBackend) CreateGroup(ctx context.Context, grp *storage.Group) error

func (*CasbinBackend) DeleteGroup

func (cb *CasbinBackend) DeleteGroup(ctx context.Context, grp *storage.Group) error

func (*CasbinBackend) Enforce

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

func (*CasbinBackend) RemoveObjectFromGroup

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

func (*CasbinBackend) RemoveRoleFromEntity

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

func (*CasbinBackend) RemoveRoleFromGroup

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

func (*CasbinBackend) RemoveSubjectFromGroup

func (cb *CasbinBackend) RemoveSubjectFromGroup(ctx context.Context, 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