Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Account linking #158

Merged
merged 30 commits into from
Sep 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
464c894
up to speed iwth in mem db
rishabhpoddar Jul 25, 2023
facbb1e
bug fix
rishabhpoddar Jul 26, 2023
11f8efd
adds link account function
rishabhpoddar Jul 26, 2023
5326019
removes unneeded index
rishabhpoddar Jul 26, 2023
b3d1ae1
Account linking function changes (#136)
rishabhpoddar Jul 27, 2023
2a2e739
Link accounts (#137)
rishabhpoddar Jul 28, 2023
ba04b9b
updates to function (#138)
rishabhpoddar Jul 31, 2023
bd79377
Account linking unlink accounts (#139)
rishabhpoddar Jul 31, 2023
0663081
fixes and adds test (#140)
rishabhpoddar Aug 2, 2023
cd412d5
changes for password reset flow (#141)
rishabhpoddar Aug 4, 2023
0287cd0
Account linking update email (#142)
rishabhpoddar Aug 4, 2023
e2a3e79
removes unneeded function
rishabhpoddar Aug 4, 2023
feba629
adds recipe user id in session (#143)
rishabhpoddar Aug 5, 2023
7d2fd5e
fixes query (#144)
rishabhpoddar Aug 5, 2023
b4bc77c
fix: user pagination (#145)
sattvikc Aug 16, 2023
7f59c37
fix: plugin interface fix (#146)
sattvikc Aug 24, 2023
1f43f89
fix: External userid (#147)
sattvikc Aug 25, 2023
dc61ea9
fix: remove UserInfo class (#148)
sattvikc Aug 26, 2023
01fb095
fix: multitenant user association with account linking (#149)
sattvikc Aug 31, 2023
b5a3c9a
fix: remove con reuse (#150)
sattvikc Sep 6, 2023
70e2c51
fix: index updates (#152)
sattvikc Sep 7, 2023
61ee9ae
fix: fkey constraint for primary_or_recipe_user_id (#153)
sattvikc Sep 7, 2023
5f3a57d
fix: account linking stats (#154)
sattvikc Sep 7, 2023
4489982
fix: fixing tenant association
sattvikc Sep 11, 2023
0983e4a
Merge pull request #155 from supertokens/al-misc-changes
porcellus Sep 11, 2023
397a8ed
fix: allow user disassociation from all tenant (#156)
sattvikc Sep 12, 2023
aa0d3f2
fix: useridmapping functions (#157)
sattvikc Sep 15, 2023
0edc4a4
fix: version and changelog
sattvikc Sep 19, 2023
f0b54ff
fix: version and changelog
sattvikc Sep 19, 2023
55707f1
fix: time joined fix
sattvikc Sep 20, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
91 changes: 91 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,97 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

## [5.0.0] - 2023-09-19

### Changes

- Support for Account Linking
- Adds columns `primary_or_recipe_user_id`, `is_linked_or_is_a_primary_user` and `primary_or_recipe_user_time_joined` to `all_auth_recipe_users` table
- Adds columns `primary_or_recipe_user_id` and `is_linked_or_is_a_primary_user` to `app_id_to_user_id` table
- Removes index `all_auth_recipe_users_pagination_index` and addes `all_auth_recipe_users_pagination_index1`,
`all_auth_recipe_users_pagination_index2`, `all_auth_recipe_users_pagination_index3` and
`all_auth_recipe_users_pagination_index4` indexes instead on `all_auth_recipe_users` table
- Adds `all_auth_recipe_users_recipe_id_index` on `all_auth_recipe_users` table
- Adds `all_auth_recipe_users_primary_user_id_index` on `all_auth_recipe_users` table
- Adds `email` column to `emailpassword_pswd_reset_tokens` table
- Changes `user_id` foreign key constraint on `emailpassword_pswd_reset_tokens` to `app_id_to_user_id` table

### Migration

1. Ensure that the core is already upgraded to the version 6.0.13 (CDI version 3.0)
2. Stop the core instance(s)
3. Run the migration script
```sql
ALTER TABLE all_auth_recipe_users
ADD COLUMN primary_or_recipe_user_id CHAR(36) NOT NULL DEFAULT ('0');

ALTER TABLE all_auth_recipe_users
ADD COLUMN is_linked_or_is_a_primary_user BOOLEAN NOT NULL DEFAULT FALSE;

ALTER TABLE all_auth_recipe_users
ADD COLUMN primary_or_recipe_user_time_joined BIGINT NOT NULL DEFAULT 0;

UPDATE all_auth_recipe_users
SET primary_or_recipe_user_id = user_id
WHERE primary_or_recipe_user_id = '0';

UPDATE all_auth_recipe_users
SET primary_or_recipe_user_time_joined = time_joined
WHERE primary_or_recipe_user_time_joined = 0;

ALTER TABLE all_auth_recipe_users
ADD CONSTRAINT all_auth_recipe_users_primary_or_recipe_user_id_fkey
FOREIGN KEY (app_id, primary_or_recipe_user_id)
REFERENCES app_id_to_user_id (app_id, user_id) ON DELETE CASCADE;

ALTER TABLE all_auth_recipe_users
ALTER primary_or_recipe_user_id DROP DEFAULT;

ALTER TABLE app_id_to_user_id
ADD COLUMN primary_or_recipe_user_id CHAR(36) NOT NULL DEFAULT ('0');

ALTER TABLE app_id_to_user_id
ADD COLUMN is_linked_or_is_a_primary_user BOOLEAN NOT NULL DEFAULT FALSE;

UPDATE app_id_to_user_id
SET primary_or_recipe_user_id = user_id
WHERE primary_or_recipe_user_id = '0';

ALTER TABLE app_id_to_user_id
ADD CONSTRAINT app_id_to_user_id_primary_or_recipe_user_id_fkey
FOREIGN KEY (app_id, primary_or_recipe_user_id)
REFERENCES app_id_to_user_id (app_id, user_id) ON DELETE CASCADE;

ALTER TABLE app_id_to_user_id
ALTER primary_or_recipe_user_id DROP DEFAULT;

DROP INDEX all_auth_recipe_users_pagination_index;

CREATE INDEX all_auth_recipe_users_pagination_index1 ON all_auth_recipe_users (
app_id, tenant_id, primary_or_recipe_user_time_joined DESC, primary_or_recipe_user_id DESC);

CREATE INDEX all_auth_recipe_users_pagination_index2 ON all_auth_recipe_users (
app_id, tenant_id, primary_or_recipe_user_time_joined ASC, primary_or_recipe_user_id DESC);

CREATE INDEX all_auth_recipe_users_pagination_index3 ON all_auth_recipe_users (
recipe_id, app_id, tenant_id, primary_or_recipe_user_time_joined DESC, primary_or_recipe_user_id DESC);

CREATE INDEX all_auth_recipe_users_pagination_index4 ON all_auth_recipe_users (
recipe_id, app_id, tenant_id, primary_or_recipe_user_time_joined ASC, primary_or_recipe_user_id DESC);

CREATE INDEX all_auth_recipe_users_primary_user_id_index ON all_auth_recipe_users (primary_or_recipe_user_id, app_id);

CREATE INDEX all_auth_recipe_users_recipe_id_index ON all_auth_recipe_users (app_id, recipe_id, tenant_id);

ALTER TABLE emailpassword_pswd_reset_tokens DROP CONSTRAINT IF EXISTS emailpassword_pswd_reset_tokens_user_id_fkey;

ALTER TABLE emailpassword_pswd_reset_tokens ADD CONSTRAINT emailpassword_pswd_reset_tokens_user_id_fkey FOREIGN KEY (app_id, user_id) REFERENCES app_id_to_user_id (app_id, user_id) ON DELETE CASCADE;

ALTER TABLE emailpassword_pswd_reset_tokens ADD COLUMN email VARCHAR(256);
```
4. Run the new instance(s) of the core (version 7.0.0)


## [4.0.2]

- Fixes null pointer issue when user belongs to no tenant.
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ plugins {
id 'java-library'
}

version = "4.0.2"
version = "5.0.0"

repositories {
mavenCentral()
Expand Down
Binary file removed jar/postgresql-plugin-4.0.2.jar
Binary file not shown.
Binary file added jar/postgresql-plugin-5.0.0.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion pluginInterfaceSupported.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"_comment": "contains a list of plugin interfaces branch names that this core supports",
"versions": [
"3.0"
"4.0"
]
}
Loading
Loading