Documentation ¶
Index ¶
- Constants
- Variables
- func ConvertAction(act *storage.Action) string
- func ConvertEntity(ent *storage.Entity) string
- func ConvertGroup(grp *storage.Group) string
- func ConvertObject(obj *storage.Entity) string
- func ConvertRole(grp *storage.Group, rol *storage.Role) string
- func ConvertRoleForObject(grp *storage.Group) string
- func ConvertRoleForSubject(grp *storage.Group, rol *storage.Role) string
- func ConvertRolesForSubject(grp *storage.Group) []string
- func ConvertSubject(sub *storage.Entity) string
- func ConvertUngroupingRole(rol *storage.Role) string
- type Backend
- type BackendCache
- type BackendCacheFactory
- type BackendFactory
- type CacheBackend
- func (cb *CacheBackend) AddObjectToGroup(grp *storage.Group, obj *storage.Entity) error
- func (cb *CacheBackend) AddRoleToEntity(ent *storage.Entity, rol *storage.Role) error
- func (cb *CacheBackend) AddRoleToGroup(grp *storage.Group, rol *storage.Role) error
- func (cb *CacheBackend) AddSubjectToGroup(grp *storage.Group, sub *storage.Entity) error
- func (cb *CacheBackend) CreateGroup(grp *storage.Group) error
- func (cb *CacheBackend) DeleteGroup(grp *storage.Group) error
- func (cb *CacheBackend) Enforce(sub, obj *storage.Entity, act *storage.Action) error
- func (cb *CacheBackend) RemoveObjectFromGroup(grp *storage.Group, obj *storage.Entity) error
- func (cb *CacheBackend) RemoveRoleFromEntity(ent *storage.Entity, rol *storage.Role) error
- func (cb *CacheBackend) RemoveRoleFromGroup(grp *storage.Group, rol *storage.Role) error
- func (cb *CacheBackend) RemoveSubjectFromGroup(grp *storage.Group, sub *storage.Entity) error
- type CacheBackendOption
- type CasbinBackend
- func (cb *CasbinBackend) AddObjectToGroup(grp *storage.Group, obj *storage.Entity) error
- func (cb *CasbinBackend) AddRoleToEntity(ent *storage.Entity, rol *storage.Role) error
- func (cb *CasbinBackend) AddRoleToGroup(grp *storage.Group, rol *storage.Role) error
- func (cb *CasbinBackend) AddSubjectToGroup(grp *storage.Group, sub *storage.Entity) error
- func (cb *CasbinBackend) CreateGroup(grp *storage.Group) error
- func (cb *CasbinBackend) DeleteGroup(grp *storage.Group) error
- func (cb *CasbinBackend) Enforce(sub, obj *storage.Entity, act *storage.Action) error
- func (cb *CasbinBackend) RemoveObjectFromGroup(grp *storage.Group, obj *storage.Entity) error
- func (cb *CasbinBackend) RemoveRoleFromEntity(ent *storage.Entity, rol *storage.Role) error
- func (cb *CasbinBackend) RemoveRoleFromGroup(grp *storage.Group, rol *storage.Role) error
- func (cb *CasbinBackend) RemoveSubjectFromGroup(grp *storage.Group, sub *storage.Entity) error
- type CasbinBackendOption
- type MongoBackendCache
- type MongoBackendCacheFactory
- type MongoBackendCacheOption
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 ConvertEntity ¶ added in v1.1.0
func ConvertGroup ¶ added in v1.1.0
func ConvertObject ¶ added in v1.1.0
func ConvertRoleForObject ¶ added in v1.1.0
func ConvertRoleForSubject ¶ added in v1.1.0
func ConvertRolesForSubject ¶ added in v1.1.0
func ConvertSubject ¶ added in v1.1.0
func ConvertUngroupingRole ¶ added in v1.1.0
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 ¶
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 CacheBackend ¶ added in v1.1.0
type CacheBackend struct {
// contains filtered or unexported fields
}
func (*CacheBackend) AddObjectToGroup ¶ added in v1.1.0
func (*CacheBackend) AddRoleToEntity ¶ added in v1.1.0
func (*CacheBackend) AddRoleToGroup ¶ added in v1.1.0
func (*CacheBackend) AddSubjectToGroup ¶ added in v1.1.0
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) RemoveObjectFromGroup ¶ added in v1.1.0
func (*CacheBackend) RemoveRoleFromEntity ¶ added in v1.1.0
func (*CacheBackend) RemoveRoleFromGroup ¶ added in v1.1.0
func (*CacheBackend) RemoveSubjectFromGroup ¶ added in v1.1.0
type CacheBackendOption ¶ added in v1.1.0
type CasbinBackend ¶
type CasbinBackend struct {
// contains filtered or unexported fields
}
func (*CasbinBackend) AddObjectToGroup ¶
func (*CasbinBackend) AddRoleToEntity ¶
func (*CasbinBackend) AddRoleToGroup ¶
func (*CasbinBackend) AddSubjectToGroup ¶
func (*CasbinBackend) CreateGroup ¶
func (cb *CasbinBackend) CreateGroup(grp *storage.Group) error
func (*CasbinBackend) DeleteGroup ¶
func (cb *CasbinBackend) DeleteGroup(grp *storage.Group) error
func (*CasbinBackend) RemoveObjectFromGroup ¶
func (*CasbinBackend) RemoveRoleFromEntity ¶
func (*CasbinBackend) RemoveRoleFromGroup ¶
func (*CasbinBackend) RemoveSubjectFromGroup ¶
type CasbinBackendOption ¶
type CasbinBackendOption struct {
EnforcerHandler int32
}
type MongoBackendCache ¶ added in v1.1.0
type MongoBackendCache struct {
// contains filtered or unexported fields
}
func (*MongoBackendCache) Remove ¶ added in v1.1.0
func (mbc *MongoBackendCache) Remove(vals ...interface{}) (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
Click to show internal directories.
Click to hide internal directories.