1
0
mirror of https://github.com/bitwarden/server.git synced 2025-07-03 00:52:49 -05:00

[EC-343] Added 'UseCustomPermissions' to Api responses

This commit is contained in:
Rui Tome
2022-10-12 17:17:56 +01:00
parent fa549fb72e
commit 7a4d83acdd
3 changed files with 13 additions and 0 deletions

View File

@ -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()));

View File

@ -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; }

View File

@ -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;