bitwarden-server/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
..
Admin.Test [PM-26361] Add User Auto Confirmation (#6436) 2025-10-20 07:27:18 -05:00
Api.IntegrationTest [PM-29555] Add self-revoke endpoint for declining organization data ownership policy (#6739) 2026-01-06 11:25:14 +00:00
Api.Test [PM-29555] Add self-revoke endpoint for declining organization data ownership policy (#6739) 2026-01-06 11:25:14 +00:00
Billing.Test SRE-3582 billing cleanup (#6772) 2025-12-22 13:09:23 -07:00
Common Add #nullable disable to platform code (#6057) 2025-07-08 10:25:59 -04:00
Core.IntegrationTest [deps]: Update Microsoft.NET.Test.Sdk to v18 (#6449) 2025-12-09 14:40:46 +01:00
Core.Test [PM-29555] Add self-revoke endpoint for declining organization data ownership policy (#6739) 2026-01-06 11:25:14 +00:00
Events.IntegrationTest Handle null cipher or organization with event submission (#6509) 2025-10-28 16:31:05 -04:00
Events.Test [PM-28746] Add support for Organization_ItemOrganization_Accepted/Declined event types (#6747) 2025-12-18 10:20:46 -08:00
EventsProcessor.Test Include all projects in coverage (#3829) 2024-02-20 17:18:40 +01:00
Icons.Test PM-21024 ChangePasswordUri controller + service (#5845) 2025-08-26 07:35:23 -05:00
Identity.IntegrationTest Revert "refactor(IdentityTokenResponse): [Auth/PM-3287] Remove deprecated res…" (#6755) 2025-12-18 15:10:40 -05:00
Identity.Test refactor(base-request-validator) [PM-28621] Unwind pm-21153 Feature Flag (#6730) 2025-12-12 15:38:21 -05:00
Infrastructure.Dapper.Test [deps]: Update Microsoft.NET.Test.Sdk to v18 (#6449) 2025-12-09 14:40:46 +01:00
Infrastructure.EFIntegration.Test [PM-28485] Move organization events domain to DIRT code ownership (#6685) 2025-12-20 07:32:51 +10:00
Infrastructure.IntegrationTest [PM-27280] Support v2 encryption on key-connector signups (#6712) 2025-12-18 13:43:03 -05:00
IntegrationTestCommon [PM-28025] Revert "chore(feature-flag): [PM-19665] Remove web-push feature flag" (#6779) 2025-12-26 16:44:34 -06:00
Notifications.Test [PM-24011] Create new policy sync push notification (#6594) 2025-12-01 10:21:44 -05:00
SharedWeb.Test [PM-25182] Improve swagger OperationIDs: Part 1 (#6229) 2025-09-02 18:30:53 +02:00
Bitwarden.Tests.proj Devcontainer Improvements (#4466) 2024-07-08 10:48:02 -04:00