-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[PM-13026] Refactor remove and bulkremove methods to throw error if u…
…ser is managed by an organization (#5034) * Enhance RemoveOrganizationUserCommand to block removing managed users when account deprovisioning is enabled * Refactor RemoveUsersAsync method to return just the OrgUserId and update related logic. * Refactor RemoveOrganizationUserCommand to improve variable naming and remove unused logging method * Add support for event system user in RemoveUsersAsync method. Refactor unit tests. * Add xmldoc to IRemoveOrganizationUserCommand methods * Refactor RemoveOrganizationUserCommand to use TimeProvider for event date retrieval and update unit tests accordingly * Refactor RemoveOrganizationUserCommand to use constants for error messages * Refactor unit tests to separate feature flag tests * refactor: Update parameter names for clarity in RemoveOrganizationUserCommand * refactor: Rename validation and repository methods for user removal clarity
- Loading branch information
Showing
4 changed files
with
757 additions
and
178 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 44 additions & 5 deletions
49
...nsole/OrganizationFeatures/OrganizationUsers/Interfaces/IRemoveOrganizationUserCommand.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,53 @@ | ||
using Bit.Core.Entities; | ||
using Bit.Core.Enums; | ||
using Bit.Core.Enums; | ||
|
||
namespace Bit.Core.AdminConsole.OrganizationFeatures.OrganizationUsers.Interfaces; | ||
|
||
public interface IRemoveOrganizationUserCommand | ||
{ | ||
/// <summary> | ||
/// Removes a user from an organization. | ||
/// </summary> | ||
/// <param name="organizationId">The ID of the organization.</param> | ||
/// <param name="userId">The ID of the user to remove.</param> | ||
Task RemoveUserAsync(Guid organizationId, Guid userId); | ||
|
||
/// <summary> | ||
/// Removes a user from an organization with a specified deleting user. | ||
/// </summary> | ||
/// <param name="organizationId">The ID of the organization.</param> | ||
/// <param name="organizationUserId">The ID of the organization user to remove.</param> | ||
/// <param name="deletingUserId">The ID of the user performing the removal operation.</param> | ||
Task RemoveUserAsync(Guid organizationId, Guid organizationUserId, Guid? deletingUserId); | ||
|
||
/// <summary> | ||
/// Removes a user from an organization using a system user. | ||
/// </summary> | ||
/// <param name="organizationId">The ID of the organization.</param> | ||
/// <param name="organizationUserId">The ID of the organization user to remove.</param> | ||
/// <param name="eventSystemUser">The system user performing the removal operation.</param> | ||
Task RemoveUserAsync(Guid organizationId, Guid organizationUserId, EventSystemUser eventSystemUser); | ||
Task RemoveUserAsync(Guid organizationId, Guid userId); | ||
Task<List<Tuple<OrganizationUser, string>>> RemoveUsersAsync(Guid organizationId, | ||
IEnumerable<Guid> organizationUserIds, Guid? deletingUserId); | ||
|
||
/// <summary> | ||
/// Removes multiple users from an organization with a specified deleting user. | ||
/// </summary> | ||
/// <param name="organizationId">The ID of the organization.</param> | ||
/// <param name="organizationUserIds">The collection of organization user IDs to remove.</param> | ||
/// <param name="deletingUserId">The ID of the user performing the removal operation.</param> | ||
/// <returns> | ||
/// A list of tuples containing the organization user id and the error message for each user that could not be removed, otherwise empty. | ||
/// </returns> | ||
Task<IEnumerable<(Guid OrganizationUserId, string ErrorMessage)>> RemoveUsersAsync( | ||
Guid organizationId, IEnumerable<Guid> organizationUserIds, Guid? deletingUserId); | ||
|
||
/// <summary> | ||
/// Removes multiple users from an organization using a system user. | ||
/// </summary> | ||
/// <param name="organizationId">The ID of the organization.</param> | ||
/// <param name="organizationUserIds">The collection of organization user IDs to remove.</param> | ||
/// <param name="eventSystemUser">The system user performing the removal operation.</param> | ||
/// <returns> | ||
/// A list of tuples containing the organization user id and the error message for each user that could not be removed, otherwise empty. | ||
/// </returns> | ||
Task<IEnumerable<(Guid OrganizationUserId, string ErrorMessage)>> RemoveUsersAsync( | ||
Guid organizationId, IEnumerable<Guid> organizationUserIds, EventSystemUser eventSystemUser); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.