...
|
...
|
@@ -181,31 +181,29 @@ func RoleGroupDelete(param protocol.RequestRoleDelete) error { |
|
|
return nil
|
|
|
}
|
|
|
|
|
|
func GetRoleList(companyId int64) ([]protocol.RoleGroup, error) {
|
|
|
func GetRoleList(companyId int64) ([]protocol.RoleInfo, error) {
|
|
|
var (
|
|
|
roleGroups []protocol.RoleGroup
|
|
|
err error
|
|
|
groups []protocol.RoleInfo
|
|
|
roleGroups []protocol.RoleInfo
|
|
|
err error
|
|
|
rolesReturn []protocol.RoleInfo
|
|
|
)
|
|
|
groups, err = getRoleGroupByCompany(companyId)
|
|
|
roleGroups, err = getRoleGroupByCompany(companyId)
|
|
|
if err != nil {
|
|
|
log.Error("getRoleGroupByCompany err:%s", err)
|
|
|
return roleGroups, protocol.NewErrWithMessage("1")
|
|
|
return rolesReturn, protocol.NewErrWithMessage("1")
|
|
|
}
|
|
|
for k, v := range groups {
|
|
|
for _, v := range roleGroups {
|
|
|
var roles []protocol.RoleInfo
|
|
|
roles, err = getRoleInfoByPid(companyId, v.Id)
|
|
|
if err != nil {
|
|
|
log.Error("getRoleInfoByPid err:%s", err)
|
|
|
return roleGroups, protocol.NewErrWithMessage("1")
|
|
|
continue
|
|
|
}
|
|
|
rolegroup := protocol.RoleGroup{
|
|
|
RoleInfo: groups[k],
|
|
|
Roles: roles,
|
|
|
}
|
|
|
roleGroups = append(roleGroups, rolegroup)
|
|
|
|
|
|
rolesReturn = append(rolesReturn, roles...)
|
|
|
}
|
|
|
return roleGroups, nil
|
|
|
rolesReturn = append(rolesReturn, roleGroups...)
|
|
|
return rolesReturn, nil
|
|
|
}
|
|
|
|
|
|
func getRoleInfoByPid(companyid int64, pid int64) ([]protocol.RoleInfo, error) {
|
...
|
...
|
|