lasdf1234 opened a new pull request, #14693:
URL: https://github.com/apache/gravitino/pull/14693

   ### What changes were proposed in this pull request?
   
   - Add `IdpUserGroupEventDispatcher` that wraps `IdpUserGroupManager` and 
dispatches PreEvent / success Event / FailureEvent for built-in IdP mutations 
(same pattern as `AccessControlEventDispatcher` / `JobEventDispatcher`).
   - Add IdP-specific event types under 
`org.apache.gravitino.idp.listener.event` with identifiers `system.user.<name>` 
/ `system.group.<name>`.
   - Wire the dispatcher through `IdpBasicBinder` and IdP REST resources so 
successful mutations mark `RequestContext` and suppress the `HttpRequestEvent` 
fallback (`UNKNOWN` / `null` object).
   - Keep `IdpRESTUtils.rejectNullRequestBody` on `PUT 
/api/idp/users/{user}/enabled` (#14691; already introduced with #14579 / 
#14572) and retain the null-body unit coverage in `TestIdpOperations`.
   
   Operation mapping:
   
   | API | OperationType |
   | --- | --- |
   | POST /idp/users | ADD_USER |
   | DELETE /idp/users/{user} | REMOVE_USER |
   | PUT /idp/users/{user}/password | ALTER_USER |
   | PUT /idp/users/{user}/enabled | ENABLE_USER / DISABLE_USER |
   | POST /idp/groups | ADD_GROUP |
   | DELETE /idp/groups/{group} | REMOVE_GROUP |
   | PUT /idp/groups/{group}/users | ALTER_GROUP |
   
   ### Why are the changes needed?
   
   Fixes #14692: IdP mutations were only audited via `HttpAuditFilter`'s 
HTTP-layer fallback (`UNKNOWN`, null identifier), so auditors could not see 
which user/group was created, enabled, or membership-changed.
   
   Fixes #14691: confirms the null-body contract for `updateEnabled` stays 
aligned with the other IdP write APIs.
   
   ### Does this PR introduce _any_ user-facing change?
   
   Yes. Audit log entries for built-in IdP mutations now use typed 
`OperationType` values and name the user/group object instead of `UNKNOWN` / 
`null`.
   
   ### How was this patch tested?
   
   - `./gradlew :plugins:idp-basic:test -PskipITs --tests 
org.apache.gravitino.idp.listener.TestIdpUserGroupEventDispatcher --tests 
org.apache.gravitino.idp.web.rest.TestIdpOperations`
   
   Made with [Cursor](https://cursor.com)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to