1
0
mirror of https://github.com/bitwarden/server.git synced 2025-07-04 09:32:48 -05:00

[PM-11360] Remove export permission for providers (#5051)

- also fix managed collections export from CLI
This commit is contained in:
Thomas Rittson
2024-12-06 08:07:04 +10:00
committed by GitHub
parent 1f1510f4d4
commit 6a9b7ece2b
13 changed files with 428 additions and 2 deletions

View File

@ -27,4 +27,14 @@ public interface IOrganizationCiphersQuery
/// </summary>
/// <exception cref="FeatureUnavailableException"></exception>
Task<IEnumerable<CipherOrganizationDetails>> GetUnassignedOrganizationCiphers(Guid organizationId);
/// <summary>
/// Returns ciphers belonging to the organization that are in the specified collections.
/// </summary>
/// <remarks>
/// Note that the <see cref="CipherOrganizationDetailsWithCollections.CollectionIds"/> will include all collections
/// the cipher belongs to even if it is not in the <paramref name="collectionIds"/> parameter.
/// </remarks>
public Task<IEnumerable<CipherOrganizationDetailsWithCollections>> GetOrganizationCiphersByCollectionIds(
Guid organizationId, IEnumerable<Guid> collectionIds);
}

View File

@ -52,4 +52,13 @@ public class OrganizationCiphersQuery : IOrganizationCiphersQuery
{
return await _cipherRepository.GetManyUnassignedOrganizationDetailsByOrganizationIdAsync(organizationId);
}
/// <inheritdoc />
public async Task<IEnumerable<CipherOrganizationDetailsWithCollections>> GetOrganizationCiphersByCollectionIds(
Guid organizationId, IEnumerable<Guid> collectionIds)
{
var managedCollectionIds = collectionIds.ToHashSet();
var allOrganizationCiphers = await GetAllOrganizationCiphers(organizationId);
return allOrganizationCiphers.Where(c => c.CollectionIds.Intersect(managedCollectionIds).Any());
}
}