Browse Source

[AC-1104] [AC-1265] Allow custom users with import/export permission to get export organization ciphers (#2837)

* [AC-1265] Allow users with custom import/export permission to get organization ciphers

* [AC-1104] Fix to allow custom users with import/export permission to access all collections/ciphers in their organization

* [AC-1104] Remove redundant OrganizationAdmin checks
pull/2985/head
Shane Melton 3 years ago committed by GitHub
parent
commit
767993e266
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      src/Core/Services/Implementations/CollectionService.cs
  2. 6
      src/Core/Vault/Services/Implementations/CipherService.cs

6
src/Core/Services/Implementations/CollectionService.cs

@ -98,15 +98,15 @@ public class CollectionService : ICollectionService @@ -98,15 +98,15 @@ public class CollectionService : ICollectionService
public async Task<IEnumerable<Collection>> GetOrganizationCollections(Guid organizationId)
{
if (!await _currentContext.ViewAllCollections(organizationId) && !await _currentContext.ManageUsers(organizationId) && !await _currentContext.ManageGroups(organizationId))
if (!await _currentContext.ViewAllCollections(organizationId) && !await _currentContext.ManageUsers(organizationId) && !await _currentContext.ManageGroups(organizationId) && !await _currentContext.AccessImportExport(organizationId))
{
throw new NotFoundException();
}
IEnumerable<Collection> orgCollections;
if (await _currentContext.OrganizationAdmin(organizationId) || await _currentContext.ViewAllCollections(organizationId))
if (await _currentContext.ViewAllCollections(organizationId) || await _currentContext.AccessImportExport(organizationId))
{
// Admins, Owners, Providers and Custom (with collection management permissions) can access all items even if not assigned to them
// Admins, Owners, Providers and Custom (with collection management or import/export permissions) can access all items even if not assigned to them
orgCollections = await _collectionRepository.GetManyByOrganizationIdAsync(organizationId);
}
else

6
src/Core/Vault/Services/Implementations/CipherService.cs

@ -870,15 +870,15 @@ public class CipherService : ICipherService @@ -870,15 +870,15 @@ public class CipherService : ICipherService
public async Task<(IEnumerable<CipherOrganizationDetails>, Dictionary<Guid, IGrouping<Guid, CollectionCipher>>)> GetOrganizationCiphers(Guid userId, Guid organizationId)
{
if (!await _currentContext.ViewAllCollections(organizationId) && !await _currentContext.AccessReports(organizationId))
if (!await _currentContext.ViewAllCollections(organizationId) && !await _currentContext.AccessReports(organizationId) && !await _currentContext.AccessImportExport(organizationId))
{
throw new NotFoundException();
}
IEnumerable<CipherOrganizationDetails> orgCiphers;
if (await _currentContext.OrganizationAdmin(organizationId))
if (await _currentContext.AccessImportExport(organizationId))
{
// Admins, Owners and Providers can access all items even if not assigned to them
// Admins, Owners, Providers and Custom (with import/export permission) can access all items even if not assigned to them
orgCiphers = await _cipherRepository.GetManyOrganizationDetailsByOrganizationIdAsync(organizationId);
}
else

Loading…
Cancel
Save