mirror of
https://github.com/bitwarden/server
synced 2025-12-15 07:43:54 +00:00
* Implement GetByOrganizationAsync method in PolicyRequirementQuery and add corresponding unit tests * Refactor ConfirmOrganizationUserCommand for clarity and add bulk support * Update ConfirmOrganizationUserCommandTests to use GetByOrganizationAsync for policy requirement queries * Add DefaultUserCollectionName property to OrganizationUserBulkConfirmRequestModel with encryption attributes * Update ConfirmUsersAsync method to include DefaultUserCollectionName parameter in OrganizationUsersController * Add EnableOrganizationDataOwnershipPolicyAsync method to OrganizationTestHelpers * Add integration tests for confirming organization users in OrganizationUserControllerTests - Implemented Confirm_WithValidUser test to verify successful confirmation of a single user. - Added BulkConfirm_WithValidUsers test to ensure multiple users can be confirmed successfully. * Refactor organization user confirmation integration tests to also test when the organization data ownership policy is disabled * Refactor ConfirmOrganizationUserCommand to consolidate confirmation side effects handling - Replaced single and bulk confirmation side effect methods with a unified HandleConfirmationSideEffectsAsync method. - Updated related logic to handle confirmed organization users more efficiently. - Adjusted unit tests to reflect changes in the collection creation process for confirmed users. * Refactor OrganizationUserControllerTests to simplify feature flag handling and consolidate test logic - Removed redundant feature flag checks in Confirm and BulkConfirm tests. - Updated tests to directly enable the Organization Data Ownership policy without conditional checks. - Ensured verification of DefaultUserCollection for confirmed users remains intact. * Refactor OrganizationUserControllerTests to enhance clarity and reduce redundancy - Simplified user creation and confirmation logic in tests by introducing helper methods. - Consolidated verification of confirmed users and their associated collections. - Removed unnecessary comments and streamlined test flow for better readability.
29 lines
1.4 KiB
C#
29 lines
1.4 KiB
C#
#nullable enable
|
|
|
|
using Bit.Core.AdminConsole.OrganizationFeatures.Policies.PolicyRequirements;
|
|
|
|
namespace Bit.Core.AdminConsole.OrganizationFeatures.Policies;
|
|
|
|
public interface IPolicyRequirementQuery
|
|
{
|
|
/// <summary>
|
|
/// Get a policy requirement for a specific user.
|
|
/// The policy requirement represents how one or more policy types should be enforced against the user.
|
|
/// It will always return a value even if there are no policies that should be enforced.
|
|
/// This should be used for all policy checks.
|
|
/// </summary>
|
|
/// <param name="userId">The user that you need to enforce the policy against.</param>
|
|
/// <typeparam name="T">The IPolicyRequirement that corresponds to the policy you want to enforce.</typeparam>
|
|
Task<T> GetAsync<T>(Guid userId) where T : IPolicyRequirement;
|
|
|
|
/// <summary>
|
|
/// Get a policy requirement for a specific organization.
|
|
/// This returns the policy requirement that represents the policy state for the entire organization.
|
|
/// It will always return a value even if there are no policies that should be enforced.
|
|
/// This should be used for organization-level policy checks.
|
|
/// </summary>
|
|
/// <param name="organizationId">The organization to check policies for.</param>
|
|
/// <typeparam name="T">The IPolicyRequirement that corresponds to the policy you want to enforce.</typeparam>
|
|
Task<T> GetByOrganizationAsync<T>(Guid organizationId) where T : IPolicyRequirement;
|
|
}
|