作者 唐旭辉

提交

@@ -185,16 +185,23 @@ func GetRoleList(adminid int64, companyId int64) ([]protocol.RoleGroup, error) { @@ -185,16 +185,23 @@ func GetRoleList(adminid int64, companyId int64) ([]protocol.RoleGroup, error) {
185 roleGroups = make([]protocol.RoleGroup, 0) 185 roleGroups = make([]protocol.RoleGroup, 0)
186 err error 186 err error
187 groups []protocol.RoleInfo 187 groups []protocol.RoleInfo
188 - // companyinfo *models.Company 188 + companyinfo *models.Company
189 ) 189 )
190 - // models.GetCompanyById(companyId) 190 + companyinfo, err = models.GetCompanyById(companyId)
  191 + if err != nil {
  192 + log.Error("获取公司数据失败 GetCompanyById(%d) err:%s", companyId, err)
  193 + return roleGroups, protocol.NewErrWithMessage("1")
  194 + }
191 groups, err = getRoleGroupByCompany(companyId) 195 groups, err = getRoleGroupByCompany(companyId)
192 if err != nil { 196 if err != nil {
193 log.Error("getRoleGroupByCompany err:%s", err) 197 log.Error("getRoleGroupByCompany err:%s", err)
194 return roleGroups, protocol.NewErrWithMessage("1") 198 return roleGroups, protocol.NewErrWithMessage("1")
195 } 199 }
196 -  
197 for k, v := range groups { 200 for k, v := range groups {
  201 + if companyinfo.AdminId != adminid && v.IsDefault == models.ROLE_DEFAULR {
  202 + //非管理员过滤掉 管理员角色组
  203 + continue
  204 + }
198 var roles []protocol.RoleInfo 205 var roles []protocol.RoleInfo
199 roles, err = getRoleInfoByPid(companyId, v.Id) 206 roles, err = getRoleInfoByPid(companyId, v.Id)
200 if err != nil { 207 if err != nil {