|
@@ -181,31 +181,29 @@ func RoleGroupDelete(param protocol.RequestRoleDelete) error { |
|
@@ -181,31 +181,29 @@ func RoleGroupDelete(param protocol.RequestRoleDelete) error { |
181
|
return nil
|
181
|
return nil
|
182
|
}
|
182
|
}
|
183
|
|
183
|
|
184
|
-func GetRoleList(companyId int64) ([]protocol.RoleGroup, error) {
|
184
|
+func GetRoleList(companyId int64) ([]protocol.RoleInfo, error) {
|
185
|
var (
|
185
|
var (
|
186
|
- roleGroups []protocol.RoleGroup
|
|
|
187
|
- err error
|
|
|
188
|
- groups []protocol.RoleInfo
|
186
|
+ roleGroups []protocol.RoleInfo
|
|
|
187
|
+ err error
|
|
|
188
|
+ rolesReturn []protocol.RoleInfo
|
189
|
)
|
189
|
)
|
190
|
- groups, err = getRoleGroupByCompany(companyId)
|
190
|
+ roleGroups, err = getRoleGroupByCompany(companyId)
|
191
|
if err != nil {
|
191
|
if err != nil {
|
192
|
log.Error("getRoleGroupByCompany err:%s", err)
|
192
|
log.Error("getRoleGroupByCompany err:%s", err)
|
193
|
- return roleGroups, protocol.NewErrWithMessage("1")
|
193
|
+ return rolesReturn, protocol.NewErrWithMessage("1")
|
194
|
}
|
194
|
}
|
195
|
- for k, v := range groups {
|
195
|
+ for _, v := range roleGroups {
|
196
|
var roles []protocol.RoleInfo
|
196
|
var roles []protocol.RoleInfo
|
197
|
roles, err = getRoleInfoByPid(companyId, v.Id)
|
197
|
roles, err = getRoleInfoByPid(companyId, v.Id)
|
198
|
if err != nil {
|
198
|
if err != nil {
|
199
|
log.Error("getRoleInfoByPid err:%s", err)
|
199
|
log.Error("getRoleInfoByPid err:%s", err)
|
200
|
- return roleGroups, protocol.NewErrWithMessage("1")
|
200
|
+ continue
|
201
|
}
|
201
|
}
|
202
|
- rolegroup := protocol.RoleGroup{
|
|
|
203
|
- RoleInfo: groups[k],
|
|
|
204
|
- Roles: roles,
|
|
|
205
|
- }
|
|
|
206
|
- roleGroups = append(roleGroups, rolegroup)
|
202
|
+
|
|
|
203
|
+ rolesReturn = append(rolesReturn, roles...)
|
207
|
}
|
204
|
}
|
208
|
- return roleGroups, nil
|
205
|
+ rolesReturn = append(rolesReturn, roleGroups...)
|
|
|
206
|
+ return rolesReturn, nil
|
209
|
}
|
207
|
}
|
210
|
|
208
|
|
211
|
func getRoleInfoByPid(companyid int64, pid int64) ([]protocol.RoleInfo, error) {
|
209
|
func getRoleInfoByPid(companyid int64, pid int64) ([]protocol.RoleInfo, error) {
|