|
|
package routers
|
|
|
|
|
|
// type PermissionBase struct {
|
|
|
// Check int8 `json:"check"`
|
|
|
// }
|
|
|
//PermissionBase 路由对应的权限
|
|
|
type PermissionBase struct {
|
|
|
CodeName string //模块标识
|
|
|
ActionName string
|
|
|
MethodMap map[string]func()
|
|
|
}
|
|
|
|
|
|
func (p PermissionBase) ValidMapping(actionName string, fn func()) {
|
|
|
p.MethodMap[actionName] = fn
|
|
|
}
|
|
|
|
|
|
//职位管理相关
|
|
|
var routerPermission = map[string]PermissionBase{
|
|
|
"/v1/department/list": PermissionBase{CodeName: "OPPMG_DEPARTMENT", ActionName: "check"},
|
|
|
"/v1/department/add": PermissionBase{CodeName: "OPPMG_DEPARTMENT", ActionName: "add"},
|
|
|
"/v1/department/edit": PermissionBase{CodeName: "OPPMG_DEPARTMENT", ActionName: "edit"},
|
|
|
"/v1/department/delete": PermissionBase{CodeName: "OPPMG_DEPARTMENT", ActionName: "delete"},
|
|
|
}
|
|
|
|
|
|
//PermissionWithPosition 职位管理相关
|
|
|
type PermissionWithPosition struct {
|
|
|
Check int8 `json:"check"`
|
|
|
PermissionBase
|
|
|
}
|
|
|
|
|
|
func (c PermissionWithPosition) Code() string {
|
|
|
return "OPPMG_POSITION"
|
|
|
//GetCode 模块标识
|
|
|
func (c *PermissionWithPosition) GetCodeName() string {
|
|
|
return "OPPMG_DEPARTMENT"
|
|
|
}
|
|
|
|
|
|
//部门管理相关
|
|
|
type PermissionWithDepart struct {
|
|
|
Check int8 `json:"check"`
|
|
|
//Valid 权限校验
|
|
|
func (c PermissionWithPosition) Valid(userCompanyID int64) bool {
|
|
|
return true
|
|
|
}
|
|
|
|
|
|
//PermissionWithDepart 部门管理相关
|
|
|
// type PermissionWithDepart struct {
|
|
|
// Check int8 `json:"check"`
|
|
|
// } |
...
|
...
|
|