Documentation ¶
Index ¶
- Variables
- func AllGranted(rbac *RBAC, roles []string, permission Permission, assert AssertionFunc) (r bool)
- func AnyGranted(rbac *RBAC, roles []string, permission Permission, assert AssertionFunc) (r bool)
- func BuildRBAC(roleFile, inherFile string) (*RBAC, Permissions, error)
- func InherCircle(rbac *RBAC) (err error)
- func LoadJson(filename string, v interface{}) error
- func SaveJson(filename string, v interface{}) error
- func Walk(rbac *RBAC, h WalkHandler) (err error)
- type AssertionFunc
- type Permission
- type Permissions
- type RBAC
- func (rbac *RBAC) Add(r Role) (err error)
- func (rbac *RBAC) Get(id string) (r Role, parents []string, err error)
- func (rbac *RBAC) GetParents(id string) (parents []string, err error)
- func (rbac *RBAC) IsGranted(id string, p Permission, assert AssertionFunc) (res bool)
- func (rbac *RBAC) Remove(id string) (err error)
- func (rbac *RBAC) RemoveParent(id string, parent string) error
- func (rbac *RBAC) SaveUserRBAC(newRoleFile, newInherFile string) error
- func (rbac *RBAC) SaveUserRBACWithSort(newRoleFile, newInherFile string) error
- func (rbac *RBAC) SetParent(id string, parent string) error
- func (rbac *RBAC) SetParents(id string, parents []string) error
- type Role
- type Roles
- type StdPermission
- type StdRole
- type WalkHandler
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func AllGranted ¶
func AllGranted(rbac *RBAC, roles []string, permission Permission, assert AssertionFunc) (r bool)
func AnyGranted ¶
func AnyGranted(rbac *RBAC, roles []string, permission Permission, assert AssertionFunc) (r bool)
func InherCircle ¶
func Walk ¶
func Walk(rbac *RBAC, h WalkHandler) (err error)
Types ¶
type AssertionFunc ¶
type AssertionFunc func(*RBAC, string, Permission) bool
type Permission ¶
type Permission interface { ID() string Match(Permission) bool }
func NewStdPermission ¶
func NewStdPermission(id string) Permission
type Permissions ¶
type Permissions map[string]Permission
type RBAC ¶
type RBAC struct {
// contains filtered or unexported fields
}
func (*RBAC) IsGranted ¶
func (rbac *RBAC) IsGranted(id string, p Permission, assert AssertionFunc) (res bool)
func (*RBAC) RemoveParent ¶
移除单个parent
func (*RBAC) SaveUserRBAC ¶
func (*RBAC) SaveUserRBACWithSort ¶ added in v1.0.1
type StdPermission ¶
type StdPermission struct {
IDStr string
}
func (*StdPermission) ID ¶
func (sp *StdPermission) ID() string
func (*StdPermission) Match ¶
func (sp *StdPermission) Match(p Permission) bool
type StdRole ¶
type StdRole struct { sync.RWMutex IDStr string `json:"id"` // contains filtered or unexported fields }
func NewStdRole ¶
type WalkHandler ¶
Click to show internal directories.
Click to hide internal directories.