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/31 07:35:18 UTC

[GitHub] [servicecomb-service-center] little-cui commented on a change in pull request #1029: Add account/auth error code

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



##########
File path: server/resource/v4/auth_resource.go
##########
@@ -145,29 +124,16 @@ func (ar *AuthResource) ListAccount(w http.ResponseWriter, r *http.Request) {
 }
 
 func (ar *AuthResource) GetAccount(w http.ResponseWriter, r *http.Request) {
-	a, err := dao.GetAccount(r.Context(), r.URL.Query().Get(":name"))
+	a, err := rbacsvc.GetAccount(r.Context(), r.URL.Query().Get(":name"))
 	if err != nil {
 		log.Error(errorsEx.MsgGetAccountFailed, err)
-		rest.WriteError(w, discovery.ErrInternal, errorsEx.MsgGetAccountFailed)
+		writeErrsvcOrInternalErr(w, err)
 		return
 	}
 	a.Password = ""
 	rest.WriteResponse(w, r, nil, a)
 }
 
-func (ar *AuthResource) illegalCheck(w http.ResponseWriter, req *http.Request, name string) bool {
-	if name == rbacsvc.RootName {
-		rest.WriteError(w, discovery.ErrInvalidParams, errorsEx.MsgCantOperateRoot)
-		return true
-	}
-	user := rbacsvc.UserFromContext(req.Context())
-	if name == user {
-		rest.WriteError(w, discovery.ErrInvalidParams, errorsEx.MsgCantOperateYour)
-		return true
-	}
-	return false

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