Allow multiple tenant users to be created for account holders (#15513)

This commit is contained in:
melohagan 2025-02-10 15:18:37 +00:00 committed by GitHub
parent d734da5348
commit 3a956ed309
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5 additions and 1 deletions

View File

@ -264,7 +264,9 @@ export class UserDB {
const creatorsChange =
(await isCreator(dbUser)) !== (await isCreator(user)) ? 1 : 0
return UserDB.quotas.addUsers(change, creatorsChange, async () => {
await validateUniqueUser(email, tenantId)
if (!opts.isAccountHolder) {
await validateUniqueUser(email, tenantId)
}
let builtUser = await UserDB.buildUser(user, opts, tenantId, dbUser)
// don't allow a user to update its own roles/perms
@ -569,6 +571,7 @@ export class UserDB {
hashPassword: opts?.hashPassword,
requirePassword: opts?.requirePassword,
skipPasswordValidation: opts?.skipPasswordValidation,
isAccountHolder: true,
})
}

View File

@ -4,4 +4,5 @@ export interface SaveUserOpts {
currentUserId?: string
skipPasswordValidation?: boolean
allowChangingEmail?: boolean
isAccountHolder?: boolean
}