Skip to content

ActivityLogPolicy.canCreate() incorrectly models automatic system logging as a user action #117

Description

@annikaholmqvist94

Body:

Problem

ActivityLogPolicy.canCreate() throws ForbiddenException for any non-ADMIN user.
This made sense if a user were manually creating log entries via an API endpoint,
but automatic logging is always triggered by the system — not by users directly.

Why it is wrong

When Anna (OWNER) creates a medical record, the system logs the event on her
behalf. The log is written by the system, not by Anna. Checking whether Anna
"has permission to write logs" is the wrong question entirely.

Fix

Remove the canCreate() call from ActivityLogService.log().
The canCreate() method in ActivityLogPolicy can be deleted unless a future
manual admin-only log endpoint is introduced.

Metadata

Metadata

Labels

enhancementNew feature or request

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions