Body:
Problem
ActivityLogService.log() calls activityLogPolicy.canCreate(user) before saving
the log entry. Since canCreate() only allows ADMIN, any action triggered by an
OWNER or VET that results in automatic logging (create, update, assignVet,
updateStatus, close) throws ForbiddenException and rolls back the entire
transaction.
Affected flow
POST /api/medical-records → MedicalRecordService.create()
→ activityLogService.log() → activityLogPolicy.canCreate(OWNER) → 403
→ @transactional rolls back → record is never saved
Root cause
ActivityLogService.log() is an internal system method, always called by the
system automatically — never directly by a user via API. It should never enforce
user-level permissions.
Fix
Remove the activityLogPolicy.canCreate(user) call from ActivityLogService.log()
on line 36.
Body:
Problem
ActivityLogService.log() calls activityLogPolicy.canCreate(user) before saving
the log entry. Since canCreate() only allows ADMIN, any action triggered by an
OWNER or VET that results in automatic logging (create, update, assignVet,
updateStatus, close) throws ForbiddenException and rolls back the entire
transaction.
Affected flow
POST /api/medical-records → MedicalRecordService.create()
→ activityLogService.log() → activityLogPolicy.canCreate(OWNER) → 403
→ @transactional rolls back → record is never saved
Root cause
ActivityLogService.log() is an internal system method, always called by the
system automatically — never directly by a user via API. It should never enforce
user-level permissions.
Fix
Remove the activityLogPolicy.canCreate(user) call from ActivityLogService.log()
on line 36.