diff --git a/handlers/instance.go b/handlers/instance.go index a351159..1d833ed 100644 --- a/handlers/instance.go +++ b/handlers/instance.go @@ -537,7 +537,7 @@ func StartInstanceHandler(w http.ResponseWriter, r *http.Request) { return } - instance, err := database.DBQueryFrpcInstanceByID(instanceID) + // instance, err := database.DBQueryFrpcInstanceByID(instanceID) if err == sql.ErrNoRows { utils.SendErrorResponse(w, http.StatusNotFound, "Instance not found") postLog.Error(fmt.Sprintf("[StartInstanceHandler] User %d tried to start a not existed instance: %d", userID, instanceID)) @@ -549,11 +549,11 @@ func StartInstanceHandler(w http.ResponseWriter, r *http.Request) { return } - if instance.UserID != userID { - utils.SendErrorResponse(w, http.StatusForbidden, "Instance not found") - postLog.Error(fmt.Sprintf("[StartInstanceHandler] User %d tried to start instance %d that does not belong to them", userID, instanceID)) - return - } + // if instance.UserID != userID { + // utils.SendErrorResponse(w, http.StatusForbidden, "Instance not found") + // postLog.Error(fmt.Sprintf("[StartInstanceHandler] User %d tried to start instance %d that does not belong to them", userID, instanceID)) + // return + // } initType := sys.GetInitSystem() sysName, err := database.GetServiceNameByInstanceID(instanceID) @@ -665,7 +665,7 @@ func StopInstanceHandler(w http.ResponseWriter, r *http.Request) { return } - instance, err := database.DBQueryFrpcInstanceByID(instanceID) + // instance, err := database.DBQueryFrpcInstanceByID(instanceID) if err == sql.ErrNoRows { utils.SendErrorResponse(w, http.StatusNotFound, "Instance not found") postLog.Error(fmt.Sprintf("[StopInstanceHandler] User %d tried to stop a not existed instance: %d", userID, instanceID)) @@ -677,11 +677,11 @@ func StopInstanceHandler(w http.ResponseWriter, r *http.Request) { return } - if instance.UserID != userID { - utils.SendErrorResponse(w, http.StatusForbidden, "Instance not found") - postLog.Error(fmt.Sprintf("[StopInstanceHandler] User %d tried to stop instance %d that does not belong to them", userID, instanceID)) - return - } + // if instance.UserID != userID { + // utils.SendErrorResponse(w, http.StatusForbidden, "Instance not found") + // postLog.Error(fmt.Sprintf("[StopInstanceHandler] User %d tried to stop instance %d that does not belong to them", userID, instanceID)) + // return + // } initType := sys.GetInitSystem() serviceName, err := database.GetServiceNameByInstanceID(instanceID) @@ -781,7 +781,7 @@ func RestartInstanceHandler(w http.ResponseWriter, r *http.Request) { return } - instance, err := database.DBQueryFrpcInstanceByID(instanceID) + // instance, err := database.DBQueryFrpcInstanceByID(instanceID) if err == sql.ErrNoRows { utils.SendErrorResponse(w, http.StatusNotFound, "Instance not found") postLog.Error(fmt.Sprintf("[RestartInstanceHandler] User %d tried to restart a not existed instance: %d", userID, instanceID)) @@ -793,11 +793,11 @@ func RestartInstanceHandler(w http.ResponseWriter, r *http.Request) { return } - if instance.UserID != userID { - utils.SendErrorResponse(w, http.StatusForbidden, "Instance not found") - postLog.Error(fmt.Sprintf("[RestartInstanceHandler] User %d tried to restart instance %d that does not belong to them", userID, instanceID)) - return - } + // if instance.UserID != userID { + // utils.SendErrorResponse(w, http.StatusForbidden, "Instance not found") + // postLog.Error(fmt.Sprintf("[RestartInstanceHandler] User %d tried to restart instance %d that does not belong to them", userID, instanceID)) + // return + // } initType := sys.GetInitSystem() sysName, err := database.GetServiceNameByInstanceID(instanceID)