Feature | Add UserAction formatter #97
Draft
+61
−0
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
📝 Summary
This PR implements audit logging capabilities for the
UserActionmodel by adding a dedicated formatter that generates human-readable and contextualized audit log messages.🎯 Objective
Enable automatic audit logging for all CRUD operations on
UserActionentities, providing complete traceability of user actions in the system.🔧 Changes Made
1. New Audit Formatter
File:
app/Audit/ConcreteFormatters/UserActionAuditLogFormatter.phpIChildEntityAuditLogFormatterinterface2. Audit Configuration
File:
config/audit_log.phpUserActionmodel in the audit systemUserActionAuditLogFormatterstrategy📋 Implementation Details
Key Features
UserActioninstances are processedCode Quality
🧪 Testing
🔍 Additional Notes
This implementation follows the audit logging pattern established in the OpenStackID application, ensuring consistency with other existing entity formatters. The formatter provides detailed context for security auditing and compliance of user actions.
📦 Modified Files
app/Audit/ConcreteFormatters/UserActionAuditLogFormatter.php(new)config/audit_log.php(updated)✨ Output Examples
Creation:
A new UserAction which owner is "John Doe (123)", with realm "default" and IP "192.168.1.1" was created.
Update:
An UserAction with ID 456 was changed.
Deletion:
An UserAction with ID 456 which owner is "John Doe (123)", with realm "default" and IP "192.168.1.1" was removed