diff --git a/src/Api/Controllers/OrganizationUsersController.cs b/src/Api/Controllers/OrganizationUsersController.cs index 64340e3ede..b535316ec5 100644 --- a/src/Api/Controllers/OrganizationUsersController.cs +++ b/src/Api/Controllers/OrganizationUsersController.cs @@ -260,6 +260,17 @@ public class OrganizationUsersController : Controller throw new NotFoundException(); } + var organization = await _organizationRepository.GetByIdAsync(orgGuidId); + if (organization == null) + { + throw new NotFoundException(); + } + + if (model.Type == OrganizationUserType.Custom && !organization.UseCustomPermissions) + { + throw new BadRequestException("To enable custom permissions the organization must be on an Enterprise 2020 plan."); + } + var userId = _userService.GetProperUserId(User); await _organizationService.SaveUserAsync(model.ToOrganizationUser(organizationUser), userId.Value, model.Collections?.Select(c => c.ToSelectionReadOnly())); diff --git a/src/Api/Models/Response/ProfileOrganizationResponseModel.cs b/src/Api/Models/Response/ProfileOrganizationResponseModel.cs index 4285ae432b..e0292993b3 100644 --- a/src/Api/Models/Response/ProfileOrganizationResponseModel.cs +++ b/src/Api/Models/Response/ProfileOrganizationResponseModel.cs @@ -73,6 +73,7 @@ public class ProfileOrganizationResponseModel : ResponseModel public bool UseApi { get; set; } public bool UseResetPassword { get; set; } public bool UsersGetPremium { get; set; } + public bool UseCustomPermissions { get; set; } public bool SelfHost { get; set; } public int? Seats { get; set; } public short? MaxCollections { get; set; } diff --git a/src/Api/Models/Response/ProfileProviderOrganizationResponseModel.cs b/src/Api/Models/Response/ProfileProviderOrganizationResponseModel.cs index a660662fac..88c41d99c0 100644 --- a/src/Api/Models/Response/ProfileProviderOrganizationResponseModel.cs +++ b/src/Api/Models/Response/ProfileProviderOrganizationResponseModel.cs @@ -22,6 +22,7 @@ public class ProfileProviderOrganizationResponseModel : ProfileOrganizationRespo UseApi = organization.UseApi; UseResetPassword = organization.UseResetPassword; UsersGetPremium = organization.UsersGetPremium; + UseCustomPermissions = organization.UseCustomPermissions; SelfHost = organization.SelfHost; Seats = organization.Seats; MaxCollections = organization.MaxCollections;