mirror of
https://github.com/docmost/docmost.git
synced 2026-05-07 06:23:06 +08:00
scim tokens
This commit is contained in:
@@ -11,9 +11,7 @@ export async function up(db: Kysely<any>): Promise<void> {
|
|||||||
.addColumn('token_last_four', 'varchar(4)', (col) => col.notNull())
|
.addColumn('token_last_four', 'varchar(4)', (col) => col.notNull())
|
||||||
.addColumn('expires_at', 'timestamptz')
|
.addColumn('expires_at', 'timestamptz')
|
||||||
.addColumn('last_used_at', 'timestamptz')
|
.addColumn('last_used_at', 'timestamptz')
|
||||||
.addColumn('is_enabled', 'boolean', (col) =>
|
.addColumn('is_enabled', 'boolean', (col) => col.notNull().defaultTo(true))
|
||||||
col.notNull().defaultTo(true),
|
|
||||||
)
|
|
||||||
.addColumn('creator_id', 'uuid', (col) =>
|
.addColumn('creator_id', 'uuid', (col) =>
|
||||||
col.references('users.id').onDelete('set null'),
|
col.references('users.id').onDelete('set null'),
|
||||||
)
|
)
|
||||||
@@ -66,20 +64,35 @@ export async function up(db: Kysely<any>): Promise<void> {
|
|||||||
.where('scim_external_id', 'is not', null)
|
.where('scim_external_id', 'is not', null)
|
||||||
.unique()
|
.unique()
|
||||||
.execute();
|
.execute();
|
||||||
|
|
||||||
|
await db.schema
|
||||||
|
.alterTable('groups')
|
||||||
|
.addColumn('is_external', 'boolean', (col) =>
|
||||||
|
col.notNull().defaultTo(false),
|
||||||
|
)
|
||||||
|
.execute();
|
||||||
|
|
||||||
|
await db.schema
|
||||||
|
.alterTable('workspaces')
|
||||||
|
.addColumn('is_scim_enabled', 'boolean', (col) =>
|
||||||
|
col.notNull().defaultTo(false),
|
||||||
|
)
|
||||||
|
.execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function down(db: Kysely<any>): Promise<void> {
|
export async function down(db: Kysely<any>): Promise<void> {
|
||||||
await db.schema.dropTable('scim_tokens').execute();
|
await db.schema.dropTable('scim_tokens').execute();
|
||||||
|
|
||||||
await db.schema.dropIndex('idx_users_workspace_scim_external_id').execute();
|
await db.schema.dropIndex('idx_users_workspace_scim_external_id').execute();
|
||||||
await db.schema
|
await db.schema.alterTable('users').dropColumn('scim_external_id').execute();
|
||||||
.alterTable('users')
|
|
||||||
.dropColumn('scim_external_id')
|
|
||||||
.execute();
|
|
||||||
|
|
||||||
await db.schema.dropIndex('idx_groups_workspace_scim_external_id').execute();
|
await db.schema.dropIndex('idx_groups_workspace_scim_external_id').execute();
|
||||||
|
await db.schema.alterTable('groups').dropColumn('scim_external_id').execute();
|
||||||
|
|
||||||
|
await db.schema.alterTable('groups').dropColumn('is_external').execute();
|
||||||
|
|
||||||
await db.schema
|
await db.schema
|
||||||
.alterTable('groups')
|
.alterTable('workspaces')
|
||||||
.dropColumn('scim_external_id')
|
.dropColumn('is_scim_enabled')
|
||||||
.execute();
|
.execute();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ export class GroupRepo {
|
|||||||
'name',
|
'name',
|
||||||
'description',
|
'description',
|
||||||
'isDefault',
|
'isDefault',
|
||||||
|
'isExternal',
|
||||||
'creatorId',
|
'creatorId',
|
||||||
'workspaceId',
|
'workspaceId',
|
||||||
'createdAt',
|
'createdAt',
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ export class WorkspaceRepo {
|
|||||||
'enforceSso',
|
'enforceSso',
|
||||||
'plan',
|
'plan',
|
||||||
'enforceMfa',
|
'enforceMfa',
|
||||||
|
'isScimEnabled',
|
||||||
];
|
];
|
||||||
constructor(@InjectKysely() private readonly db: KyselyDB) {}
|
constructor(@InjectKysely() private readonly db: KyselyDB) {}
|
||||||
|
|
||||||
|
|||||||
+2
@@ -184,6 +184,7 @@ export interface Groups {
|
|||||||
description: string | null;
|
description: string | null;
|
||||||
id: Generated<string>;
|
id: Generated<string>;
|
||||||
isDefault: boolean;
|
isDefault: boolean;
|
||||||
|
isExternal: Generated<boolean>;
|
||||||
name: string;
|
name: string;
|
||||||
scimExternalId: string | null;
|
scimExternalId: string | null;
|
||||||
updatedAt: Generated<Timestamp>;
|
updatedAt: Generated<Timestamp>;
|
||||||
@@ -352,6 +353,7 @@ export interface Workspaces {
|
|||||||
enforceMfa: Generated<boolean | null>;
|
enforceMfa: Generated<boolean | null>;
|
||||||
enforceSso: Generated<boolean>;
|
enforceSso: Generated<boolean>;
|
||||||
hostname: string | null;
|
hostname: string | null;
|
||||||
|
isScimEnabled: Generated<boolean>;
|
||||||
id: Generated<string>;
|
id: Generated<string>;
|
||||||
licenseKey: string | null;
|
licenseKey: string | null;
|
||||||
logo: string | null;
|
logo: string | null;
|
||||||
|
|||||||
Reference in New Issue
Block a user