Skip to content

AUDIT LOGS for ticket status, assign, attachmentΒ #24

Description

@addee1

Improve Audit Logs to include user, action and timestamp


🎯 Goal

Audit logs should clearly show:

πŸ‘‰ WHO – WHAT – WHEN

Example:

Adam - ATTACHMENT_ADDED - 2026-04-20 12:23

πŸ” Current Situation

Right now:

  • Audit logging system exists (AuditService, AuditLog, AuditAction) βœ…
  • Some actions are logged (e.g. attachments) βœ…
  • Timestamp exists in DB (createdAt) βœ…
  • UI only shows the action ❌
  • User (who performed the action) is NOT stored ❌

πŸ‘‰ This means we currently only see WHAT happened, but not WHO or WHEN (in UI).


🧩 What needs to be done


1. Store WHO performed the action (Backend)

In AuditService, update the log method:

log.setUser(securityUtils.getCurrentUserOrNull());

πŸ‘‰ This ensures every audit log contains the user.


2. Add missing audit logs (Backend)

We need to log ALL important actions using:

auditService.log(...)

TicketService

Add logging:

  • When a ticket is assigned
  • When ticket status is updated

TicketCommentService

Add logging:

  • When a comment is created

AttachmentService

βœ” Already implemented (ATTACHMENT_ADDED)
(No changes needed here)


3. Update UI (view.jte)

In the Audit Logs section, change rendering to:

@for(var log : auditLogs)
    <div>
        ${log.getUser() != null ? log.getUser().getUsername() : "Anonymous"}
        - ${log.getAction()}
        - ${log.getCreatedAt()}
    </div>
@endfor

πŸ‘‰ This will display:

  • Username (or Anonymous)
  • Action
  • Timestamp

βœ… Expected Result

Audit logs should display:

  • WHO performed the action
  • WHAT action was performed
  • WHEN it happened

⚠️ Important Notes

  • Old logs (already in DB) will not have user β†’ show as "Anonymous"
  • No changes needed to AuditAction enum
  • No need to rebuild the audit system β€” just extend it

🧠 Summary

  • Add user to audit logs
  • Add logging in missing places
  • Update UI to show full information

This will make the audit logs complete and meet the transparency requirement πŸ‘

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions