shanerbaner82/panel-roles
Panel Roles is a Laravel package for managing roles and permissions inside Filament panels. Define roles, assign them to users, and restrict access to panel resources and pages with an easy-to-configure setup that keeps authorization consistent across your admin panels.
What changed in v0.0.3. The plugin now requires two pieces of configuration at registration time: roleToAssign() (the role granted to newly provisioned users) and restrictedRoles() (the roles treated as privileged/limited). Previously these were presumably optional or defaulted. This is a breaking change to the public configuration surface, shipped inside a 0.0.x line where semver permits it but consumers rarely expect it.
Architecture fit. PanelRoles is a thin Filament panel plugin that wraps a role/permission backend (almost certainly spatie/laravel-permission) and hooks Filament's panel access and resource authorization. That is a good architectural shape: it keeps role logic out of resources and centralizes it in the PanelProvider, which is where Filament already expects panel-scoped policy. The move to mandatory, explicit configuration is directionally correct from a security standpoint — implicit role assignment is exactly the kind of default that causes privilege-escalation incidents. The cost is that a security decision is now encoded in a PHP class rather than in config/ or the database, which has real consequences for multi-tenant and multi-panel deployments.
Integration feasibility. Low-to-moderate effort for a single-panel app: two fluent calls in AdminPanelProvider. It becomes non-trivial when you have multiple panels (AdminPanelProvider, AppPanelProvider, etc.), because each panel now needs its own decision about which roles are restricted and what new users get — and there is no evidence yet of a per-panel config abstraction, environment override, or config-cache-friendly path.
Technical risk.
restrictedRoles([]) could plausibly mean "nobody is restricted" (fail-open, dangerous) or "everyone is restricted" (fail-closed, safe). This must be verified by test, not by reading the changelog.Key questions for the maintainer / spike.
roleToAssign/restrictedRoles throw, log, or silently no-op? What is the exact exception and when is it raised?roleToAssign('developer') create the role if it is absent, or assume it exists from a seeder?restrictedRoles deny-list semantics (these roles are limited) or allow-list (only these roles are privileged)? The naming is ambiguous and the blast radius differs enormously.FilamentUser::canAccessPanel() and with policies that already exist? Which wins on conflict?Stack fit. Assumes Laravel 10/11, Filament v3, spatie/laravel-permission. If any of those drift (notably a Filament v4 move), expect to be blocked until the plugin catches up — a thin plugin is fast to fork, which is both the mitigation and the warning sign.
Migration path from 0.0.2 (or from hand-rolled role checks).
composer.json with an explicit constraint; do not use ^0.0 if you have any tolerance for surprise.PanelProvider that registers the plugin — grep for PanelRoles::make() to find them all.roleToAssign() and restrictedRoles() exist as seeded data in every environment, including the ephemeral CI and preview environments. This is the most likely source of a broken deploy.Compatibility. No stated Laravel/Filament version matrix in these notes. Confirm before upgrading; a pre-1.0 package that adds required config is also a package likely to change constructor signatures.
Sequencing.
roleToAssign('developer') but the developer role does not exist yet, you may fail at boot or at first user creation.Maintenance. This is a small dependency with a disproportionately sharp edge: it sits on the authorization path for the admin panel. Treat upgrades as security-relevant changes, not routine composer update noise. Realistic ongoing cost is low in code volume but non-zero in attention — an hour or two per release to re-verify semantics, plus the risk of an unannounced break.
Support. Pre-1.0, single-maintainer, GitHub-issues support. No SLA, no LTS branch, no security policy evident. Mitigation: the package is thin enough to vendor or fork in an afternoon if it is abandoned or a CVE goes unanswered. Keep that option open — do not let it become load-bearing for anything the fork could not replicate.
Scaling. Negligible performance impact; role checks are cached by the underlying permission package. The scaling concern is organizational, not computational: mandatory per-panel configuration does not scale cleanly past a handful of panels without someone owning the matrix.
Failure modes to plan for.
restrictedRoles → silent privilege escalation, discovered by audit rather than by error. Highest-severity scenario here.permission:cache-reset.Ramp-up. Very low for a developer already fluent in Filament panel configuration — the change is two fluent calls. The learning cost is entirely in semantics, not syntax: what "restricted" means, what happens on empty input, and where roleToAssign fires. Budget a half-day for the first integrator to answer the six questions above empirically, and write the answers into your own README so the next person does not repeat the spike.
Recommendation. Adopt for internal/admin tooling where a broken panel is an inconvenience; add the boot smoke test and pin the version. Do not adopt on a customer-facing authorization path, and do not upgrade past 0.0.2 without first confirming restrictedRoles([]) behaviour — that single unanswered question is the difference between a useful plugin and an access-control incident.
How can I help you explore Laravel packages today?