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(ctx context.Context, grp *storage.Group, obj *storage.Entity) error
- func (cb *CacheBackend) AddRoleToEntity(ctx context.Context, ent *storage.Entity, rol *storage.Role) error
- func (cb *CacheBackend) AddRoleToGroup(ctx context.Context, grp *storage.Group, rol *storage.Role) error
- func (cb *CacheBackend) AddSubjectToGroup(ctx context.Context, grp *storage.Group, sub *storage.Entity) error
- func (cb *CacheBackend) CreateGroup(ctx context.Context, grp *storage.Group) error
- func (cb *CacheBackend) DeleteGroup(ctx context.Context, grp *storage.Group) error
- func (cb *CacheBackend) Enforce(ctx context.Context, sub, obj *storage.Entity, act *storage.Action) error
- func (cb *CacheBackend) RemoveObjectFromGroup(ctx context.Context, grp *storage.Group, obj *storage.Entity) error
- func (cb *CacheBackend) RemoveRoleFromEntity(ctx context.Context, ent *storage.Entity, rol *storage.Role) error
- func (cb *CacheBackend) RemoveRoleFromGroup(ctx context.Context, grp *storage.Group, rol *storage.Role) error
- func (cb *CacheBackend) RemoveSubjectFromGroup(ctx context.Context, grp *storage.Group, sub *storage.Entity) error
- type CacheBackendOption
- type CasbinBackend
- func (cb *CasbinBackend) AddObjectToGroup(ctx context.Context, grp *storage.Group, obj *storage.Entity) error
- func (cb *CasbinBackend) AddRoleToEntity(ctx context.Context, ent *storage.Entity, rol *storage.Role) error
- func (cb *CasbinBackend) AddRoleToGroup(ctx context.Context, grp *storage.Group, rol *storage.Role) error
- func (cb *CasbinBackend) AddSubjectToGroup(ctx context.Context, grp *storage.Group, sub *storage.Entity) error
- func (cb *CasbinBackend) CreateGroup(ctx context.Context, grp *storage.Group) error
- func (cb *CasbinBackend) DeleteGroup(ctx context.Context, grp *storage.Group) error
- func (cb *CasbinBackend) Enforce(ctx context.Context, sub, obj *storage.Entity, act *storage.Action) error
- func (cb *CasbinBackend) RemoveObjectFromGroup(ctx context.Context, grp *storage.Group, obj *storage.Entity) error
- func (cb *CasbinBackend) RemoveRoleFromEntity(ctx context.Context, ent *storage.Entity, rol *storage.Role) error
- func (cb *CasbinBackend) RemoveRoleFromGroup(ctx context.Context, grp *storage.Group, rol *storage.Role) error
- func (cb *CasbinBackend) RemoveSubjectFromGroup(ctx context.Context, 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(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 ¶
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 (*CacheBackend) DeleteGroup ¶ added in v1.1.0
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 (*CasbinBackend) DeleteGroup ¶
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.