Skip to content

Feat/admin audit logging - #3781

Open
GhassenKefi wants to merge 4 commits into
mainfrom
feat/admin-audit-logging
Open

GhassenKefi wants to merge 4 commits into
mainfrom
feat/admin-audit-logging

Conversation

@GhassenKefi

Copy link
Copy Markdown

🤖 AI (if applicable)

  • The content of this PR was partly or fully generated using AI (N/A)

@GhassenKefi GhassenKefi self-assigned this Oct 19, 2026
@GhassenKefi GhassenKefi added enhancement New feature or request 3. to review Waiting for reviews AI assisted labels Oct 19, 2026
@Chartman123 Chartman123 added 2. developing Work in progress and removed 3. to review Waiting for reviews labels Oct 19, 2026
Creating a form (empty or as a copy of another form, with the source
form ID), deleting a form, transferring its ownership and the following
form updates are now written to the admin audit log:

- opening the form to or closing it for all users (permitAllUsers,
  showToAllUsers)
- closing, archiving or reopening the form, with the new and previous
  state
- changing the response settings isAnonymous, submitMultiple,
  allowEditSubmissions, expires or maxSubmissions; only the names of
  the changed settings are logged
- linking the results to a spreadsheet file, with the file ID and format

Updates are only logged when the value actually changed, after the
form was saved. The title, description, submission message and
confirmation email texts are never logged. Unlinking the results file
and the short-lived editing lock are not logged.

Form deletion is logged in the controller rather than in
FormMapper::deleteForm(), which also runs from the cleanup job on user
deletion, where there is no actor and admin_audit already logs the user
deletion.

The operations are collected in the new OCA\Forms\AuditLog\Operation
enum, with a short description of each for the documentation. Entries
are written through the new OCA\Forms\AuditLog\AuditLogger, which
dispatches the public CriticalActionPerformedEvent.

Assisted-by: ClaudeCode:claude-opus-5-5
Signed-off-by: Ghassen kefi <ghassen.kefi.dev@gmail.com>
Creating a share of a form (with a user, group or team or by public
link), changing the permissions or the custom token of a share and
deleting a share are now written to the admin audit log, with the share
ID, form ID, share type, recipient and permissions. Forms shares are
stored in the Forms share table, not as core shares, so admin_audit did
not see them.

Deleting a share through the share review is logged with its own
message, after the share was deleted.

The token of a link share is stored as its recipient and is never
logged; a share update only logs whether the token changed. The
recipient of user, group and team shares is also logged on updates and
deletions, so that a revoked grant can be attributed.

Assisted-by: ClaudeCode:claude-opus-5-5
Signed-off-by: Ghassen kefi <ghassen.kefi.dev@gmail.com>
…t log

Downloading all results as a CSV, ODS or XLSX file, exporting them to a
file in the cloud, deleting all submissions of a form, and deleting or
updating a single submission are now written to the admin audit log.
The results download is not a file access, so admin_audit did not see
it.

Submission entries carry the submission ID, the form ID and the user
who submitted it, which is often not the user doing the change. The
answers are never logged.

The cloud export is logged in the controller, not in
SubmissionService::writeFileToCloud(), which also runs from the
background job keeping a linked results file in sync. The export entry
also carries the file ID besides the file name and format.

New submissions and uploaded answer files are not logged: they are
frequent, often anonymous, and the file writes are already logged by
admin_audit.

Assisted-by: ClaudeCode:claude-opus-5-5
Signed-off-by: Ghassen kefi <ghassen.kefi.dev@gmail.com>
Changing one of the Forms admin settings (permitting forms for all
users, public links, custom public link tokens, showing forms to all
users, restricting form creation and the groups allowed to create
forms, confirmation emails and their rate limit, comments) is now
written to the admin audit log with the setting name and its new
value, after the value was saved. All of these settings are booleans,
integers or group IDs. Rejected values are not logged.

Assisted-by: ClaudeCode:claude-opus-5-5
Signed-off-by: Ghassen kefi <ghassen.kefi.dev@gmail.com>
@GhassenKefi
GhassenKefi force-pushed the feat/admin-audit-logging branch from 6a3d3bb to ef50ec8 Compare October 20, 2026 15:46
@codecov

codecov Bot commented Oct 20, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 99.24242% with 1 line in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
lib/AuditLog/AuditLogger.php 92.85% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

@GhassenKefi GhassenKefi added 3. to review Waiting for reviews and removed 2. developing Work in progress labels Oct 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3. to review Waiting for reviews AI assisted enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants