[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:
parent
1dbff31d20
commit
6f9c6d07af
|
@ -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,
|
||||
},
|
||||
});
|
||||
|
||||
|
|
|
@ -7398,5 +7398,14 @@
|
|||
},
|
||||
"unexpectedErrorSend": {
|
||||
"message": "An unexpected error has occurred while loading this Send. Try again later."
|
||||
},
|
||||
"seatLimitReached": {
|
||||
"message": "Seat limit has been reached"
|
||||
},
|
||||
"contactYourProvider": {
|
||||
"message": "Contact your provider to purchase additional seats."
|
||||
},
|
||||
"seatLimitReachedContactYourProvider": {
|
||||
"message": "Seat limit has been reached. Contact your provider to purchase additional seats."
|
||||
}
|
||||
}
|
||||
|
|
|
@ -258,6 +258,10 @@ export class Organization {
|
|||
return this.providerId != null || this.providerName != null;
|
||||
}
|
||||
|
||||
get hasReseller() {
|
||||
return this.hasProvider && this.providerType === ProviderType.Reseller;
|
||||
}
|
||||
|
||||
get canAccessSecretsManager() {
|
||||
return this.useSecretsManager && this.accessSecretsManager;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue