Documentation
¶
Index ¶
- Variables
- func Bind(ctx context.Context, param BindParam) (err error)
- func Enforcer() permissions.Enforcer
- func New(store Store) services.Service
- func Remove(ctx context.Context, id string, cascade bool) (err error)
- func Save(ctx context.Context, role Role) (err error)
- func Unbind(ctx context.Context, param UnbindParam) (err error)
- type BindParam
- type CacheConfig
- type CacheParam
- type Config
- type Policy
- type Role
- type Roles
- func (roles Roles) Add(role Role) (v Roles)
- func (roles Roles) CheckPolicy(object string, action string) (ok bool)
- func (roles Roles) Get(id string) (role Role, has bool)
- func (roles Roles) Len() int
- func (roles Roles) Less(i, j int) bool
- func (roles Roles) Remove(role Role) (v Roles)
- func (roles Roles) Swap(i, j int)
- type Store
- type UnbindParam
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrRoleNofFound = errors.Warning("rbac: role was not found") ErrCantRemoveHasChildrenRow = errors.Warning("rbac: can not remove role which has children") )
Functions ¶
func Enforcer ¶
func Enforcer() permissions.Enforcer
Types ¶
type BindParam ¶
type BindParam struct { Account authorizations.Id `json:"account" avro:"account"` Roles Roles `json:"roles" avro:"roles"` }
type CacheConfig ¶ added in v1.2.50
type CacheParam ¶ added in v1.2.50
type CacheParam struct {
Account authorizations.Id
}
type Config ¶ added in v1.2.50
type Config struct {
Cache CacheConfig `json:"cache"`
}
type Role ¶
type Role struct { Id string `json:"id" tree:"ParentId+Children" avro:"id"` Name string `json:"name" avro:"name"` Description string `json:"description" avro:"description"` ParentId string `json:"parentId" avro:"parentId"` Children Roles `json:"children" avro:"children"` Policies []Policy `json:"policies" avro:"policies"` }
type Store ¶
type Store interface { services.Component Role(ctx context.Context, id string) (role Role, has bool, err error) Roles(ctx context.Context) (roles Roles, err error) SaveRole(ctx context.Context, role Role) (err error) RemoveRole(ctx context.Context, role Role) (err error) Bind(ctx context.Context, account authorizations.Id, roles []Role) (err error) Unbind(ctx context.Context, account authorizations.Id, roles []Role) (err error) Bounds(ctx context.Context, account authorizations.Id) (roles Roles, err error) }
type UnbindParam ¶ added in v1.2.1
type UnbindParam struct { Account authorizations.Id `json:"account" avro:"account"` Roles Roles `json:"roles" avro:"roles"` }
Source Files
¶
Click to show internal directories.
Click to hide internal directories.