Documentation ¶
Index ¶
- Constants
- Variables
- func AuthRegister(ppath string, checker AuthChecker)
- func AuthUnregister(ppath string)
- func PermBehaviorChecker(ctx echo.Context, parsed interface{}, current string) (interface{}, error)
- func PermBehaviorGenerator(ctx echo.Context) (string, error)
- func PermBehaviorIsValid(ctx echo.Context) bool
- func PermBehaviorList(ctx echo.Context) ([]interface{}, error)
- func PermBehaviorOnRender(ctx echo.Context) error
- func PermBehaviorParser(ctx echo.Context, rule string) (interface{}, error)
- func PermCommandChecker(ctx echo.Context, parsed interface{}, current string) (interface{}, error)
- func PermCommandGenerator(ctx echo.Context) (string, error)
- func PermCommandIsValid(ctx echo.Context) bool
- func PermCommandOnRender(ctx echo.Context) error
- func PermCommandParser(ctx echo.Context, rule string) (interface{}, error)
- func PermPageChecker(ctx echo.Context, parsed interface{}, current string) (interface{}, error)
- func PermPageGenerator(ctx echo.Context) (string, error)
- func PermPageOnRender(ctx echo.Context) error
- func PermPageParser(ctx echo.Context, rule string) (interface{}, error)
- type AuthChecker
- type CommonPermission
- func (r *CommonPermission) Check(ctx echo.Context, permPath string) bool
- func (r *CommonPermission) CheckBehavior(ctx echo.Context, permPath string) *perm.CheckedBehavior
- func (r *CommonPermission) CheckByType(ctx echo.Context, typ string, permPath string) interface{}
- func (r *CommonPermission) CheckCmd(ctx echo.Context, permPath string) bool
- func (r *CommonPermission) FilterNavigate(ctx echo.Context, navList *navigate.List) navigate.List
- func (r *CommonPermission) Get(ctx echo.Context, typ string) interface{}
- func (r *CommonPermission) Init(roleList []PermissionsGetter) *CommonPermission
- type PermissionConfiger
- type PermissionsGetter
- type RolePermission
- type UserRoleWithPermissions
Constants ¶
View Source
const ( RolePermissionTypePage = `page` RolePermissionTypeCommand = `command` RolePermissionTypeBehavior = `behavior` )
Variables ¶
View Source
var Behaviors = perm.NewBehaviors()
View Source
var SpecialAuths = map[string]AuthChecker{
`/server/cmdSend/*`: authServerCmdSend,
`server/dynamic`: authServerStatus,
`/server/cmd`: authCmd,
`/manager/crop`: authCrop,
}
View Source
var UserRolePermissionType = echo.NewKVData(). Add(RolePermissionTypePage, `页面权限`, echo.KVOptX( perm.NewHandle().SetTmpl(`/manager/role_edit_perm_page`).SetTmpl(`/manager/role_edit_perm_page_foot`, `foot`). SetGenerator(PermPageGenerator). SetParser(PermPageParser). SetChecker(PermPageChecker). SetItemLister(PermPageList). OnRender(PermPageOnRender), )). Add(RolePermissionTypeCommand, `指令集权限`, echo.KVOptX( perm.NewHandle().SetTmpl(`/manager/role_edit_perm_command`). SetGenerator(PermCommandGenerator). SetParser(PermCommandParser). SetChecker(PermCommandChecker). SetItemLister(PermCommandList). OnRender(PermCommandOnRender). SetIsValid(PermCommandIsValid), )). Add(RolePermissionTypeBehavior, `行为权限`, echo.KVOptX( perm.NewHandle().SetTmpl(`/manager/role_edit_perm_behavior`). SetGenerator(PermBehaviorGenerator). SetParser(PermBehaviorParser). SetChecker(PermBehaviorChecker). SetItemLister(PermBehaviorList). OnRender(PermBehaviorOnRender). SetIsValid(PermBehaviorIsValid), ))
Functions ¶
func AuthRegister ¶
func AuthRegister(ppath string, checker AuthChecker)
func AuthUnregister ¶
func AuthUnregister(ppath string)
func PermBehaviorChecker ¶
func PermBehaviorIsValid ¶
func PermBehaviorList ¶
func PermBehaviorOnRender ¶
func PermBehaviorParser ¶
func PermCommandChecker ¶
func PermCommandIsValid ¶
func PermCommandOnRender ¶
func PermPageChecker ¶
func PermPageOnRender ¶
Types ¶
type AuthChecker ¶
type CommonPermission ¶
type CommonPermission struct { DefinedType *echo.KVData Combined map[string]string // contains filtered or unexported fields }
func NewCommonPermission ¶
func NewCommonPermission(d *echo.KVData, c navigate.Checker) *CommonPermission
func (*CommonPermission) Check ¶
func (r *CommonPermission) Check(ctx echo.Context, permPath string) bool
func (*CommonPermission) CheckBehavior ¶
func (r *CommonPermission) CheckBehavior(ctx echo.Context, permPath string) *perm.CheckedBehavior
func (*CommonPermission) CheckByType ¶
func (r *CommonPermission) CheckByType(ctx echo.Context, typ string, permPath string) interface{}
func (*CommonPermission) CheckCmd ¶
func (r *CommonPermission) CheckCmd(ctx echo.Context, permPath string) bool
func (*CommonPermission) FilterNavigate ¶
FilterNavigate 过滤导航菜单,只显示有权限的菜单
func (*CommonPermission) Get ¶
func (r *CommonPermission) Get(ctx echo.Context, typ string) interface{}
func (*CommonPermission) Init ¶
func (r *CommonPermission) Init(roleList []PermissionsGetter) *CommonPermission
type PermissionConfiger ¶
type PermissionsGetter ¶
type PermissionsGetter interface {
GetPermissions() []PermissionConfiger
}
type RolePermission ¶
type RolePermission struct { *CommonPermission Roles []*UserRoleWithPermissions }
func NewRolePermission ¶
func NewRolePermission() *RolePermission
func (*RolePermission) Init ¶
func (r *RolePermission) Init(roleList []*UserRoleWithPermissions) *RolePermission
type UserRoleWithPermissions ¶
type UserRoleWithPermissions struct { *dbschema.NgingUserRole Permissions []*dbschema.NgingUserRolePermission `db:"-,relation=role_id:id"` }
func (*UserRoleWithPermissions) GetPermissions ¶
func (u *UserRoleWithPermissions) GetPermissions() []PermissionConfiger
Source Files ¶
Click to show internal directories.
Click to hide internal directories.