From 098096fb15b39dac3768d01bc87c5d4a951503ed Mon Sep 17 00:00:00 2001 From: Joel Coutinho Date: Wed, 1 Feb 2023 13:48:51 +0530 Subject: [PATCH 01/16] feat: adds functions for dashboard APIs --- .../dashabord/DashboardStorage.java | 20 +++++++++++++ .../dashabord/DashboardUser.java | 29 +++++++++++++++++++ 2 files changed, 49 insertions(+) create mode 100644 src/main/java/io/supertokens/pluginInterface/dashabord/DashboardStorage.java create mode 100644 src/main/java/io/supertokens/pluginInterface/dashabord/DashboardUser.java diff --git a/src/main/java/io/supertokens/pluginInterface/dashabord/DashboardStorage.java b/src/main/java/io/supertokens/pluginInterface/dashabord/DashboardStorage.java new file mode 100644 index 00000000..fd1a0d3f --- /dev/null +++ b/src/main/java/io/supertokens/pluginInterface/dashabord/DashboardStorage.java @@ -0,0 +1,20 @@ +package io.supertokens.pluginInterface.dashabord; + +import io.supertokens.pluginInterface.Storage; +import io.supertokens.pluginInterface.emailpassword.UserInfo; +import io.supertokens.pluginInterface.emailpassword.exceptions.DuplicateEmailException; +import io.supertokens.pluginInterface.emailpassword.exceptions.DuplicateUserIdException; +import io.supertokens.pluginInterface.exceptions.StorageQueryException; + +public interface DashboardStorage extends Storage { + + void createNewDashboardUser(DashboardUser userInfo) throws StorageQueryException, DuplicateUserIdException, DuplicateEmailException; + + DashboardUser getDashboardUserByEmail(String email) throws StorageQueryException; + + DashboardStorage[] getAllUsers() throws StorageQueryException; + + void deleteUserWithEmail() throws StorageQueryException; + + void deleteUserWithUserId() throws StorageQueryException; +} diff --git a/src/main/java/io/supertokens/pluginInterface/dashabord/DashboardUser.java b/src/main/java/io/supertokens/pluginInterface/dashabord/DashboardUser.java new file mode 100644 index 00000000..52ab7a78 --- /dev/null +++ b/src/main/java/io/supertokens/pluginInterface/dashabord/DashboardUser.java @@ -0,0 +1,29 @@ +package io.supertokens.pluginInterface.dashabord; + +public class DashboardUser { + public final String email; + public boolean isSuspended; + public String id; + public long timeJoined; + + // using transient, we tell Gson not to include this when creating a JSON + public transient final String passwordHash; + + public DashboardUser(String id, String email, String passwordHash, long timeJoined, boolean isSuspended) { + this.id = id; + this.timeJoined = timeJoined; + this.email = email; + this.passwordHash = passwordHash; + this.isSuspended = isSuspended; + } + + public boolean equals(Object other) { + if (other instanceof DashboardUser) { + DashboardUser otherUserInfo = (DashboardUser) other; + return otherUserInfo.email.equals(this.email) && otherUserInfo.passwordHash.equals(this.passwordHash) + && otherUserInfo.id.equals(this.id) && otherUserInfo.timeJoined == this.timeJoined + && otherUserInfo.isSuspended == this.isSuspended; + } + return false; + } +} From 40fbb5e78b5051456ddcb71d184242df30170246 Mon Sep 17 00:00:00 2001 From: Joel Coutinho Date: Wed, 1 Feb 2023 17:26:51 +0530 Subject: [PATCH 02/16] fixes --- .../pluginInterface/dashabord/DashboardStorage.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/main/java/io/supertokens/pluginInterface/dashabord/DashboardStorage.java b/src/main/java/io/supertokens/pluginInterface/dashabord/DashboardStorage.java index fd1a0d3f..fba0c951 100644 --- a/src/main/java/io/supertokens/pluginInterface/dashabord/DashboardStorage.java +++ b/src/main/java/io/supertokens/pluginInterface/dashabord/DashboardStorage.java @@ -1,7 +1,6 @@ package io.supertokens.pluginInterface.dashabord; import io.supertokens.pluginInterface.Storage; -import io.supertokens.pluginInterface.emailpassword.UserInfo; import io.supertokens.pluginInterface.emailpassword.exceptions.DuplicateEmailException; import io.supertokens.pluginInterface.emailpassword.exceptions.DuplicateUserIdException; import io.supertokens.pluginInterface.exceptions.StorageQueryException; @@ -12,7 +11,7 @@ public interface DashboardStorage extends Storage { DashboardUser getDashboardUserByEmail(String email) throws StorageQueryException; - DashboardStorage[] getAllUsers() throws StorageQueryException; + DashboardUser[] getAllDashboardUsers() throws StorageQueryException; void deleteUserWithEmail() throws StorageQueryException; From cc569d41fe9715f7e5fbd9c07a075b1a9ff08099 Mon Sep 17 00:00:00 2001 From: Joel Coutinho Date: Wed, 1 Feb 2023 18:22:22 +0530 Subject: [PATCH 03/16] updates interface --- .../pluginInterface/dashabord/DashboardStorage.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/io/supertokens/pluginInterface/dashabord/DashboardStorage.java b/src/main/java/io/supertokens/pluginInterface/dashabord/DashboardStorage.java index fba0c951..001e9374 100644 --- a/src/main/java/io/supertokens/pluginInterface/dashabord/DashboardStorage.java +++ b/src/main/java/io/supertokens/pluginInterface/dashabord/DashboardStorage.java @@ -13,7 +13,7 @@ public interface DashboardStorage extends Storage { DashboardUser[] getAllDashboardUsers() throws StorageQueryException; - void deleteUserWithEmail() throws StorageQueryException; + boolean deleteDashboardUserWithEmail(String email) throws StorageQueryException; - void deleteUserWithUserId() throws StorageQueryException; + boolean deleteDashboardUserWithUserId(String userId) throws StorageQueryException; } From e200b65e5de818e7bb81f0d0ef2b2b896c8fb812 Mon Sep 17 00:00:00 2001 From: Joel Coutinho Date: Thu, 2 Feb 2023 12:40:33 +0530 Subject: [PATCH 04/16] fixes --- .../{dashabord => dashboard}/DashboardStorage.java | 8 ++++++-- .../{dashabord => dashboard}/DashboardUser.java | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) rename src/main/java/io/supertokens/pluginInterface/{dashabord => dashboard}/DashboardStorage.java (71%) rename src/main/java/io/supertokens/pluginInterface/{dashabord => dashboard}/DashboardUser.java (95%) diff --git a/src/main/java/io/supertokens/pluginInterface/dashabord/DashboardStorage.java b/src/main/java/io/supertokens/pluginInterface/dashboard/DashboardStorage.java similarity index 71% rename from src/main/java/io/supertokens/pluginInterface/dashabord/DashboardStorage.java rename to src/main/java/io/supertokens/pluginInterface/dashboard/DashboardStorage.java index 001e9374..24fab55c 100644 --- a/src/main/java/io/supertokens/pluginInterface/dashabord/DashboardStorage.java +++ b/src/main/java/io/supertokens/pluginInterface/dashboard/DashboardStorage.java @@ -1,4 +1,4 @@ -package io.supertokens.pluginInterface.dashabord; +package io.supertokens.pluginInterface.dashboard; import io.supertokens.pluginInterface.Storage; import io.supertokens.pluginInterface.emailpassword.exceptions.DuplicateEmailException; @@ -15,5 +15,9 @@ public interface DashboardStorage extends Storage { boolean deleteDashboardUserWithEmail(String email) throws StorageQueryException; - boolean deleteDashboardUserWithUserId(String userId) throws StorageQueryException; + boolean deleteDashboardUserWithUserId(String userId) throws StorageQueryException; + + void updateDashboardUserWithEmail(String email, String newEmail, String newPassword) throws StorageQueryException; + + void updateDashboardUserWithUserId(String userId, String newEmail, String newPassword) throws StorageQueryException; } diff --git a/src/main/java/io/supertokens/pluginInterface/dashabord/DashboardUser.java b/src/main/java/io/supertokens/pluginInterface/dashboard/DashboardUser.java similarity index 95% rename from src/main/java/io/supertokens/pluginInterface/dashabord/DashboardUser.java rename to src/main/java/io/supertokens/pluginInterface/dashboard/DashboardUser.java index 52ab7a78..2bdb78e5 100644 --- a/src/main/java/io/supertokens/pluginInterface/dashabord/DashboardUser.java +++ b/src/main/java/io/supertokens/pluginInterface/dashboard/DashboardUser.java @@ -1,4 +1,4 @@ -package io.supertokens.pluginInterface.dashabord; +package io.supertokens.pluginInterface.dashboard; public class DashboardUser { public final String email; From 320446cc887caa97ff5104551a60bc4afa51193a Mon Sep 17 00:00:00 2001 From: Joel Coutinho Date: Fri, 3 Feb 2023 12:59:44 +0530 Subject: [PATCH 05/16] fixes --- .../java/io/supertokens/pluginInterface/RECIPE_ID.java | 2 +- .../pluginInterface/dashboard/DashboardStorage.java | 9 +++++---- .../dashboard/exceptions/DashboardException.java | 6 ++++++ .../dashboard/exceptions/DuplicateEmailException.java | 6 ++++++ .../dashboard/exceptions/DuplicateUserIdException.java | 5 +++++ 5 files changed, 23 insertions(+), 5 deletions(-) create mode 100644 src/main/java/io/supertokens/pluginInterface/dashboard/exceptions/DashboardException.java create mode 100644 src/main/java/io/supertokens/pluginInterface/dashboard/exceptions/DuplicateEmailException.java create mode 100644 src/main/java/io/supertokens/pluginInterface/dashboard/exceptions/DuplicateUserIdException.java diff --git a/src/main/java/io/supertokens/pluginInterface/RECIPE_ID.java b/src/main/java/io/supertokens/pluginInterface/RECIPE_ID.java index 4a78392f..2e4aa263 100644 --- a/src/main/java/io/supertokens/pluginInterface/RECIPE_ID.java +++ b/src/main/java/io/supertokens/pluginInterface/RECIPE_ID.java @@ -21,7 +21,7 @@ public enum RECIPE_ID { EMAIL_PASSWORD("emailpassword"), THIRD_PARTY("thirdparty"), SESSION("session"), EMAIL_VERIFICATION("emailverification"), JWT("jwt"), PASSWORDLESS("passwordless"), USER_METADATA("usermetadata"), - USER_ROLES("userroles"), USER_ID_MAPPING("useridmapping"); + USER_ROLES("userroles"), USER_ID_MAPPING("useridmapping"), DASHBOARD("dashboard"); private final String name; diff --git a/src/main/java/io/supertokens/pluginInterface/dashboard/DashboardStorage.java b/src/main/java/io/supertokens/pluginInterface/dashboard/DashboardStorage.java index 24fab55c..3a9a7ce0 100644 --- a/src/main/java/io/supertokens/pluginInterface/dashboard/DashboardStorage.java +++ b/src/main/java/io/supertokens/pluginInterface/dashboard/DashboardStorage.java @@ -1,9 +1,10 @@ package io.supertokens.pluginInterface.dashboard; import io.supertokens.pluginInterface.Storage; -import io.supertokens.pluginInterface.emailpassword.exceptions.DuplicateEmailException; -import io.supertokens.pluginInterface.emailpassword.exceptions.DuplicateUserIdException; import io.supertokens.pluginInterface.exceptions.StorageQueryException; +import io.supertokens.pluginInterface.dashboard.exceptions.DuplicateEmailException; +import io.supertokens.pluginInterface.dashboard.exceptions.DuplicateUserIdException; + public interface DashboardStorage extends Storage { @@ -17,7 +18,7 @@ public interface DashboardStorage extends Storage { boolean deleteDashboardUserWithUserId(String userId) throws StorageQueryException; - void updateDashboardUserWithEmail(String email, String newEmail, String newPassword) throws StorageQueryException; + void updateDashboardUserWithEmail(String email, String newEmail, String newPassword) throws StorageQueryException, DuplicateEmailException; - void updateDashboardUserWithUserId(String userId, String newEmail, String newPassword) throws StorageQueryException; + void updateDashboardUserWithUserId(String userId, String newEmail, String newPassword) throws StorageQueryException, DuplicateEmailException; } diff --git a/src/main/java/io/supertokens/pluginInterface/dashboard/exceptions/DashboardException.java b/src/main/java/io/supertokens/pluginInterface/dashboard/exceptions/DashboardException.java new file mode 100644 index 00000000..8625bc5a --- /dev/null +++ b/src/main/java/io/supertokens/pluginInterface/dashboard/exceptions/DashboardException.java @@ -0,0 +1,6 @@ +package io.supertokens.pluginInterface.dashboard.exceptions; + +public class DashboardException extends Exception { + private static final long serialVersionUID = -8913929332291559225L; + +} diff --git a/src/main/java/io/supertokens/pluginInterface/dashboard/exceptions/DuplicateEmailException.java b/src/main/java/io/supertokens/pluginInterface/dashboard/exceptions/DuplicateEmailException.java new file mode 100644 index 00000000..aca6ddff --- /dev/null +++ b/src/main/java/io/supertokens/pluginInterface/dashboard/exceptions/DuplicateEmailException.java @@ -0,0 +1,6 @@ +package io.supertokens.pluginInterface.dashboard.exceptions; + +public class DuplicateEmailException extends DashboardException{ + private static final long serialVersionUID = -5348162233516164406L; + +} diff --git a/src/main/java/io/supertokens/pluginInterface/dashboard/exceptions/DuplicateUserIdException.java b/src/main/java/io/supertokens/pluginInterface/dashboard/exceptions/DuplicateUserIdException.java new file mode 100644 index 00000000..38c982e3 --- /dev/null +++ b/src/main/java/io/supertokens/pluginInterface/dashboard/exceptions/DuplicateUserIdException.java @@ -0,0 +1,5 @@ +package io.supertokens.pluginInterface.dashboard.exceptions; + +public class DuplicateUserIdException extends DashboardException { + private static final long serialVersionUID = -7629139375718589642L; +} From c62cf2a35073eaf479b740ab1aedd3fb859df63d Mon Sep 17 00:00:00 2001 From: Joel Coutinho Date: Fri, 3 Feb 2023 14:14:27 +0530 Subject: [PATCH 06/16] updates dashboard interface --- .../dashboard/DashboardStorage.java | 3 --- .../sqlStorage/DashboardSQLStorage.java | 19 +++++++++++++++++++ 2 files changed, 19 insertions(+), 3 deletions(-) create mode 100644 src/main/java/io/supertokens/pluginInterface/dashboard/sqlStorage/DashboardSQLStorage.java diff --git a/src/main/java/io/supertokens/pluginInterface/dashboard/DashboardStorage.java b/src/main/java/io/supertokens/pluginInterface/dashboard/DashboardStorage.java index 3a9a7ce0..1a157622 100644 --- a/src/main/java/io/supertokens/pluginInterface/dashboard/DashboardStorage.java +++ b/src/main/java/io/supertokens/pluginInterface/dashboard/DashboardStorage.java @@ -17,8 +17,5 @@ public interface DashboardStorage extends Storage { boolean deleteDashboardUserWithEmail(String email) throws StorageQueryException; boolean deleteDashboardUserWithUserId(String userId) throws StorageQueryException; - - void updateDashboardUserWithEmail(String email, String newEmail, String newPassword) throws StorageQueryException, DuplicateEmailException; - void updateDashboardUserWithUserId(String userId, String newEmail, String newPassword) throws StorageQueryException, DuplicateEmailException; } diff --git a/src/main/java/io/supertokens/pluginInterface/dashboard/sqlStorage/DashboardSQLStorage.java b/src/main/java/io/supertokens/pluginInterface/dashboard/sqlStorage/DashboardSQLStorage.java new file mode 100644 index 00000000..4f2edb28 --- /dev/null +++ b/src/main/java/io/supertokens/pluginInterface/dashboard/sqlStorage/DashboardSQLStorage.java @@ -0,0 +1,19 @@ +package io.supertokens.pluginInterface.dashboard.sqlStorage; + +import io.supertokens.pluginInterface.dashboard.DashboardStorage; +import io.supertokens.pluginInterface.dashboard.exceptions.DuplicateEmailException; +import io.supertokens.pluginInterface.exceptions.StorageQueryException; +import io.supertokens.pluginInterface.sqlStorage.SQLStorage; +import io.supertokens.pluginInterface.sqlStorage.TransactionConnection; + +public interface DashboardSQLStorage extends DashboardStorage, SQLStorage { + + void updateDashboardUsersEmailWithEmail_Transaction(TransactionConnection con, String email, String newEmail) throws StorageQueryException, DuplicateEmailException; + + void updateDashboardUsersPasswordWithEmail_Transaction(TransactionConnection con, String email, String newPassword) throws StorageQueryException; + + void updateDashboardUsersEmailWithUserId_Transaction(TransactionConnection con, String userId, String newEmail) throws StorageQueryException, DuplicateEmailException; + + void updateDashboardUsersPasswordWithUserId_Transaction(TransactionConnection con, String userId, String newPassword) throws StorageQueryException; + +} \ No newline at end of file From 55a5915bf74a0e565ed9b81499c91fbed9115a66 Mon Sep 17 00:00:00 2001 From: Joel Coutinho Date: Tue, 7 Feb 2023 13:43:01 +0530 Subject: [PATCH 07/16] removes isSuspended param from Dashboard users --- .../pluginInterface/dashboard/DashboardStorage.java | 5 +++++ .../pluginInterface/dashboard/DashboardUser.java | 7 ++----- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/main/java/io/supertokens/pluginInterface/dashboard/DashboardStorage.java b/src/main/java/io/supertokens/pluginInterface/dashboard/DashboardStorage.java index 1a157622..3a4b8f6e 100644 --- a/src/main/java/io/supertokens/pluginInterface/dashboard/DashboardStorage.java +++ b/src/main/java/io/supertokens/pluginInterface/dashboard/DashboardStorage.java @@ -18,4 +18,9 @@ public interface DashboardStorage extends Storage { boolean deleteDashboardUserWithUserId(String userId) throws StorageQueryException; + String[] getAllSessionsForUserId(String userId) throws StorageQueryException; + + void revokeSessionsWithUserId(String userId) throws StorageQueryException; + + void revokeSessionWithSessionId(String sessionId) throws StorageQueryException; } diff --git a/src/main/java/io/supertokens/pluginInterface/dashboard/DashboardUser.java b/src/main/java/io/supertokens/pluginInterface/dashboard/DashboardUser.java index 2bdb78e5..17df1e2a 100644 --- a/src/main/java/io/supertokens/pluginInterface/dashboard/DashboardUser.java +++ b/src/main/java/io/supertokens/pluginInterface/dashboard/DashboardUser.java @@ -2,27 +2,24 @@ public class DashboardUser { public final String email; - public boolean isSuspended; public String id; public long timeJoined; // using transient, we tell Gson not to include this when creating a JSON public transient final String passwordHash; - public DashboardUser(String id, String email, String passwordHash, long timeJoined, boolean isSuspended) { + public DashboardUser(String id, String email, String passwordHash, long timeJoined) { this.id = id; this.timeJoined = timeJoined; this.email = email; this.passwordHash = passwordHash; - this.isSuspended = isSuspended; } public boolean equals(Object other) { if (other instanceof DashboardUser) { DashboardUser otherUserInfo = (DashboardUser) other; return otherUserInfo.email.equals(this.email) && otherUserInfo.passwordHash.equals(this.passwordHash) - && otherUserInfo.id.equals(this.id) && otherUserInfo.timeJoined == this.timeJoined - && otherUserInfo.isSuspended == this.isSuspended; + && otherUserInfo.id.equals(this.id) && otherUserInfo.timeJoined == this.timeJoined; } return false; } From ac5a013d7a5a83bb18cfb2306c2e6106cdf25ddc Mon Sep 17 00:00:00 2001 From: Joel Coutinho Date: Tue, 7 Feb 2023 15:23:02 +0530 Subject: [PATCH 08/16] additional updates due to changes in the API spec --- .../dashboard/DashboardSessionInfo.java | 22 +++++++++++++++++++ .../dashboard/DashboardStorage.java | 6 ++++- .../dashboard/DashboardUser.java | 8 +++---- 3 files changed, 31 insertions(+), 5 deletions(-) create mode 100644 src/main/java/io/supertokens/pluginInterface/dashboard/DashboardSessionInfo.java diff --git a/src/main/java/io/supertokens/pluginInterface/dashboard/DashboardSessionInfo.java b/src/main/java/io/supertokens/pluginInterface/dashboard/DashboardSessionInfo.java new file mode 100644 index 00000000..072a38c4 --- /dev/null +++ b/src/main/java/io/supertokens/pluginInterface/dashboard/DashboardSessionInfo.java @@ -0,0 +1,22 @@ +package io.supertokens.pluginInterface.dashboard; + +public class DashboardSessionInfo { + public String userId; + public String sessionId; + public long timeCreated; + + public DashboardSessionInfo(String userId, String sessionId, long timeCreated) { + this.userId = userId; + this.sessionId = sessionId; + this.timeCreated = timeCreated; + } + + public boolean equals(Object other) { + if (other instanceof DashboardSessionInfo) { + DashboardSessionInfo otherSessionInfo = (DashboardSessionInfo) other; + return otherSessionInfo.userId.equals(this.userId) && otherSessionInfo.timeCreated == this.timeCreated + && otherSessionInfo.sessionId.equals(this.sessionId); + } + return false; + } +} \ No newline at end of file diff --git a/src/main/java/io/supertokens/pluginInterface/dashboard/DashboardStorage.java b/src/main/java/io/supertokens/pluginInterface/dashboard/DashboardStorage.java index 3a4b8f6e..88f48341 100644 --- a/src/main/java/io/supertokens/pluginInterface/dashboard/DashboardStorage.java +++ b/src/main/java/io/supertokens/pluginInterface/dashboard/DashboardStorage.java @@ -17,8 +17,12 @@ public interface DashboardStorage extends Storage { boolean deleteDashboardUserWithEmail(String email) throws StorageQueryException; boolean deleteDashboardUserWithUserId(String userId) throws StorageQueryException; + + void createNewDashboardUserSession(String userId, String sessionId, long timeJoined) throws StorageQueryException; - String[] getAllSessionsForUserId(String userId) throws StorageQueryException; + DashboardSessionInfo[] getAllSessionsForUserId(String userId) throws StorageQueryException; + + DashboardSessionInfo getSessionInfoWithSessionId(String sessionId) throws StorageQueryException; void revokeSessionsWithUserId(String userId) throws StorageQueryException; diff --git a/src/main/java/io/supertokens/pluginInterface/dashboard/DashboardUser.java b/src/main/java/io/supertokens/pluginInterface/dashboard/DashboardUser.java index 17df1e2a..a1686140 100644 --- a/src/main/java/io/supertokens/pluginInterface/dashboard/DashboardUser.java +++ b/src/main/java/io/supertokens/pluginInterface/dashboard/DashboardUser.java @@ -2,14 +2,14 @@ public class DashboardUser { public final String email; - public String id; + public String userId; public long timeJoined; // using transient, we tell Gson not to include this when creating a JSON public transient final String passwordHash; - public DashboardUser(String id, String email, String passwordHash, long timeJoined) { - this.id = id; + public DashboardUser(String userId, String email, String passwordHash, long timeJoined) { + this.userId = userId; this.timeJoined = timeJoined; this.email = email; this.passwordHash = passwordHash; @@ -19,7 +19,7 @@ public boolean equals(Object other) { if (other instanceof DashboardUser) { DashboardUser otherUserInfo = (DashboardUser) other; return otherUserInfo.email.equals(this.email) && otherUserInfo.passwordHash.equals(this.passwordHash) - && otherUserInfo.id.equals(this.id) && otherUserInfo.timeJoined == this.timeJoined; + && otherUserInfo.userId.equals(this.userId) && otherUserInfo.timeJoined == this.timeJoined; } return false; } From 079e7835dcb147fc6c418399ad1df2e05fc5fbb4 Mon Sep 17 00:00:00 2001 From: Joel Coutinho Date: Wed, 8 Feb 2023 16:42:31 +0530 Subject: [PATCH 09/16] implements feedback --- .../pluginInterface/dashboard/DashboardSessionInfo.java | 6 ++++-- .../pluginInterface/dashboard/DashboardStorage.java | 8 ++++---- .../dashboard/exceptions/UserIdNotFoundException.java | 5 +++++ .../dashboard/sqlStorage/DashboardSQLStorage.java | 4 ---- 4 files changed, 13 insertions(+), 10 deletions(-) create mode 100644 src/main/java/io/supertokens/pluginInterface/dashboard/exceptions/UserIdNotFoundException.java diff --git a/src/main/java/io/supertokens/pluginInterface/dashboard/DashboardSessionInfo.java b/src/main/java/io/supertokens/pluginInterface/dashboard/DashboardSessionInfo.java index 072a38c4..980418b3 100644 --- a/src/main/java/io/supertokens/pluginInterface/dashboard/DashboardSessionInfo.java +++ b/src/main/java/io/supertokens/pluginInterface/dashboard/DashboardSessionInfo.java @@ -4,18 +4,20 @@ public class DashboardSessionInfo { public String userId; public String sessionId; public long timeCreated; + public long expiry; - public DashboardSessionInfo(String userId, String sessionId, long timeCreated) { + public DashboardSessionInfo(String userId, String sessionId, long timeCreated, long expiry) { this.userId = userId; this.sessionId = sessionId; this.timeCreated = timeCreated; + this.expiry = expiry; } public boolean equals(Object other) { if (other instanceof DashboardSessionInfo) { DashboardSessionInfo otherSessionInfo = (DashboardSessionInfo) other; return otherSessionInfo.userId.equals(this.userId) && otherSessionInfo.timeCreated == this.timeCreated - && otherSessionInfo.sessionId.equals(this.sessionId); + && otherSessionInfo.sessionId.equals(this.sessionId) && otherSessionInfo.expiry == this.expiry; } return false; } diff --git a/src/main/java/io/supertokens/pluginInterface/dashboard/DashboardStorage.java b/src/main/java/io/supertokens/pluginInterface/dashboard/DashboardStorage.java index 88f48341..07fd585e 100644 --- a/src/main/java/io/supertokens/pluginInterface/dashboard/DashboardStorage.java +++ b/src/main/java/io/supertokens/pluginInterface/dashboard/DashboardStorage.java @@ -4,7 +4,7 @@ import io.supertokens.pluginInterface.exceptions.StorageQueryException; import io.supertokens.pluginInterface.dashboard.exceptions.DuplicateEmailException; import io.supertokens.pluginInterface.dashboard.exceptions.DuplicateUserIdException; - +import io.supertokens.pluginInterface.dashboard.exceptions.UserIdNotFoundException; public interface DashboardStorage extends Storage { @@ -18,13 +18,13 @@ public interface DashboardStorage extends Storage { boolean deleteDashboardUserWithUserId(String userId) throws StorageQueryException; - void createNewDashboardUserSession(String userId, String sessionId, long timeJoined) throws StorageQueryException; + void createNewDashboardUserSession(String userId, String sessionId, long timeCreated, long expiry) throws StorageQueryException, UserIdNotFoundException; DashboardSessionInfo[] getAllSessionsForUserId(String userId) throws StorageQueryException; DashboardSessionInfo getSessionInfoWithSessionId(String sessionId) throws StorageQueryException; - void revokeSessionsWithUserId(String userId) throws StorageQueryException; - void revokeSessionWithSessionId(String sessionId) throws StorageQueryException; + + void revokeExpiredSessions(long expiry) throws StorageQueryException; } diff --git a/src/main/java/io/supertokens/pluginInterface/dashboard/exceptions/UserIdNotFoundException.java b/src/main/java/io/supertokens/pluginInterface/dashboard/exceptions/UserIdNotFoundException.java new file mode 100644 index 00000000..24ba08cd --- /dev/null +++ b/src/main/java/io/supertokens/pluginInterface/dashboard/exceptions/UserIdNotFoundException.java @@ -0,0 +1,5 @@ +package io.supertokens.pluginInterface.dashboard.exceptions; + +public class UserIdNotFoundException extends DashboardException { + private static final long serialVersionUID = 5010231597247117722L; +} diff --git a/src/main/java/io/supertokens/pluginInterface/dashboard/sqlStorage/DashboardSQLStorage.java b/src/main/java/io/supertokens/pluginInterface/dashboard/sqlStorage/DashboardSQLStorage.java index 4f2edb28..0f37a1a6 100644 --- a/src/main/java/io/supertokens/pluginInterface/dashboard/sqlStorage/DashboardSQLStorage.java +++ b/src/main/java/io/supertokens/pluginInterface/dashboard/sqlStorage/DashboardSQLStorage.java @@ -8,10 +8,6 @@ public interface DashboardSQLStorage extends DashboardStorage, SQLStorage { - void updateDashboardUsersEmailWithEmail_Transaction(TransactionConnection con, String email, String newEmail) throws StorageQueryException, DuplicateEmailException; - - void updateDashboardUsersPasswordWithEmail_Transaction(TransactionConnection con, String email, String newPassword) throws StorageQueryException; - void updateDashboardUsersEmailWithUserId_Transaction(TransactionConnection con, String userId, String newEmail) throws StorageQueryException, DuplicateEmailException; void updateDashboardUsersPasswordWithUserId_Transaction(TransactionConnection con, String userId, String newPassword) throws StorageQueryException; From 375f4550a64d62b8b3c1444cd9f4278f26afe3be Mon Sep 17 00:00:00 2001 From: Joel Coutinho Date: Wed, 8 Feb 2023 16:45:36 +0530 Subject: [PATCH 10/16] removes unnecessary function --- .../supertokens/pluginInterface/dashboard/DashboardStorage.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/main/java/io/supertokens/pluginInterface/dashboard/DashboardStorage.java b/src/main/java/io/supertokens/pluginInterface/dashboard/DashboardStorage.java index 07fd585e..70c28b06 100644 --- a/src/main/java/io/supertokens/pluginInterface/dashboard/DashboardStorage.java +++ b/src/main/java/io/supertokens/pluginInterface/dashboard/DashboardStorage.java @@ -14,8 +14,6 @@ public interface DashboardStorage extends Storage { DashboardUser[] getAllDashboardUsers() throws StorageQueryException; - boolean deleteDashboardUserWithEmail(String email) throws StorageQueryException; - boolean deleteDashboardUserWithUserId(String userId) throws StorageQueryException; void createNewDashboardUserSession(String userId, String sessionId, long timeCreated, long expiry) throws StorageQueryException, UserIdNotFoundException; From a7961f32425bf5ecc0814cd88cc36711c1b344d4 Mon Sep 17 00:00:00 2001 From: Joel Coutinho Date: Fri, 10 Feb 2023 16:48:18 +0530 Subject: [PATCH 11/16] adds additional function --- .../pluginInterface/dashboard/DashboardStorage.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/io/supertokens/pluginInterface/dashboard/DashboardStorage.java b/src/main/java/io/supertokens/pluginInterface/dashboard/DashboardStorage.java index 70c28b06..cdda42e2 100644 --- a/src/main/java/io/supertokens/pluginInterface/dashboard/DashboardStorage.java +++ b/src/main/java/io/supertokens/pluginInterface/dashboard/DashboardStorage.java @@ -12,6 +12,8 @@ public interface DashboardStorage extends Storage { DashboardUser getDashboardUserByEmail(String email) throws StorageQueryException; + DashboardUser getDashboardUserByUserId(String userId) throws StorageQueryException; + DashboardUser[] getAllDashboardUsers() throws StorageQueryException; boolean deleteDashboardUserWithUserId(String userId) throws StorageQueryException; @@ -22,7 +24,7 @@ public interface DashboardStorage extends Storage { DashboardSessionInfo getSessionInfoWithSessionId(String sessionId) throws StorageQueryException; - void revokeSessionWithSessionId(String sessionId) throws StorageQueryException; + boolean revokeSessionWithSessionId(String sessionId) throws StorageQueryException; void revokeExpiredSessions(long expiry) throws StorageQueryException; } From 1b2e761988630a18b85ea43231212e2a0d62a3d5 Mon Sep 17 00:00:00 2001 From: Joel Coutinho Date: Mon, 13 Feb 2023 17:58:17 +0530 Subject: [PATCH 12/16] fixes --- .../supertokens/pluginInterface/dashboard/DashboardStorage.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/io/supertokens/pluginInterface/dashboard/DashboardStorage.java b/src/main/java/io/supertokens/pluginInterface/dashboard/DashboardStorage.java index cdda42e2..f24028b8 100644 --- a/src/main/java/io/supertokens/pluginInterface/dashboard/DashboardStorage.java +++ b/src/main/java/io/supertokens/pluginInterface/dashboard/DashboardStorage.java @@ -26,5 +26,5 @@ public interface DashboardStorage extends Storage { boolean revokeSessionWithSessionId(String sessionId) throws StorageQueryException; - void revokeExpiredSessions(long expiry) throws StorageQueryException; + void revokeExpiredSessions() throws StorageQueryException; } From d5be5ffa4988aae2d21d2149e22f3e9d51c29765 Mon Sep 17 00:00:00 2001 From: Joel Coutinho Date: Tue, 14 Feb 2023 16:28:58 +0530 Subject: [PATCH 13/16] updates --- .../dashboard/sqlStorage/DashboardSQLStorage.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/io/supertokens/pluginInterface/dashboard/sqlStorage/DashboardSQLStorage.java b/src/main/java/io/supertokens/pluginInterface/dashboard/sqlStorage/DashboardSQLStorage.java index 0f37a1a6..1237ea15 100644 --- a/src/main/java/io/supertokens/pluginInterface/dashboard/sqlStorage/DashboardSQLStorage.java +++ b/src/main/java/io/supertokens/pluginInterface/dashboard/sqlStorage/DashboardSQLStorage.java @@ -2,14 +2,15 @@ import io.supertokens.pluginInterface.dashboard.DashboardStorage; import io.supertokens.pluginInterface.dashboard.exceptions.DuplicateEmailException; +import io.supertokens.pluginInterface.dashboard.exceptions.UserIdNotFoundException; import io.supertokens.pluginInterface.exceptions.StorageQueryException; import io.supertokens.pluginInterface.sqlStorage.SQLStorage; import io.supertokens.pluginInterface.sqlStorage.TransactionConnection; public interface DashboardSQLStorage extends DashboardStorage, SQLStorage { - void updateDashboardUsersEmailWithUserId_Transaction(TransactionConnection con, String userId, String newEmail) throws StorageQueryException, DuplicateEmailException; + void updateDashboardUsersEmailWithUserId_Transaction(TransactionConnection con, String userId, String newEmail) throws StorageQueryException, DuplicateEmailException, UserIdNotFoundException; - void updateDashboardUsersPasswordWithUserId_Transaction(TransactionConnection con, String userId, String newPassword) throws StorageQueryException; + void updateDashboardUsersPasswordWithUserId_Transaction(TransactionConnection con, String userId, String newPassword) throws StorageQueryException, UserIdNotFoundException; } \ No newline at end of file From 10c0c083177cb990e6467a4b2c03592135c3d37d Mon Sep 17 00:00:00 2001 From: Joel Coutinho Date: Tue, 21 Feb 2023 14:49:55 +0530 Subject: [PATCH 14/16] updates CHANGELOG.md --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 15ac636f..43ee7f3d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,8 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] +- Dashboard Recipe Interface + ## [2.19.0] - 2022-11-07 - Updates version so that new plugin versions can only be used by new core versions due to dependency changes. From 69e52238fe96bcbd85722fa7db07f5027cbf0ea6 Mon Sep 17 00:00:00 2001 From: Joel Coutinho Date: Tue, 21 Feb 2023 15:06:41 +0530 Subject: [PATCH 15/16] updates CHANGELOG.md --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 43ee7f3d..d389d895 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,8 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] +## [2.20.0] - 2023-02-21 + - Dashboard Recipe Interface ## [2.19.0] - 2022-11-07 From 84f6d3fc19bd64eeb93ee1035842c42165cd12e8 Mon Sep 17 00:00:00 2001 From: Joel Coutinho Date: Tue, 21 Feb 2023 15:08:03 +0530 Subject: [PATCH 16/16] updates version --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 8b0039e1..575d0fdd 100644 --- a/build.gradle +++ b/build.gradle @@ -2,7 +2,7 @@ plugins { id 'java-library' } -version = "2.19.0" +version = "2.20.0" repositories { mavenCentral()