little-cui commented on a change in pull request #1000:
URL:
https://github.com/apache/servicecomb-service-center/pull/1000#discussion_r637345316
##########
File path: server/service/rbac/dao/account_dao.go
##########
@@ -33,6 +33,33 @@ func CreateAccount(ctx context.Context, a
*rbacmodel.Account) error {
return datasource.Instance().CreateAccount(ctx, a)
}
+// UpdateAccount updates an account's info, except the password
+func UpdateAccount(ctx context.Context, name string, a *rbacmodel.Account)
error {
Review comment:
增加ut
##########
File path: server/service/rbac/dao/account_dao.go
##########
@@ -33,6 +33,33 @@ func CreateAccount(ctx context.Context, a
*rbacmodel.Account) error {
return datasource.Instance().CreateAccount(ctx, a)
}
+// UpdateAccount updates an account's info, except the password
+func UpdateAccount(ctx context.Context, name string, a *rbacmodel.Account)
error {
+ // todo params validation
+ exist, err := datasource.Instance().AccountExist(ctx, name)
+ if err != nil {
+ log.Errorf(err, "check account [%s] exit failed", name)
+ return err
+ }
+ if !exist {
+ return datasource.ErrAccountNotExist
+ }
+ oldAccount, err := GetAccount(ctx, name)
+ if err != nil {
+ log.Errorf(err, "get account [%s] failed", name)
+ return err
+ }
+ oldAccount.Roles = a.Roles
+ oldAccount.Status = a.Status
Review comment:
是否判断有什么,更新什么
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]