Documentation ¶
Overview ¶
Package sdcasbin Casbin 扩展
Index ¶
- Variables
- type Grant
- type Object
- type ObjectSet
- type Rbac
- type RbacEnforcerBuilder
- func (b *RbacEnforcerBuilder) AddObjectIds(objIds []string, availableActions []string) *RbacEnforcerBuilder
- func (b *RbacEnforcerBuilder) AddObjectRoleLink(objId string, roleOrUserIds []string, actions []string) error
- func (b *RbacEnforcerBuilder) AddObjects(objs ...Object) *RbacEnforcerBuilder
- func (b *RbacEnforcerBuilder) AddRoleIds(roleIds ...string) *RbacEnforcerBuilder
- func (b *RbacEnforcerBuilder) AddRoleRoleLink(childRoleId string, parentRoleIds []string) error
- func (b *RbacEnforcerBuilder) AddUserIds(uids ...string) *RbacEnforcerBuilder
- func (b *RbacEnforcerBuilder) AddUserRoleLink(userIds []string, roleIds []string) error
- func (b *RbacEnforcerBuilder) Build() (*casbin.Enforcer, error)
- func (b *RbacEnforcerBuilder) Clear() *RbacEnforcerBuilder
- func (b *RbacEnforcerBuilder) GeneratePolicies() string
- type RbacEnforcerBuilderOptions
- type RbacLoader
- type RbacLoaderFactory
- type RbacLoaderFactoryFunc
- type RbacLoaderFunc
- type RbacPlan
- type ReloadableRbac
- type StaticRbac
- type User
Constants ¶
This section is empty.
Variables ¶
Functions ¶
This section is empty.
Types ¶
type RbacEnforcerBuilder ¶
type RbacEnforcerBuilder struct {
// contains filtered or unexported fields
}
func NewRbacEnforcerBuilder ¶
func NewRbacEnforcerBuilder(opts *RbacEnforcerBuilderOptions) *RbacEnforcerBuilder
func (*RbacEnforcerBuilder) AddObjectIds ¶
func (b *RbacEnforcerBuilder) AddObjectIds(objIds []string, availableActions []string) *RbacEnforcerBuilder
func (*RbacEnforcerBuilder) AddObjectRoleLink ¶
func (b *RbacEnforcerBuilder) AddObjectRoleLink(objId string, roleOrUserIds []string, actions []string) error
func (*RbacEnforcerBuilder) AddObjects ¶
func (b *RbacEnforcerBuilder) AddObjects(objs ...Object) *RbacEnforcerBuilder
func (*RbacEnforcerBuilder) AddRoleIds ¶
func (b *RbacEnforcerBuilder) AddRoleIds(roleIds ...string) *RbacEnforcerBuilder
func (*RbacEnforcerBuilder) AddRoleRoleLink ¶
func (b *RbacEnforcerBuilder) AddRoleRoleLink(childRoleId string, parentRoleIds []string) error
func (*RbacEnforcerBuilder) AddUserIds ¶
func (b *RbacEnforcerBuilder) AddUserIds(uids ...string) *RbacEnforcerBuilder
func (*RbacEnforcerBuilder) AddUserRoleLink ¶
func (b *RbacEnforcerBuilder) AddUserRoleLink(userIds []string, roleIds []string) error
func (*RbacEnforcerBuilder) Build ¶
func (b *RbacEnforcerBuilder) Build() (*casbin.Enforcer, error)
func (*RbacEnforcerBuilder) Clear ¶
func (b *RbacEnforcerBuilder) Clear() *RbacEnforcerBuilder
func (*RbacEnforcerBuilder) GeneratePolicies ¶
func (b *RbacEnforcerBuilder) GeneratePolicies() string
type RbacLoader ¶
type RbacLoader interface { Prepare(b *RbacEnforcerBuilder) Load(b *RbacEnforcerBuilder) }
type RbacLoaderFactory ¶
type RbacLoaderFactory interface {
NewRbacLoader() RbacLoader
}
func RbacLoaderAsFactory ¶
func RbacLoaderAsFactory(f func(b *RbacEnforcerBuilder)) RbacLoaderFactory
type RbacLoaderFactoryFunc ¶
type RbacLoaderFactoryFunc func() RbacLoader
func (RbacLoaderFactoryFunc) NewRbacLoader ¶
func (f RbacLoaderFactoryFunc) NewRbacLoader() RbacLoader
type RbacLoaderFunc ¶
type RbacLoaderFunc func(b *RbacEnforcerBuilder)
func (RbacLoaderFunc) Load ¶
func (f RbacLoaderFunc) Load(b *RbacEnforcerBuilder)
func (RbacLoaderFunc) Prepare ¶
func (f RbacLoaderFunc) Prepare(b *RbacEnforcerBuilder)
type RbacPlan ¶
type RbacPlan struct { SuperRole string DisableCheck bool Users []User Objects1 []Object Objects2 []Object Objects3 []Object Grants1 []Grant Grants2 []Grant Grants3 []Grant }
func (RbacPlan) Apply ¶
func (plan RbacPlan) Apply(b *RbacEnforcerBuilder) error
func (RbacPlan) Load ¶
func (plan RbacPlan) Load(b *RbacEnforcerBuilder)
func (RbacPlan) MustToRbac ¶
func (RbacPlan) Prepare ¶
func (plan RbacPlan) Prepare(b *RbacEnforcerBuilder)
type ReloadableRbac ¶
type ReloadableRbac struct {
// contains filtered or unexported fields
}
func NewReloadableRbac ¶
func NewReloadableRbac( loaders []RbacLoader, loaderFactories []RbacLoaderFactory, enforcerBuilderOpts *RbacEnforcerBuilderOptions, ) *ReloadableRbac
func (*ReloadableRbac) IsGranted ¶
func (rbac *ReloadableRbac) IsGranted(userOrRoleId, objId, action string) bool
func (*ReloadableRbac) Policies ¶
func (rbac *ReloadableRbac) Policies() string
func (*ReloadableRbac) Reload ¶
func (rbac *ReloadableRbac) Reload() error
type StaticRbac ¶
type StaticRbac struct {
// contains filtered or unexported fields
}
func NewStaticRbac ¶
func NewStaticRbac(loaders []RbacLoader, enforcerBuilderOpts *RbacEnforcerBuilderOptions) (*StaticRbac, error)
func NewStaticRbacWithFunc ¶
func NewStaticRbacWithFunc(f func(b *RbacEnforcerBuilder), enforcerBuilderOpts *RbacEnforcerBuilderOptions) (*StaticRbac, error)
func (*StaticRbac) IsGranted ¶
func (rbac *StaticRbac) IsGranted(userOrRoleId, objId, action string) bool
Click to show internal directories.
Click to hide internal directories.