Parcourir la source

add param for remote access client id

abhishek9686 il y a 1 an
Parent
commit
a80d5baf20
1 fichiers modifiés avec 5 ajouts et 1 suppressions
  1. 5 1
      pro/controllers/users.go

+ 5 - 1
pro/controllers/users.go

@@ -148,6 +148,7 @@ func getUserRemoteAccessGws(w http.ResponseWriter, r *http.Request) {
 		logic.ReturnErrorResponse(w, r, logic.FormatError(errors.New("required params username"), "badrequest"))
 		return
 	}
+	remoteAccessClientID := params["remote_access_clientid"]
 	var req models.UserRemoteGwsReq
 	err := json.NewDecoder(r.Body).Decode(&req)
 	if err != nil {
@@ -155,10 +156,13 @@ func getUserRemoteAccessGws(w http.ResponseWriter, r *http.Request) {
 		logic.ReturnErrorResponse(w, r, logic.FormatError(err, "badrequest"))
 		return
 	}
-	if req.RemoteAccessClientID == "" {
+	if req.RemoteAccessClientID == "" && remoteAccessClientID == "" {
 		logic.ReturnErrorResponse(w, r, logic.FormatError(errors.New("remote access client id cannot be empty"), "badrequest"))
 		return
 	}
+	if remoteAccessClientID != "" {
+		req.RemoteAccessClientID = remoteAccessClientID
+	}
 	userGws := make(map[string][]models.UserRemoteGws)
 	user, err := logic.GetUser(username)
 	if err != nil {