mirror of
https://github.com/bitwarden/server.git
synced 2025-07-03 09:02:48 -05:00
[EC-343] Added 'UseCustomPermissions' to Api responses
This commit is contained in:
@ -260,6 +260,17 @@ public class OrganizationUsersController : Controller
|
|||||||
throw new NotFoundException();
|
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);
|
var userId = _userService.GetProperUserId(User);
|
||||||
await _organizationService.SaveUserAsync(model.ToOrganizationUser(organizationUser), userId.Value,
|
await _organizationService.SaveUserAsync(model.ToOrganizationUser(organizationUser), userId.Value,
|
||||||
model.Collections?.Select(c => c.ToSelectionReadOnly()));
|
model.Collections?.Select(c => c.ToSelectionReadOnly()));
|
||||||
|
@ -73,6 +73,7 @@ public class ProfileOrganizationResponseModel : ResponseModel
|
|||||||
public bool UseApi { get; set; }
|
public bool UseApi { get; set; }
|
||||||
public bool UseResetPassword { get; set; }
|
public bool UseResetPassword { get; set; }
|
||||||
public bool UsersGetPremium { get; set; }
|
public bool UsersGetPremium { get; set; }
|
||||||
|
public bool UseCustomPermissions { get; set; }
|
||||||
public bool SelfHost { get; set; }
|
public bool SelfHost { get; set; }
|
||||||
public int? Seats { get; set; }
|
public int? Seats { get; set; }
|
||||||
public short? MaxCollections { get; set; }
|
public short? MaxCollections { get; set; }
|
||||||
|
@ -22,6 +22,7 @@ public class ProfileProviderOrganizationResponseModel : ProfileOrganizationRespo
|
|||||||
UseApi = organization.UseApi;
|
UseApi = organization.UseApi;
|
||||||
UseResetPassword = organization.UseResetPassword;
|
UseResetPassword = organization.UseResetPassword;
|
||||||
UsersGetPremium = organization.UsersGetPremium;
|
UsersGetPremium = organization.UsersGetPremium;
|
||||||
|
UseCustomPermissions = organization.UseCustomPermissions;
|
||||||
SelfHost = organization.SelfHost;
|
SelfHost = organization.SelfHost;
|
||||||
Seats = organization.Seats;
|
Seats = organization.Seats;
|
||||||
MaxCollections = organization.MaxCollections;
|
MaxCollections = organization.MaxCollections;
|
||||||
|
Reference in New Issue
Block a user