mirror of
https://github.com/open-reception/appointment-booking-software.git
synced 2026-09-28 03:34:50 +02:00
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:
@@ -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";
|
||||
|
||||
Reference in New Issue
Block a user