feat(audit): add file view event type to distinguish preview from download by yuuhikaze · Pull Request #2563 · opencloud-eu/opencloud
…nload Add FileViewed event type alongside FileDownloaded for audit logging: - Reva: Add events.FileViewed event type with Unmarshal() method - Reva: Modify events middleware to check intent parameter from gRPC Opaque - If intent == 'preview', emit FileViewed event - Otherwise, emit FileDownloaded event for backward compatibility - Reva: Extract intent from HTTP query parameters and headers in GET handler - Read intent from ?intent= query param or X-OC-Intent header - Add to gRPC request Opaque field as 'oc:intent' - OpenCloud: Add AuditEventFileViewed type and conversion function - OpenCloud: Register FileViewed event handler in audit service - OpenCloud: Update RegisteredEvents() to include FileViewed This enables distinguishing file views from downloads for compliance tracking and audit logging purposes. Intent is signaled client-side and propagates through HTTP headers/query parameters to gRPC Opaque field, where the events middleware uses it to emit appropriate audit events. Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Add clear comments explaining the event conversion pattern and the purpose of the new FileViewed event type for audit trail distinction. This improves code readability and helps maintainers understand the design intent.
This file contains hidden or 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