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