Documentation ¶
Index ¶
- Constants
- Variables
- func AuthRegister(ppath string, checker AuthChecker)
- func AuthUnregister(ppath string)
- func CheckPermissionByRouteName(ctx echo.Context, customer *dbschema.OfficialCustomer, ...) bool
- func CheckPermissionByRoutePath(ctx echo.Context, customer *dbschema.OfficialCustomer, ...) error
- func NavTreeCached() *perm.Map
- 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 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)
- func RegisterPublic(ppath string)
- func UnregisterPublic(ppath string)
- type AuthChecker
- type AuthCheckers
- type CustomerRoleWithPermissions
- type RolePermission
Constants ¶
View Source
const ( CustomerRolePermissionTypePage = role.RolePermissionTypePage CustomerRolePermissionTypeBehavior = role.RolePermissionTypeBehavior )
Variables ¶
View Source
var Behaviors = perm.NewBehaviors()
View Source
var CustomerRolePermissionType = echo.NewKVData(). Add(CustomerRolePermissionTypePage, `页面权限`, echo.KVOptX( perm.NewHandle().SetTmpl(`official/customer/role/edit_perm_page`).SetTmpl(`official/customer/role/edit_perm_page_foot`, `foot`). SetGenerator(PermPageGenerator). SetParser(PermPageParser). SetChecker(PermPageChecker). SetItemLister(PermPageList). OnRender(PermPageOnRender), )). Add(CustomerRolePermissionTypeBehavior, `行为权限`, echo.KVOptX( perm.NewHandle().SetTmpl(`official/customer/role/edit_perm_behavior`).SetTmpl(`official/customer/role/edit_perm_behavior_foot`, `foot`). SetGenerator(PermBehaviorGenerator). SetParser(PermBehaviorParser). SetChecker(PermBehaviorChecker). SetItemLister(PermBehaviorList). OnRender(PermBehaviorOnRender). SetIsValid(PermBehaviorIsValid), ))
View Source
var SpecialAuths = AuthCheckers{ `/user/file/crop`: func( c echo.Context, rpath string, customer *dbschema.OfficialCustomer, permission *RolePermission, ) (err error, ppath string, returning bool) { ppath = `/user/file/upload/:type` return }, }
Functions ¶
func AuthRegister ¶
func AuthRegister(ppath string, checker AuthChecker)
func AuthUnregister ¶
func AuthUnregister(ppath string)
func CheckPermissionByRouteName ¶
func CheckPermissionByRouteName(ctx echo.Context, customer *dbschema.OfficialCustomer, permission *RolePermission, name string) bool
func CheckPermissionByRoutePath ¶
func CheckPermissionByRoutePath(ctx echo.Context, customer *dbschema.OfficialCustomer, permission *RolePermission, routePath string) error
func NavTreeCached ¶
func PermBehaviorChecker ¶
func PermBehaviorIsValid ¶
func PermBehaviorList ¶
func PermBehaviorOnRender ¶
func PermBehaviorParser ¶
func PermPageChecker ¶
func PermPageOnRender ¶
func RegisterPublic ¶
func RegisterPublic(ppath string)
func UnregisterPublic ¶
func UnregisterPublic(ppath string)
Types ¶
type AuthChecker ¶
type AuthChecker func( c echo.Context, rpath string, customer *dbschema.OfficialCustomer, permission *RolePermission, ) (err error, ppath string, returning bool)
type AuthCheckers ¶
type AuthCheckers map[string]AuthChecker
func (AuthCheckers) Check ¶
func (a AuthCheckers) Check( c echo.Context, rpath string, customer *dbschema.OfficialCustomer, permission *RolePermission, ) (err error, ppath string, returning bool)
type CustomerRoleWithPermissions ¶
type CustomerRoleWithPermissions struct { *dbschema.OfficialCustomerRole Permissions []*dbschema.OfficialCustomerRolePermission `db:"-,relation=role_id:id"` }
func (*CustomerRoleWithPermissions) GetPermissions ¶
func (u *CustomerRoleWithPermissions) GetPermissions() []role.PermissionConfiger
type RolePermission ¶
type RolePermission struct { *role.CommonPermission Roles []*CustomerRoleWithPermissions }
func NewRolePermission ¶
func NewRolePermission() *RolePermission
func (*RolePermission) Init ¶
func (r *RolePermission) Init(roleList []*CustomerRoleWithPermissions) *RolePermission
Source Files ¶
Click to show internal directories.
Click to hide internal directories.