refacto(*): remove everything about default workspace (#9157)
## Summary - [x] Remove defaultWorkspace in user - [x] Remove all occurrence of defaultWorkspace and defaultWorkspaceId - [x] Improve activate workspace flow - [x] Improve security on social login - [x] Add `ImpersonateGuard` - [x] Allow to use impersonation with couple `User/Workspace` - [x] Prevent unexpected reload on activate workspace - [x] Scope login token with workspaceId Fix https://github.com/twentyhq/twenty/issues/9033#event-15714863042
This commit is contained in:
@ -24,7 +24,6 @@ export const seedUsers = async (
|
||||
'lastName',
|
||||
'email',
|
||||
'passwordHash',
|
||||
'defaultWorkspaceId',
|
||||
])
|
||||
.orIgnore()
|
||||
.values([
|
||||
@ -35,7 +34,6 @@ export const seedUsers = async (
|
||||
email: 'noah@demo.dev',
|
||||
passwordHash:
|
||||
'$2b$10$66d.6DuQExxnrfI9rMqOg.U1XIYpagr6Lv05uoWLYbYmtK0HDIvS6', // Applecar2025
|
||||
defaultWorkspaceId: workspaceId,
|
||||
},
|
||||
{
|
||||
id: DEMO_SEED_USER_IDS.HUGO,
|
||||
@ -44,7 +42,6 @@ export const seedUsers = async (
|
||||
email: 'hugo@demo.dev',
|
||||
passwordHash:
|
||||
'$2b$10$66d.6DuQExxnrfI9rMqOg.U1XIYpagr6Lv05uoWLYbYmtK0HDIvS6', // Applecar2025
|
||||
defaultWorkspaceId: workspaceId,
|
||||
},
|
||||
{
|
||||
id: DEMO_SEED_USER_IDS.TIM,
|
||||
@ -53,7 +50,6 @@ export const seedUsers = async (
|
||||
email: 'tim@apple.dev',
|
||||
passwordHash:
|
||||
'$2b$10$66d.6DuQExxnrfI9rMqOg.U1XIYpagr6Lv05uoWLYbYmtK0HDIvS6', // Applecar2025
|
||||
defaultWorkspaceId: workspaceId,
|
||||
},
|
||||
])
|
||||
.execute();
|
||||
|
||||
@ -24,7 +24,6 @@ export const seedUsers = async (
|
||||
'lastName',
|
||||
'email',
|
||||
'passwordHash',
|
||||
'defaultWorkspaceId',
|
||||
])
|
||||
.orIgnore()
|
||||
.values([
|
||||
@ -35,7 +34,6 @@ export const seedUsers = async (
|
||||
email: 'tim@apple.dev',
|
||||
passwordHash:
|
||||
'$2b$10$66d.6DuQExxnrfI9rMqOg.U1XIYpagr6Lv05uoWLYbYmtK0HDIvS6', // Applecar2025
|
||||
defaultWorkspaceId: workspaceId,
|
||||
},
|
||||
{
|
||||
id: DEV_SEED_USER_IDS.JONY,
|
||||
@ -44,7 +42,6 @@ export const seedUsers = async (
|
||||
email: 'jony.ive@apple.dev',
|
||||
passwordHash:
|
||||
'$2b$10$66d.6DuQExxnrfI9rMqOg.U1XIYpagr6Lv05uoWLYbYmtK0HDIvS6', // Applecar2025
|
||||
defaultWorkspaceId: workspaceId,
|
||||
},
|
||||
{
|
||||
id: DEV_SEED_USER_IDS.PHIL,
|
||||
@ -53,7 +50,6 @@ export const seedUsers = async (
|
||||
email: 'phil.schiler@apple.dev',
|
||||
passwordHash:
|
||||
'$2b$10$66d.6DuQExxnrfI9rMqOg.U1XIYpagr6Lv05uoWLYbYmtK0HDIvS6', // Applecar2025
|
||||
defaultWorkspaceId: workspaceId,
|
||||
},
|
||||
])
|
||||
.execute();
|
||||
|
||||
@ -0,0 +1,25 @@
|
||||
import { MigrationInterface, QueryRunner } from 'typeorm';
|
||||
|
||||
export class RemoveDefaultWorkspaceId1734544295083
|
||||
implements MigrationInterface
|
||||
{
|
||||
name = 'RemoveDefaultWorkspaceId1734544295083';
|
||||
|
||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "core"."user" DROP CONSTRAINT "FK_2ec910029395fa7655621c88908"`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "core"."user" DROP COLUMN "defaultWorkspaceId"`,
|
||||
);
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "core"."user" ADD "defaultWorkspaceId" uuid NOT NULL`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "core"."user" ADD CONSTRAINT "FK_2ec910029395fa7655621c88908" FOREIGN KEY ("defaultWorkspaceId") REFERENCES "core"."workspace"("id") ON DELETE RESTRICT ON UPDATE NO ACTION`,
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user