Merge pull request #193 from open-reception/FIX_first_user_should_be_access_granted

First user of tenant gets access granted, regardless of role.
This commit is contained in:
Karl Ludwig Weise
2026-02-03 10:58:32 +01:00
committed by GitHub
+1 -6
View File
@@ -359,12 +359,7 @@ export class UserService {
const numberOfUsers = await centralDb
.select({ count: count() })
.from(centralSchema.user)
.where(
and(
eq(centralSchema.user.tenantId, resultData.tenantId!),
eq(centralSchema.user.role, "TENANT_ADMIN"),
),
);
.where(and(eq(centralSchema.user.tenantId, resultData.tenantId!)));
const shouldGrantAccess = resultData.role === "GLOBAL_ADMIN" || numberOfUsers[0].count === 1;
const confirmationState = shouldGrantAccess ? "ACCESS_GRANTED" : "CONFIRMED";