...
|
...
|
@@ -44,38 +44,38 @@ func SelectorRoleAll(companyid int64) []protocol.RoleBase { |
|
|
return roles
|
|
|
}
|
|
|
|
|
|
func FilterRoleAll(adminid int64, companyid int64, list []protocol.RoleBase) []protocol.RoleBase {
|
|
|
var (
|
|
|
newlist []protocol.RoleBase
|
|
|
admingoroupId int64
|
|
|
)
|
|
|
companyInfo, err := models.GetCompanyById(companyid)
|
|
|
if err != nil {
|
|
|
e := fmt.Errorf("GetCompanyById(%d) err:%s", companyid, err)
|
|
|
log.Error(e.Error())
|
|
|
return newlist
|
|
|
}
|
|
|
for _, v := range list {
|
|
|
if v.IsDefault == models.ROLE_DEFAULR && v.Types == models.ROLETYPES_GROUP {
|
|
|
admingoroupId = v.Id
|
|
|
break
|
|
|
}
|
|
|
}
|
|
|
for k, v := range list {
|
|
|
// if v.Types == models.ROLETYPES_ROLE && v.IsDefault == models.ROLE_DEFAULR {
|
|
|
// continue
|
|
|
// }
|
|
|
if companyInfo.AdminId != adminid {
|
|
|
//非主管理员
|
|
|
if v.Id == admingoroupId || v.ParentId == admingoroupId {
|
|
|
continue
|
|
|
}
|
|
|
}
|
|
|
// func FilterRoleAll(adminid int64, companyid int64, list []protocol.RoleBase) []protocol.RoleBase {
|
|
|
// var (
|
|
|
// newlist []protocol.RoleBase
|
|
|
// admingoroupId int64
|
|
|
// )
|
|
|
// companyInfo, err := models.GetCompanyById(companyid)
|
|
|
// if err != nil {
|
|
|
// e := fmt.Errorf("GetCompanyById(%d) err:%s", companyid, err)
|
|
|
// log.Error(e.Error())
|
|
|
// return newlist
|
|
|
// }
|
|
|
// for _, v := range list {
|
|
|
// if v.IsDefault == models.ROLE_DEFAULR && v.Types == models.ROLETYPES_GROUP {
|
|
|
// admingoroupId = v.Id
|
|
|
// break
|
|
|
// }
|
|
|
// }
|
|
|
// for k, v := range list {
|
|
|
// // if v.Types == models.ROLETYPES_ROLE && v.IsDefault == models.ROLE_DEFAULR {
|
|
|
// // continue
|
|
|
// // }
|
|
|
// if companyInfo.AdminId != adminid {
|
|
|
// //非主管理员
|
|
|
// if v.Id == admingoroupId || v.ParentId == admingoroupId {
|
|
|
// continue
|
|
|
// }
|
|
|
// }
|
|
|
|
|
|
newlist = append(newlist, list[k])
|
|
|
}
|
|
|
return newlist
|
|
|
}
|
|
|
// newlist = append(newlist, list[k])
|
|
|
// }
|
|
|
// return newlist
|
|
|
// }
|
|
|
|
|
|
func FilterRoleGroup(adminid int64, companyid int64, list []protocol.RoleBase) []protocol.RoleBase {
|
|
|
var (
|
...
|
...
|
|