mirror of
https://github.com/bitwarden/browser
synced 2025-12-22 11:13:46 +00:00
[PM-4395] Block reseller org invites if they outnumber available seats (#6698)
* Add Toast when reseller org invites over seat limit * Set validation error when reseller org invited members outnumber seats * Thomas' feedback
This commit is contained in:
@@ -54,6 +54,7 @@ export interface MemberDialogParams {
|
||||
allOrganizationUserEmails: string[];
|
||||
usesKeyConnector: boolean;
|
||||
initialTab?: MemberDialogTab;
|
||||
numConfirmedMembers: number;
|
||||
}
|
||||
|
||||
export enum MemberDialogResult {
|
||||
@@ -383,6 +384,15 @@ export class MemberDialogComponent implements OnInit, OnDestroy {
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (
|
||||
this.organization.hasReseller &&
|
||||
this.params.numConfirmedMembers + emails.length > this.organization.seats
|
||||
) {
|
||||
this.formGroup.controls.emails.setErrors({
|
||||
tooManyEmails: { message: this.i18nService.t("seatLimitReachedContactYourProvider") },
|
||||
});
|
||||
return;
|
||||
}
|
||||
await this.userService.invite(emails, userView);
|
||||
}
|
||||
|
||||
|
||||
@@ -427,6 +427,15 @@ export class PeopleComponent
|
||||
}
|
||||
|
||||
async edit(user: OrganizationUserView, initialTab: MemberDialogTab = MemberDialogTab.Role) {
|
||||
if (!user && this.organization.hasReseller && this.organization.seats === this.confirmedCount) {
|
||||
this.platformUtilsService.showToast(
|
||||
"error",
|
||||
this.i18nService.t("seatLimitReached"),
|
||||
this.i18nService.t("contactYourProvider")
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
// Invite User: Add Flow
|
||||
// Click on user email: Edit Flow
|
||||
|
||||
@@ -450,6 +459,7 @@ export class PeopleComponent
|
||||
allOrganizationUserEmails: this.allUsers?.map((user) => user.email) ?? [],
|
||||
usesKeyConnector: user?.usesKeyConnector,
|
||||
initialTab: initialTab,
|
||||
numConfirmedMembers: this.confirmedCount,
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user