Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
9 changes: 0 additions & 9 deletions tools/syn2mas/src/advisor.mts
Original file line number Diff line number Diff line change
Expand Up @@ -82,15 +82,6 @@ export async function advisor(): Promise<void> {
return res["count(*)"] as number;
}

const adminUsers = await count(
synapse.count("*").from<SUser>("users").where({ admin: 1 }),
);
if (adminUsers > 0) {
warn(
`Synapse database contains ${adminUsers} admin users which will need to be added to the MAS configuration.`,
);
}

const guestUsers = await count(
synapse.count("*").from<SUser>("users").where({ is_guest: 1 }),
);
Expand Down
5 changes: 4 additions & 1 deletion tools/syn2mas/src/migrate.mts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import type { MCompatRefreshToken } from "./types/MCompatRefreshToken.d.ts";
import type { MCompatSession } from "./types/MCompatSession.d.ts";
import type { MUpstreamOauthLink } from "./types/MUpstreamOauthLink.d.ts";
import type { MUpstreamOauthProvider } from "./types/MUpstreamOauthProvider.d.ts";
import type { MUser } from "./types/MUser.js";
import type { MUserEmail } from "./types/MUserEmail.d.ts";
import type { MUserPassword } from "./types/MUserPassword.d.ts";
import type { SAccessToken } from "./types/SAccessToken.d.ts";
Expand Down Expand Up @@ -207,11 +208,13 @@ export async function migrate(): Promise<void> {
const userCreatedAt = new Date(
Number.parseInt(`${user.creation_ts}`) * 1000,
);
const masUser = {
const masUser: MUser = {
user_id: makeUuid(userCreatedAt),
username: localpart,
created_at: userCreatedAt,
locked_at: user.deactivated === 1 ? userCreatedAt : null,
primary_user_email_id: null,
can_request_admin: user.admin === 1,
};
executions.push(() => mas.insert(masUser).into("users"));
log.debug(`${stringifyAndRedact(user)} => ${stringifyAndRedact(masUser)}`);
Expand Down
4 changes: 3 additions & 1 deletion tools/syn2mas/src/types/MUser.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,7 @@ export interface MUser {
user_id: UUID<MUser>;
username: string; // localpart only without @
created_at: Date;
primary_user_email_id?: UUID<MUserEmail>;
locked_at: Date | null;
primary_user_email_id: UUID<MUserEmail> | null;
can_request_admin: boolean;
}
Loading