bitwarden-server/test/Api.Test
Rui Tomé 1b17d99bfd
[PM-29555] Add self-revoke endpoint for declining organization data ownership policy (#6739)
* Add OrganizationUser_SelfRevoked event type to EventType enum

* Add SelfRevokeOrganizationUserCommand implementation and interface for user self-revocation from organizations

* Add unit tests for SelfRevokeOrganizationUserCommand to validate user self-revocation logic, including success scenarios and various failure conditions.

* Add ISelfRevokeOrganizationUserCommand registration to OrganizationServiceCollectionExtensions for user self-revocation functionality

* Add self-revoke user functionality to OrganizationUsersController with new endpoint for user-initiated revocation

* Add integration tests for self-revoke functionality in OrganizationUsersController, covering scenarios for eligible users, non-members, and users with owner/admin roles.

* Add unit test for SelfRevokeOrganizationUserCommand to validate behavior when a user attempts to self-revoke without confirmation. This test checks for a BadRequestException with an appropriate message.

* Add MemberRequirement class for organization membership authorization

- Implemented MemberRequirement to check if a user is a member of the organization.
- Added unit tests for MemberRequirement to validate authorization logic for different user types.

* Update authorization requirement for self-revoke endpoint and add integration test for provider users

- Changed authorization attribute from MemberOrProviderRequirement to MemberRequirement in the RevokeSelfAsync method.
- Added a new integration test to verify that provider users who are not members receive a forbidden response when attempting to revoke themselves.

* Add EligibleForSelfRevoke method to OrganizationDataOwnershipPolicyRequirement

- Implemented the EligibleForSelfRevoke method to determine if a user can self-revoke their data ownership based on their membership status and policy state.
- Added unit tests to validate the eligibility logic for confirmed, invited, and non-policy users, as well as for different organization IDs.

* Refactor self-revoke user command to enhance eligibility checks

- Updated the SelfRevokeOrganizationUserCommand to utilize policy requirements for determining user eligibility for self-revocation.
- Implemented checks to prevent the last owner from revoking themselves, ensuring organizational integrity.
- Modified unit tests to reflect changes in eligibility logic and added scenarios for confirmed owners and admins.
- Removed deprecated policy checks and streamlined the command's dependencies.

* Use CommandResult pattern in self-revoke command

* Clearer documentation
2026-01-06 11:25:14 +00:00
..
AdminConsole [PM-29555] Add self-revoke endpoint for declining organization data ownership policy (#6739) 2026-01-06 11:25:14 +00:00
Auth [PM-29161] Remove ReturnErrorOnExistingKeypair feature flag (#6726) 2025-12-15 13:52:34 -06:00
Billing [PM 29610]Update Account Storage Endpoint (#6750) 2026-01-05 10:52:52 -06:00
Controllers [PM-26426] [PM-26427] Remove feature flag - policy validators/requirements refactor (#6674) 2025-12-03 10:42:54 -06:00
Dirt Move all event integration code to Dirt (#6757) 2025-12-30 10:59:19 -05:00
KeyManagement [PM-27280] Support v2 encryption on key-connector signups (#6712) 2025-12-18 13:43:03 -05:00
Models [PM 26682]milestone 2d display discount on subscription page (#6542) 2025-11-12 20:38:21 +01:00
NotificationCenter [PM-17563] Add missing TaskId and HubHelper for PendingSecurityTasks (#5591) 2025-04-02 13:44:59 -07:00
Platform/Push/Controllers [PM-19659] Clean up Notifications code (#6244) 2025-08-26 13:30:37 -04:00
Public/Controllers [PM-24414] Remove CollectionType property from the public CollectionResponseModel (#6180) 2025-08-13 15:01:51 +01:00
SecretsManager [SM-1592] API for Secret Versioning, adding controller, repository and tests (#6444) 2025-12-03 12:17:29 -05:00
Tools [PM-21918] update send api models to support new email field (#5895) 2025-12-31 13:37:42 -07:00
Utilities [PM-28485] Move organization events domain to DIRT code ownership (#6685) 2025-12-20 07:32:51 +10:00
Vault [PM-25947] Add folders and favorites when sharing a cipher (#6402) 2025-12-11 12:31:12 -06:00
Api.Test.csproj [PM-20348] Add pending auth request endpoint (#5957) 2025-06-30 13:17:51 -04:00