You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicecomb.apache.org by GitBox <gi...@apache.org> on 2021/05/22 03:07:44 UTC

[GitHub] [servicecomb-service-center] little-cui commented on a change in pull request #1000: Realize all rbac APIs.

little-cui commented on a change in pull request #1000:
URL: https://github.com/apache/servicecomb-service-center/pull/1000#discussion_r637344984



##########
File path: server/resource/v4/auth_resource.go
##########
@@ -93,6 +94,27 @@ func (r *AuthResource) DeleteAccount(w http.ResponseWriter, req *http.Request) {
 	}
 	w.WriteHeader(http.StatusNoContent)
 }
+func (r *AuthResource) UpdateAccount(w http.ResponseWriter, req *http.Request) {
+	body, err := ioutil.ReadAll(req.Body)
+	if err != nil {
+		log.Error("read body err", err)
+		controller.WriteError(w, discovery.ErrInternal, err.Error())
+		return
+	}
+	a := &rbac.Account{}
+	if err = json.Unmarshal(body, a); err != nil {
+		log.Error("json err", err)
+		controller.WriteError(w, discovery.ErrInvalidParams, err.Error())
+		return
+	}
+	name := req.URL.Query().Get(":name")
+	err = dao.UpdateAccount(context.TODO(), name, a)
+	if err != nil {
+		log.Error(errorsEx.MsgOperateAccountFailed, err)
+		controller.WriteError(w, discovery.ErrInternal, errorsEx.MsgOperateAccountFailed)
+		return
+	}

Review comment:
       成功场景没有写response status,导致链接阻塞




-- 
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:
users@infra.apache.org