From 3bdc24477336a378cab6b04dd8e4d9f391cf9111 Mon Sep 17 00:00:00 2001 From: Sattvik Chakravarthy Date: Wed, 13 Sep 2023 13:44:30 +0530 Subject: [PATCH] fix: rename userId to recipeUserId --- .../api/multitenancy/AssociateUserToTenantAPI.java | 9 ++++++++- .../api/multitenancy/DisassociateUserFromTenant.java | 8 +++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/main/java/io/supertokens/webserver/api/multitenancy/AssociateUserToTenantAPI.java b/src/main/java/io/supertokens/webserver/api/multitenancy/AssociateUserToTenantAPI.java index 3eb502dc5..739d182bd 100644 --- a/src/main/java/io/supertokens/webserver/api/multitenancy/AssociateUserToTenantAPI.java +++ b/src/main/java/io/supertokens/webserver/api/multitenancy/AssociateUserToTenantAPI.java @@ -32,6 +32,7 @@ import io.supertokens.pluginInterface.passwordless.exception.DuplicatePhoneNumberException; import io.supertokens.pluginInterface.thirdparty.exception.DuplicateThirdPartyUserException; import io.supertokens.useridmapping.UserIdType; +import io.supertokens.utils.SemVer; import io.supertokens.webserver.InputParser; import io.supertokens.webserver.WebserverAPI; import jakarta.servlet.ServletException; @@ -56,7 +57,13 @@ public String getPath() { @Override protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws IOException, ServletException { JsonObject input = InputParser.parseJsonObjectOrThrowError(req); - String userId = InputParser.parseStringOrThrowError(input, "userId", false); + String userId; + + if (getVersionFromRequest(req).lesserThan(SemVer.v4_0)) { + userId = InputParser.parseStringOrThrowError(input, "userId", false); + } else { + userId = InputParser.parseStringOrThrowError(input, "recipeUserId", false); + } // normalize userId userId = userId.trim(); diff --git a/src/main/java/io/supertokens/webserver/api/multitenancy/DisassociateUserFromTenant.java b/src/main/java/io/supertokens/webserver/api/multitenancy/DisassociateUserFromTenant.java index 9553efa91..a37c3a595 100644 --- a/src/main/java/io/supertokens/webserver/api/multitenancy/DisassociateUserFromTenant.java +++ b/src/main/java/io/supertokens/webserver/api/multitenancy/DisassociateUserFromTenant.java @@ -50,7 +50,13 @@ public String getPath() { @Override protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws IOException, ServletException { JsonObject input = InputParser.parseJsonObjectOrThrowError(req); - String userId = InputParser.parseStringOrThrowError(input, "userId", false); + String userId; + + if (getVersionFromRequest(req).lesserThan(SemVer.v4_0)) { + userId = InputParser.parseStringOrThrowError(input, "userId", false); + } else { + userId = InputParser.parseStringOrThrowError(input, "recipeUserId", false); + } // normalize userId userId = userId.trim();