|
@@ -44,38 +44,38 @@ func SelectorRoleAll(companyid int64) []protocol.RoleBase { |
|
@@ -44,38 +44,38 @@ func SelectorRoleAll(companyid int64) []protocol.RoleBase { |
44
|
return roles
|
44
|
return roles
|
45
|
}
|
45
|
}
|
46
|
|
46
|
|
47
|
-// func FilterRoleAll(adminid int64, companyid int64, list []protocol.RoleBase) []protocol.RoleBase {
|
|
|
48
|
-// var (
|
|
|
49
|
-// newlist []protocol.RoleBase
|
|
|
50
|
-// admingoroupId int64
|
|
|
51
|
-// )
|
|
|
52
|
-// companyInfo, err := models.GetCompanyById(companyid)
|
|
|
53
|
-// if err != nil {
|
|
|
54
|
-// e := fmt.Errorf("GetCompanyById(%d) err:%s", companyid, err)
|
|
|
55
|
-// log.Error(e.Error())
|
|
|
56
|
-// return newlist
|
|
|
57
|
-// }
|
|
|
58
|
-// for _, v := range list {
|
|
|
59
|
-// if v.IsDefault == models.ROLE_DEFAULR && v.Types == models.ROLETYPES_GROUP {
|
|
|
60
|
-// admingoroupId = v.Id
|
|
|
61
|
-// break
|
|
|
62
|
-// }
|
|
|
63
|
-// }
|
|
|
64
|
-// for k, v := range list {
|
|
|
65
|
-// // if v.Types == models.ROLETYPES_ROLE && v.IsDefault == models.ROLE_DEFAULR {
|
|
|
66
|
-// // continue
|
|
|
67
|
-// // }
|
|
|
68
|
-// if companyInfo.AdminId != adminid {
|
|
|
69
|
-// //非主管理员
|
|
|
70
|
-// if v.Id == admingoroupId || v.ParentId == admingoroupId {
|
|
|
71
|
-// continue
|
|
|
72
|
-// }
|
|
|
73
|
-// }
|
47
|
+func FilterRoleAll(adminid int64, companyid int64, list []protocol.RoleBase) []protocol.RoleBase {
|
|
|
48
|
+ var (
|
|
|
49
|
+ newlist []protocol.RoleBase
|
|
|
50
|
+ admingoroupId int64
|
|
|
51
|
+ )
|
|
|
52
|
+ companyInfo, err := models.GetCompanyById(companyid)
|
|
|
53
|
+ if err != nil {
|
|
|
54
|
+ e := fmt.Errorf("GetCompanyById(%d) err:%s", companyid, err)
|
|
|
55
|
+ log.Error(e.Error())
|
|
|
56
|
+ return newlist
|
|
|
57
|
+ }
|
|
|
58
|
+ for _, v := range list {
|
|
|
59
|
+ if v.IsDefault == models.ROLE_DEFAULR && v.Types == models.ROLETYPES_GROUP {
|
|
|
60
|
+ admingoroupId = v.Id
|
|
|
61
|
+ break
|
|
|
62
|
+ }
|
|
|
63
|
+ }
|
|
|
64
|
+ for k, v := range list {
|
|
|
65
|
+ if v.Types == models.ROLETYPES_ROLE && v.IsDefault == models.ROLE_DEFAULR {
|
|
|
66
|
+ continue
|
|
|
67
|
+ }
|
|
|
68
|
+ // if companyInfo.AdminId != adminid {
|
|
|
69
|
+ // //非主管理员
|
|
|
70
|
+ // if v.Id == admingoroupId || v.ParentId == admingoroupId {
|
|
|
71
|
+ // continue
|
|
|
72
|
+ // }
|
|
|
73
|
+ // }
|
74
|
|
74
|
|
75
|
-// newlist = append(newlist, list[k])
|
|
|
76
|
-// }
|
|
|
77
|
-// return newlist
|
|
|
78
|
-// }
|
75
|
+ newlist = append(newlist, list[k])
|
|
|
76
|
+ }
|
|
|
77
|
+ return newlist
|
|
|
78
|
+}
|
79
|
|
79
|
|
80
|
func FilterRoleGroup(adminid int64, companyid int64, list []protocol.RoleBase) []protocol.RoleBase {
|
80
|
func FilterRoleGroup(adminid int64, companyid int64, list []protocol.RoleBase) []protocol.RoleBase {
|
81
|
var (
|
81
|
var (
|