作者 tangxvhui

提交

... ... @@ -39,57 +39,57 @@ type PermissionBase struct {
}
var RouterPermission = map[string]PermissionBase{
"/v1/department/list": PermissionBase{CodeName: M_ENTERPRISE_ORGANIZATION, ActionName: "default"},
"/v1/department/add": PermissionBase{CodeName: M_ENTERPRISE_ORGANIZATION, ActionName: "default"},
"/v1/department/edit": PermissionBase{CodeName: M_ENTERPRISE_ORGANIZATION, ActionName: "default"},
"/v1/department/delete": PermissionBase{CodeName: M_ENTERPRISE_ORGANIZATION, ActionName: "default"},
"/v1/company/current/edit": PermissionBase{CodeName: M_ENTERPRISE_PROFILE, ActionName: "default"},
"/v1/company/current/info": PermissionBase{CodeName: M_ENTERPRISE_PROFILE, ActionName: "default"},
"/v1/position/list": PermissionBase{CodeName: M_ENTERPRISE_EMPLOYEE_POST, ActionName: "default"},
"/v1/position/add": PermissionBase{CodeName: M_ENTERPRISE_EMPLOYEE_POST, ActionName: "default"},
"/v1/position/edit": PermissionBase{CodeName: M_ENTERPRISE_EMPLOYEE_POST, ActionName: "default"},
"/v1/position/delete": PermissionBase{CodeName: M_ENTERPRISE_EMPLOYEE_POST, ActionName: "default"},
"/v1/rbac/role/list": PermissionBase{CodeName: M_ENTERPRISE_EMPLOYEE_ROLE, ActionName: "default"},
"/v1/rbac/role/add": PermissionBase{CodeName: M_ENTERPRISE_EMPLOYEE_ROLE, ActionName: "default"},
"/v1/rbac/role/edit": PermissionBase{CodeName: M_ENTERPRISE_EMPLOYEE_ROLE, ActionName: "default"},
"/v1/rbac/role/delete": PermissionBase{CodeName: M_ENTERPRISE_EMPLOYEE_ROLE, ActionName: "default"},
"/v1/rbac/role_group/add": PermissionBase{CodeName: M_ENTERPRISE_EMPLOYEE_ROLE, ActionName: "default"},
"/v1/rbac/role_group/edit": PermissionBase{CodeName: M_ENTERPRISE_EMPLOYEE_ROLE, ActionName: "default"},
"/v1/rbac/role_group/delete": PermissionBase{CodeName: M_ENTERPRISE_EMPLOYEE_ROLE, ActionName: "default"},
"/v1/rbac/role/menu": PermissionBase{CodeName: M_ENTERPRISE_EMPLOYEE_ROLE, ActionName: "default"},
"/v1/rbac/menu/list": PermissionBase{CodeName: M_ENTERPRISE_EMPLOYEE_ROLE, ActionName: "default"},
"/v1/rbac/role/menu/edit": PermissionBase{CodeName: M_ENTERPRISE_EMPLOYEE_ROLE, ActionName: "default"},
"/v1/rbac/menu/opportunity": PermissionBase{CodeName: M_ENTERPRISE_EMPLOYEE_ROLE, ActionName: "default"},
"/v1/rbac/menu/opportunity/edit": PermissionBase{CodeName: M_ENTERPRISE_EMPLOYEE_ROLE, ActionName: "default"},
"/v1/user/list": PermissionBase{CodeName: M_ENTERPRISE_EMPLOYEE, ActionName: "default"},
"/v1/user/add": PermissionBase{CodeName: M_ENTERPRISE_EMPLOYEE, ActionName: "default"},
"/v1/user/edit": PermissionBase{CodeName: M_ENTERPRISE_EMPLOYEE, ActionName: "default"},
"/v1/user/delete": PermissionBase{CodeName: M_ENTERPRISE_EMPLOYEE, ActionName: "default"},
"/v1/user/allow_forbid": PermissionBase{CodeName: M_ENTERPRISE_EMPLOYEE, ActionName: "default"},
"/v1/user/info": PermissionBase{CodeName: M_ENTERPRISE_EMPLOYEE, ActionName: "default"},
"/v1/bulletin/add": PermissionBase{CodeName: M_SYSTEM_ANNOUNCEMENT, ActionName: "default"},
"/v1/bulletin/list": PermissionBase{CodeName: M_SYSTEM_ANNOUNCEMENT, ActionName: "default"},
"/v1/bulletin/get": PermissionBase{CodeName: M_SYSTEM_ANNOUNCEMENT, ActionName: "default"},
"/v1/bulletin/update": PermissionBase{CodeName: M_SYSTEM_ANNOUNCEMENT, ActionName: "default"},
"/v1/bulletin/operate": PermissionBase{CodeName: M_SYSTEM_ANNOUNCEMENT, ActionName: "default"},
"/v1/bulletin/feedbacks": PermissionBase{CodeName: M_SYSTEM_ANNOUNCEMENT, ActionName: "default"},
"/v1/bulletin/exportFeedBacks": PermissionBase{CodeName: M_SYSTEM_ANNOUNCEMENT, ActionName: "default"},
"/v1/template/add": PermissionBase{CodeName: M_SYSTEM_OPPORTUNITY_TEMPLATE, ActionName: "default"},
"/v1/template/sortCategory": PermissionBase{CodeName: M_SYSTEM_OPPORTUNITY_TEMPLATE, ActionName: "default"},
"/v1/template/list": PermissionBase{CodeName: M_SYSTEM_OPPORTUNITY_TEMPLATE, ActionName: "default"},
"/v1/template/get": PermissionBase{CodeName: M_SYSTEM_OPPORTUNITY_TEMPLATE, ActionName: "default"},
"/v1/template/update": PermissionBase{CodeName: M_SYSTEM_OPPORTUNITY_TEMPLATE, ActionName: "default"},
"/v1/template/delete": PermissionBase{CodeName: M_SYSTEM_OPPORTUNITY_TEMPLATE, ActionName: "default"},
"/v1/template/editVisible": PermissionBase{CodeName: M_SYSTEM_OPPORTUNITY_TEMPLATE, ActionName: "default"},
"/v1/template/editEnable": PermissionBase{CodeName: M_SYSTEM_OPPORTUNITY_TEMPLATE, ActionName: "default"},
"/v1/template/editSort": PermissionBase{CodeName: M_SYSTEM_OPPORTUNITY_TEMPLATE, ActionName: "default"},
"/v1/template/operateCategory": PermissionBase{CodeName: M_SYSTEM_OPPORTUNITY_TEMPLATE, ActionName: "default"},
"/v1/template/deleteCategory": PermissionBase{CodeName: M_SYSTEM_OPPORTUNITY_TEMPLATE, ActionName: "default"},
"/v1/config/score": PermissionBase{CodeName: M_SYSTEM_RATING, ActionName: "default"},
"/v1/config/score/get": PermissionBase{CodeName: M_SYSTEM_RATING, ActionName: "default"},
"/v1/audit/list": PermissionBase{CodeName: M_SYSTEM_OPPORTUNITY, ActionName: "check"},
"/v1/chance/store/change": PermissionBase{CodeName: M_SYSTEM_OPPORTUNITY, ActionName: "default"},
//"/v1/chance/export_chance_list": PermissionBase{CodeName: M_SYSTEM_OPPORTUNITY, ActionName: "default"},
"/v1/department/list": PermissionBase{CodeName: M_ENTERPRISE_ORGANIZATION, ActionName: "default"},
"/v1/department/add": PermissionBase{CodeName: M_ENTERPRISE_ORGANIZATION, ActionName: "default"},
"/v1/department/edit": PermissionBase{CodeName: M_ENTERPRISE_ORGANIZATION, ActionName: "default"},
"/v1/department/delete": PermissionBase{CodeName: M_ENTERPRISE_ORGANIZATION, ActionName: "default"},
"/v1/company/current/edit": PermissionBase{CodeName: M_ENTERPRISE_PROFILE, ActionName: "default"},
"/v1/company/current/info": PermissionBase{CodeName: M_ENTERPRISE_PROFILE, ActionName: "default"},
"/v1/position/list": PermissionBase{CodeName: M_ENTERPRISE_EMPLOYEE_POST, ActionName: "default"},
"/v1/position/add": PermissionBase{CodeName: M_ENTERPRISE_EMPLOYEE_POST, ActionName: "default"},
"/v1/position/edit": PermissionBase{CodeName: M_ENTERPRISE_EMPLOYEE_POST, ActionName: "default"},
"/v1/position/delete": PermissionBase{CodeName: M_ENTERPRISE_EMPLOYEE_POST, ActionName: "default"},
"/v1/rbac/role/list": PermissionBase{CodeName: M_ENTERPRISE_EMPLOYEE_ROLE, ActionName: "default"},
"/v1/rbac/role/add": PermissionBase{CodeName: M_ENTERPRISE_EMPLOYEE_ROLE, ActionName: "default"},
"/v1/rbac/role/edit": PermissionBase{CodeName: M_ENTERPRISE_EMPLOYEE_ROLE, ActionName: "default"},
"/v1/rbac/role/delete": PermissionBase{CodeName: M_ENTERPRISE_EMPLOYEE_ROLE, ActionName: "default"},
"/v1/rbac/role_group/add": PermissionBase{CodeName: M_ENTERPRISE_EMPLOYEE_ROLE, ActionName: "default"},
"/v1/rbac/role_group/edit": PermissionBase{CodeName: M_ENTERPRISE_EMPLOYEE_ROLE, ActionName: "default"},
"/v1/rbac/role_group/delete": PermissionBase{CodeName: M_ENTERPRISE_EMPLOYEE_ROLE, ActionName: "default"},
"/v1/rbac/role/menu": PermissionBase{CodeName: M_ENTERPRISE_EMPLOYEE_ROLE, ActionName: "default"},
"/v1/rbac/menu/list": PermissionBase{CodeName: M_ENTERPRISE_EMPLOYEE_ROLE, ActionName: "default"},
"/v1/rbac/role/menu/edit": PermissionBase{CodeName: M_ENTERPRISE_EMPLOYEE_ROLE, ActionName: "default"},
"/v1/rbac/menu/opportunity": PermissionBase{CodeName: M_ENTERPRISE_EMPLOYEE_ROLE, ActionName: "default"},
"/v1/rbac/menu/opportunity/edit": PermissionBase{CodeName: M_ENTERPRISE_EMPLOYEE_ROLE, ActionName: "default"},
"/v1/user/list": PermissionBase{CodeName: M_ENTERPRISE_EMPLOYEE, ActionName: "default"},
"/v1/user/add": PermissionBase{CodeName: M_ENTERPRISE_EMPLOYEE, ActionName: "default"},
"/v1/user/edit": PermissionBase{CodeName: M_ENTERPRISE_EMPLOYEE, ActionName: "default"},
"/v1/user/delete": PermissionBase{CodeName: M_ENTERPRISE_EMPLOYEE, ActionName: "default"},
"/v1/user/allow_forbid": PermissionBase{CodeName: M_ENTERPRISE_EMPLOYEE, ActionName: "default"},
"/v1/user/info": PermissionBase{CodeName: M_ENTERPRISE_EMPLOYEE, ActionName: "default"},
"/v1/bulletin/add": PermissionBase{CodeName: M_SYSTEM_ANNOUNCEMENT, ActionName: "default"},
"/v1/bulletin/list": PermissionBase{CodeName: M_SYSTEM_ANNOUNCEMENT, ActionName: "default"},
"/v1/bulletin/get": PermissionBase{CodeName: M_SYSTEM_ANNOUNCEMENT, ActionName: "default"},
"/v1/bulletin/update": PermissionBase{CodeName: M_SYSTEM_ANNOUNCEMENT, ActionName: "default"},
"/v1/bulletin/operate": PermissionBase{CodeName: M_SYSTEM_ANNOUNCEMENT, ActionName: "default"},
"/v1/bulletin/feedbacks": PermissionBase{CodeName: M_SYSTEM_ANNOUNCEMENT, ActionName: "default"},
"/v1/bulletin/exportFeedBacks": PermissionBase{CodeName: M_SYSTEM_ANNOUNCEMENT, ActionName: "default"},
"/v1/template/add": PermissionBase{CodeName: M_SYSTEM_OPPORTUNITY_TEMPLATE, ActionName: "default"},
"/v1/template/sortCategory": PermissionBase{CodeName: M_SYSTEM_OPPORTUNITY_TEMPLATE, ActionName: "default"},
"/v1/template/list": PermissionBase{CodeName: M_SYSTEM_OPPORTUNITY_TEMPLATE, ActionName: "default"},
"/v1/template/get": PermissionBase{CodeName: M_SYSTEM_OPPORTUNITY_TEMPLATE, ActionName: "default"},
"/v1/template/update": PermissionBase{CodeName: M_SYSTEM_OPPORTUNITY_TEMPLATE, ActionName: "default"},
"/v1/template/delete": PermissionBase{CodeName: M_SYSTEM_OPPORTUNITY_TEMPLATE, ActionName: "default"},
"/v1/template/editVisible": PermissionBase{CodeName: M_SYSTEM_OPPORTUNITY_TEMPLATE, ActionName: "default"},
"/v1/template/editEnable": PermissionBase{CodeName: M_SYSTEM_OPPORTUNITY_TEMPLATE, ActionName: "default"},
"/v1/template/editSort": PermissionBase{CodeName: M_SYSTEM_OPPORTUNITY_TEMPLATE, ActionName: "default"},
"/v1/template/operateCategory": PermissionBase{CodeName: M_SYSTEM_OPPORTUNITY_TEMPLATE, ActionName: "default"},
"/v1/template/deleteCategory": PermissionBase{CodeName: M_SYSTEM_OPPORTUNITY_TEMPLATE, ActionName: "default"},
"/v1/config/score": PermissionBase{CodeName: M_SYSTEM_RATING, ActionName: "default"},
"/v1/config/score/get": PermissionBase{CodeName: M_SYSTEM_RATING, ActionName: "default"},
"/v1/audit/list": PermissionBase{CodeName: M_SYSTEM_OPPORTUNITY, ActionName: "check"},
"/v1/chance/store/change": PermissionBase{CodeName: M_SYSTEM_OPPORTUNITY, ActionName: "chance_store_change"},
"/v1/chance/export_chance_list": PermissionBase{CodeName: M_SYSTEM_OPPORTUNITY, ActionName: "export_excel"},
"/v1/audit/info": PermissionBase{CodeName: M_SYSTEM_OPPORTUNITY, ActionName: "check"},
"/v1/audit/allow_forbid": PermissionBase{CodeName: M_SYSTEM_OPPORTUNITY, ActionName: "close_chance"},
"/v1/rank/type/list": PermissionBase{CodeName: M_SYSTEM_RANK, ActionName: "default"},
... ...
... ... @@ -94,13 +94,15 @@ type CheckOpp struct {
//OptionOpportunity 机会管理 高级权限设置
type OptionOpportunity struct {
Check int `json:"check"`
CheckMap map[int]int `json:"check_map,omitempty"`
CheckOption *CheckOpp `json:"check_option,omitempty"`
EditSorce int `json:"edit_sorce"`
EditPublicStatus int `json:"edit_public_status"`
CloseChance int `json:"close_chance"`
EditChance int `json:"edit_chance"`
Check int `json:"check"`
CheckMap map[int]int `json:"check_map,omitempty"`
CheckOption *CheckOpp `json:"check_option,omitempty"`
EditSorce int `json:"edit_sorce"`
EditPublicStatus int `json:"edit_public_status"`
CloseChance int `json:"close_chance"`
EditChance int `json:"edit_chance"`
ExportExcel int `json:"export_excel"` //导出数据权限
ChanceStoreChange int `json:"chance_store_chance"` //移到机会池/储备池
}
/*
... ... @@ -134,10 +136,12 @@ func NewOptionOpportunity() PermissionOptionObject {
//GetValidFunc PermissionOptionBase 接口实现
func (p *OptionOpportunity) GetValidFunc(k string) bool {
m := map[string]func() bool{
"check": p.ValidCheck,
"edit_sorce": p.ValidEditSorce,
"close_chance": p.ValidCloseChance,
"edit_public_status": p.ValidEditPublicStatus,
"check": p.ValidCheck,
"edit_sorce": p.ValidEditSorce,
"close_chance": p.ValidCloseChance,
"edit_public_status": p.ValidEditPublicStatus,
"export_excel": p.ValidExportExcel,
"chance_store_change": p.ValidChanceStoreChange,
}
if fn, ok := m[k]; ok {
... ... @@ -225,6 +229,20 @@ func (p *OptionOpportunity) ValidEditPublicStatus() bool {
return false
}
func (p *OptionOpportunity) ValidExportExcel() bool {
if p.ExportExcel > 0 {
return true
}
return false
}
func (p *OptionOpportunity) ValidChanceStoreChange() bool {
if p.ChanceStoreChange > 0 {
return true
}
return false
}
func (p *OptionOpportunity) ValidCloseChance() bool {
if p.CloseChance > 0 {
return true
... ...