mirror of
https://github.com/bitwarden/server
synced 2025-12-18 09:13:19 +00:00
Implemented Custom role and permissions (#1057)
* Implemented Custom role and permissions * Converted permissions columns to a json blob * Code review fixes for Permissions * sql build fix * Update Permissions.cs * formatting * Update IOrganizationService.cs * reworked a conditional * built out tests for relevant organization service methods * removed unused usings * fixed a broken test and a bad empty string init * removed 'Attribute' from some attribute instances
This commit is contained in:
@@ -61,7 +61,7 @@ namespace Bit.Api.Controllers
|
||||
var canView = false;
|
||||
if (cipher.OrganizationId.HasValue)
|
||||
{
|
||||
canView = _currentContext.OrganizationAdmin(cipher.OrganizationId.Value);
|
||||
canView = _currentContext.AccessEventLogs(cipher.OrganizationId.Value);
|
||||
}
|
||||
else if (cipher.UserId.HasValue)
|
||||
{
|
||||
@@ -86,7 +86,7 @@ namespace Bit.Api.Controllers
|
||||
[FromQuery]DateTime? start = null, [FromQuery]DateTime? end = null, [FromQuery]string continuationToken = null)
|
||||
{
|
||||
var orgId = new Guid(id);
|
||||
if (!_currentContext.OrganizationAdmin(orgId))
|
||||
if (!_currentContext.AccessEventLogs(orgId))
|
||||
{
|
||||
throw new NotFoundException();
|
||||
}
|
||||
@@ -104,7 +104,7 @@ namespace Bit.Api.Controllers
|
||||
{
|
||||
var organizationUser = await _organizationUserRepository.GetByIdAsync(new Guid(id));
|
||||
if (organizationUser == null || !organizationUser.UserId.HasValue ||
|
||||
!_currentContext.OrganizationAdmin(organizationUser.OrganizationId))
|
||||
!_currentContext.AccessEventLogs(organizationUser.OrganizationId))
|
||||
{
|
||||
throw new NotFoundException();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user