Skip to content

Audit-log group create / update / delete - #19377

Open
rodchristiansen wants to merge 2 commits into
grokability:developfrom
emilycarru-its-infra:up/group-permission-audit-log
Open

Audit-log group create / update / delete#19377
rodchristiansen wants to merge 2 commits into
grokability:developfrom
emilycarru-its-infra:up/group-permission-audit-log

Conversation

@rodchristiansen

Copy link
Copy Markdown

Description

Editing a group's permissions currently leaves no trace in the action log. That is a notable gap, because a group permission edit silently changes what every member of that group can do — a wider blast radius than the equivalent edit on a single user, which is already logged by UserObserver.

This adds GroupObserver, deliberately mirroring the existing UserObserver:

  • created / deleting write a create / delete row
  • updating writes an update row carrying an old/new diff in log_meta
  • tracked fields are name, notes and permissions
  • a save that changes none of those writes nothing, so the log doesn't fill with no-op rows

Group does not soft-delete, so there is no restoring handler.

Type of change

  • New feature (non-breaking change which adds functionality)

How Has This Been Tested?

Added tests/Feature/Groups/GroupAuditLogTest.php covering create, rename, permission change (asserting the old/new diff actually lands in log_meta), delete, and the no-op case. Full tests/Feature/Groups suite passes — 24 tests, 79 assertions.

Notes for reviewers

No migration: this reuses the existing action_logs table and the create/update/delete ActionType cases. Existing group history views pick the rows up without change.

Mirrors UserObserver so edits to a permission group land in action_logs
the same way user edits do. Without this, changing a group's
permissions JSON is invisible to the audit history even though the
change affects every member.

Tracked fields: name, notes, permissions. Diff is stored in log_meta
as {field: {old, new}}. Group does not soft-delete, so no restoring
handler.
Asserts that creating, renaming, re-permissioning and deleting a group
each write the expected row to action_logs, that the update row carries
an old/new diff in log_meta, and that a save which changes nothing does
not write a row at all.
@rodchristiansen
rodchristiansen requested a review from snipe as a code owner July 28, 2026 07:02
@codacy-production

Copy link
Copy Markdown

Not up to standards ⛔

🔴 Issues 1 medium

Alerts:
⚠ 1 issue (≤ 0 issues of at least minor severity)

Results:
1 new issue

Category Results
UnusedCode 1 medium

View in Codacy

🟢 Metrics 12 complexity

Metric Results
Complexity 12

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@snipe

snipe commented Jul 28, 2026

Copy link
Copy Markdown
Member

Our intent was to put this into an admin log table along with other admin settings, to keep it out of the regular action logs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants