mirror of
https://github.com/TeaOSLab/EdgeAPI.git
synced 2025-11-03 06:40:26 +08:00
[系统用户]系统用户可以设置启用/禁用
This commit is contained in:
@@ -88,6 +88,7 @@ func (this *AdminDAO) CheckAdminPassword(username string, encryptedPassword stri
|
||||
Attr("username", username).
|
||||
Attr("password", encryptedPassword).
|
||||
Attr("state", AdminStateEnabled).
|
||||
Attr("isOn", true).
|
||||
ResultPk().
|
||||
FindInt64Col(0)
|
||||
}
|
||||
@@ -154,7 +155,7 @@ func (this *AdminDAO) UpdateAdminInfo(adminId int64, fullname string) error {
|
||||
}
|
||||
|
||||
// 修改管理员详细信息
|
||||
func (this *AdminDAO) UpdateAdmin(adminId int64, username string, password string, fullname string, isSuper bool, modulesJSON []byte) error {
|
||||
func (this *AdminDAO) UpdateAdmin(adminId int64, username string, password string, fullname string, isSuper bool, modulesJSON []byte, isOn bool) error {
|
||||
if adminId <= 0 {
|
||||
return errors.New("invalid adminId")
|
||||
}
|
||||
@@ -171,6 +172,7 @@ func (this *AdminDAO) UpdateAdmin(adminId int64, username string, password strin
|
||||
} else {
|
||||
op.Modules = "[]"
|
||||
}
|
||||
op.IsOn = isOn
|
||||
_, err := this.Save(op)
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -286,7 +286,7 @@ func (this *AdminService) UpdateAdmin(ctx context.Context, req *pb.UpdateAdminRe
|
||||
|
||||
// TODO 检查权限
|
||||
|
||||
err = models.SharedAdminDAO.UpdateAdmin(req.AdminId, req.Username, req.Password, req.Fullname, req.IsSuper, req.ModulesJSON)
|
||||
err = models.SharedAdminDAO.UpdateAdmin(req.AdminId, req.Username, req.Password, req.Fullname, req.IsSuper, req.ModulesJSON, req.IsOn)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user