Skip to content

Use role permissions wherever staff were checked as super admins - #588

Merged
simonhamp merged 2 commits into
NativePHP:mainfrom
sonalidudhia:fix/staff-plugin-listing-preview
Oct 29, 2026
Merged

simonhamp merged 2 commits into
NativePHP:mainfrom
sonalidudhia:fix/staff-plugin-listing-preview

Conversation

@sonalidudhia

@sonalidudhia sonalidudhia commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Follow-up to #555. Some places still only let super admins in, so staff whose role had the right permission saw a button or link in the admin and then got a 404 or 403.

Fixes

Where Before Now
Plugin "View Listing Page" (and the paid plugin license page) for unapproved or de-listed plugins 404 unless super admin or owner Opens with View:Plugin, with the preview banner
Article "Preview" on drafts 404 unless super admin Opens with View:Article
Support ticket attachments (linked from the ticket admin page) 403 unless super admin or ticket owner Open for anyone who can view the ticket (SupportTicketPolicy::view)
"Go to …" links between admin sections (user, subscription, payout, plugin, course module, Companies → Users) Always shown; 403 if the role lacked the target section Hidden when the role can't open the target
"Staff" badge on ticket replies Only super admins Anyone with panel access, via new User::isStaff()

Customers without permissions keep getting a 404/403 as before. Super admins are unaffected.

Also fixes two links that passed the wrong record id: the user link on a subscription item (used the subscription id) and the wall of love "user" action (used the submission id).

Deliberately left super-admin only

Horizon, admin MCP tools, reserved plugin namespaces, plugin access via the API, Roles page, role assignment, impersonation.

Testing

  • AdminPluginPreviewTest: 4 new tests (staff with/without View:Plugin, paid plugin + license page, super_admin role).
  • AdminRolesAndPermissionsTest: 7 new tests (article draft preview, ticket attachments, isStaff(), cross-section links hidden/shown, "Go to User" action).
  • New tests fail with the fixes reverted.
  • Blog, support ticket, plugin preview, Companies, course and Filament suites pass, apart from two PluginCategoriesTest tests that need the Imagick extension (missing locally, unrelated).
  • Checked in the browser as a plugin-review role: "View Listing Page" opens the pending plugin with the preview banner.

sonalidudhia and others added 2 commits October 29, 2026 12:05
The "View Listing Page" button on the plugin admin page links to the
public plugin page, which only let super admins and the owner see a
plugin that isn't approved and active. Staff whose role grants
View:Plugin saw the button but got a 404.

Check the plugin view permission instead, on both the plugin page and
its license page. Super admins keep access through the gate; customers
without the permission still get a 404.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
After roles shipped, several places still only let super admins in, so
staff with the right permission saw a button or link and then got a 404
or 403:

- Article "Preview" on drafts now needs View:Article
- Support ticket attachments open for anyone who can view the ticket
- Replies from any staff member get the "Staff" badge, via a new
  User::isStaff()

Links from one admin section to another (user, subscription, payout,
plugin, course module) are now hidden when the role can't open the
target, instead of leading to a 403. While there, fix the user link on
subscription items and the wall of love "user" action, which passed
the wrong record id.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@simonhamp
simonhamp merged commit 0c3a73d into NativePHP:main Oct 29, 2026
1 check passed
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