Documentation ¶
Index ¶
Constants ¶
View Source
const ( DefaultAdminRole = `account:admin` DefaultRole = `general` AnonymousDefaultRole = `anonymous` )
Variables ¶
View Source
var ( // CtxPermissionManagerObject reference to the permission manager CtxPermissionManagerObject = struct{ s string }{"permissionmanager"} )
View Source
var ( // ErrUndefinedRole if not found ErrUndefinedRole = errors.New(`undefined role`) )
Functions ¶
Types ¶
type DBRoleLoader ¶
type DBRoleLoader struct {
// contains filtered or unexported fields
}
DBRoleLoader provides roles from database
type ExtData ¶
type ExtData struct { ID uint64 `json:"id"` Title string `json:"title"` AccessLevel int `json:"access_level"` }
ExtData permission data
type Manager ¶
Manager provides methods to control and cache permissions
func FromContext ¶
FromContext permission manager object
func NewManager ¶
NewManager object to control roles
func NewTestManager ¶
NewTestManager with all permissions
func (*Manager) AsOneRole ¶
func (mng *Manager) AsOneRole(ctx context.Context, isAdmin bool, filter func(context.Context, rbac.Role) bool, id ...uint64) (rbac.Role, error)
AsOneRole returns new role object from one or more IDs
func (*Manager) DefaultRole ¶
DefaultRole returns default role
Click to show internal directories.
Click to hide internal directories.