作者 唐旭辉

bug 修复

#app的名称
appname = ability
#运行模式
runmode =${RUN_MODE||dev}
runmode =${RUN_MODE||test}
#是否自动渲染页面
autorender = false
#是否复制请求body
... ...
... ... @@ -68,8 +68,8 @@ func (c *CommonController) SelectorRole() {
switch param.For {
case "user":
//编辑用户时
list := servecommon.SelectorRoleAll(companyid)
roles = servecommon.FilterRoleAll(userid, companyid, list)
roles = servecommon.SelectorRoleAll(companyid)
//roles = servecommon.FilterRoleAll(userid, companyid, list)
case "role":
//编辑角色时
list := servecommon.SelectorRoleAll(companyid)
... ...
... ... @@ -84,7 +84,7 @@ type ResponseUserHasMenu struct {
SeniorStatus int8 `json:"senior_status" orm:"column(senior_status)"`
Code string `json:"code" orm:"column(code)"`
Sort int `json:"sort" orm:"column(sort)"`
Status int `json:"status" orm:"column(status)"`
Status int `json:"status" orm:"-"`
}
func (c *ResponseUserHasMenu) StatusYes() {
... ...
... ... @@ -345,7 +345,7 @@ func GetUserHasMenu(userid, companyid int64) ([]protocol.ResponseUserHasMenu, er
FROM role_menu AS a
JOIN user_role AS b ON a.role_id = b.role_id
JOIN role AS c ON a.role_id = c.id
WHERE b.user_company_id=? AND c.delete_at =0 `
WHERE b.user_company_id=? AND c.delete_at =0 AND b.enable_status=1 `
var menuids []int64
err = utils.ExecuteQueryAll(&menuids, datasql2, ucompany.Id)
if err != nil {
... ...
... ... @@ -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 (
... ...