This commit is contained in:
@@ -159,7 +159,7 @@ func (s *BaseSysUserService) ModifyBefore(ctx context.Context, method string, pa
|
||||
// 禁止删除超级管理员
|
||||
userIds := garray.NewIntArrayFrom(gconv.Ints(param["ids"]))
|
||||
currentId, found := userIds.Get(0)
|
||||
superAdminId := 10001
|
||||
superAdminId := int(SuperAdminUserID)
|
||||
|
||||
if userIds.Len() == 1 && found && currentId == superAdminId {
|
||||
err = gerror.New("超级管理员不能删除")
|
||||
@@ -167,7 +167,7 @@ func (s *BaseSysUserService) ModifyBefore(ctx context.Context, method string, pa
|
||||
}
|
||||
|
||||
// 删除超级管理员
|
||||
userIds.RemoveValue(10001)
|
||||
userIds.RemoveValue(superAdminId)
|
||||
g.RequestFromCtx(ctx).SetParam("ids", userIds.Slice())
|
||||
}
|
||||
return
|
||||
@@ -419,7 +419,7 @@ func (s *BaseSysUserService) ServiceUpdate(ctx context.Context, req *cool.Update
|
||||
}
|
||||
|
||||
// 禁止禁用超级管理员
|
||||
if userId == 10001 && (!r.Get("status").IsNil() && r.Get("status").Int() == 0) {
|
||||
if userId == SuperAdminUserID && (!r.Get("status").IsNil() && r.Get("status").Int() == 0) {
|
||||
err = gerror.New("禁止禁用超级管理员")
|
||||
return
|
||||
}
|
||||
@@ -545,7 +545,7 @@ func NewBaseSysUserService() *BaseSysUserService {
|
||||
Where: func(ctx context.Context) []g.Array {
|
||||
r := g.RequestFromCtx(ctx).GetMap()
|
||||
return []g.Array{
|
||||
{"id != ?", g.Slice{"10001"}, true}, //排除管理员
|
||||
{"id != ?", g.Slice{gconv.String(SuperAdminUserID)}, true}, //排除管理员
|
||||
{`("departmentId" IN (?))`, gconv.SliceStr(r["departmentIds"])},
|
||||
}
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user