作者 唐旭辉

bug 修复

@@ -231,12 +231,9 @@ func (c *RbacController) MenuList() { @@ -231,12 +231,9 @@ func (c *RbacController) MenuList() {
231 defer func() { 231 defer func() {
232 c.ResposeJson(msg) 232 c.ResposeJson(msg)
233 }() 233 }()
234 - userid := c.GetUserId()  
235 - companyid := c.GetCompanyId()  
236 list, err := serverbac.GetMenuAll() 234 list, err := serverbac.GetMenuAll()
237 - menulist := serverbac.FilterMenuByRole(list, userid, companyid)  
238 data := protocol.ResponsePermissionList{ 235 data := protocol.ResponsePermissionList{
239 - Lists: menulist, 236 + Lists: list,
240 } 237 }
241 msg = protocol.NewReturnResponse(data, err) 238 msg = protocol.NewReturnResponse(data, err)
242 return 239 return
@@ -27,50 +27,50 @@ func GetMenuAll() ([]protocol.PermissionItem, error) { @@ -27,50 +27,50 @@ func GetMenuAll() ([]protocol.PermissionItem, error) {
27 return list, nil 27 return list, nil
28 } 28 }
29 29
30 -func FilterMenuByRole(allMenu []protocol.PermissionItem, userid int64, companyid int64) []protocol.PermissionItem {  
31 - var newMenuList []protocol.PermissionItem  
32 - ucompany, err := models.GetUserCompanyBy(userid, companyid)  
33 - if err != nil {  
34 - log.Error("获取用户数据失败:%s", err)  
35 - return allMenu  
36 - }  
37 - rolegroup, err := models.GetCompanyDefaultRoleGroup(ucompany.CompanyId)  
38 - if err != nil {  
39 - log.Error("获取默认的角色组失败:%s", err)  
40 - return allMenu  
41 - }  
42 - rolelist, err := models.GetUserRoleByUser(ucompany.Id)  
43 - if err != nil {  
44 - log.Error("获取用户的角色失败:%s", err)  
45 - return allMenu  
46 - }  
47 - var (  
48 - isIn bool = false  
49 - )  
50 - for i := range rolelist {  
51 - if rolelist[i].Pid == rolegroup.Id {  
52 - isIn = true  
53 - }  
54 - }  
55 - if isIn {  
56 - return allMenu  
57 - }  
58 - codeMap := map[string]int{  
59 - M_ENTERPRISE: 1,  
60 - M_ENTERPRISE_PROFILE: 1,  
61 - M_ENTERPRISE_ORGANIZATION: 1,  
62 - M_ENTERPRISE_EMPLOYEE_POST: 1,  
63 - M_ENTERPRISE_EMPLOYEE_ROLE: 1,  
64 - M_ENTERPRISE_EMPLOYEE: 1,  
65 - }  
66 - for i, v := range allMenu {  
67 - if _, ok := codeMap[v.Code]; ok {  
68 - continue  
69 - }  
70 - newMenuList = append(newMenuList, allMenu[i])  
71 - }  
72 - return newMenuList  
73 -} 30 +// func FilterMenuByRole(allMenu []protocol.PermissionItem, userid int64, companyid int64) []protocol.PermissionItem {
  31 +// var newMenuList []protocol.PermissionItem
  32 +// ucompany, err := models.GetUserCompanyBy(userid, companyid)
  33 +// if err != nil {
  34 +// log.Error("获取用户数据失败:%s", err)
  35 +// return allMenu
  36 +// }
  37 +// rolegroup, err := models.GetCompanyDefaultRoleGroup(ucompany.CompanyId)
  38 +// if err != nil {
  39 +// log.Error("获取默认的角色组失败:%s", err)
  40 +// return allMenu
  41 +// }
  42 +// rolelist, err := models.GetUserRoleByUser(ucompany.Id)
  43 +// if err != nil {
  44 +// log.Error("获取用户的角色失败:%s", err)
  45 +// return allMenu
  46 +// }
  47 +// var (
  48 +// isIn bool = false
  49 +// )
  50 +// for i := range rolelist {
  51 +// if rolelist[i].Pid == rolegroup.Id {
  52 +// isIn = true
  53 +// }
  54 +// }
  55 +// if isIn {
  56 +// return allMenu
  57 +// }
  58 +// codeMap := map[string]int{
  59 +// M_ENTERPRISE: 1,
  60 +// M_ENTERPRISE_PROFILE: 1,
  61 +// M_ENTERPRISE_ORGANIZATION: 1,
  62 +// M_ENTERPRISE_EMPLOYEE_POST: 1,
  63 +// M_ENTERPRISE_EMPLOYEE_ROLE: 1,
  64 +// M_ENTERPRISE_EMPLOYEE: 1,
  65 +// }
  66 +// for i, v := range allMenu {
  67 +// if _, ok := codeMap[v.Code]; ok {
  68 +// continue
  69 +// }
  70 +// newMenuList = append(newMenuList, allMenu[i])
  71 +// }
  72 +// return newMenuList
  73 +// }
74 74
75 func GetRoleHasMenu(roleid int64, companyid int64) (*protocol.ResponseRoleMenus, error) { 75 func GetRoleHasMenu(roleid int64, companyid int64) (*protocol.ResponseRoleMenus, error) {
76 var ( 76 var (