agroezinger/filament-shield-enhanced
Enhanced roles and permissions for Filament panels. Extends Filament Shield with a cleaner UI, granular permission management, and flexible configuration, so you can control access across resources, pages, and widgets with less setup and fewer surprises.
Assessment basis: v0.2.0 release notes; no prior assessment exists. Treat this as an initial evaluation, not a re-assessment.
Architecture fit. The package extends Filament Shield rather than replacing it, adding a third fine-grained permission category for arbitrary Livewire components that are not registered with a Filament panel. That is a meaningful architectural gap: Pages, Resources, and Widgets have panel registries to enumerate, but shared widgets included via @livewire(...) do not. The implementation follows Shield conventions: HasComponentShield trait, ComponentPermissionKeyBuilder using the same {Prefix}:{Action}:{Subject} key format as pages, a generator command, and a form component for the published RoleResource. The capability was extracted from a project-local fork, which suggests it is battle-tested in at least one real application, but also that the addon is still maturing.
Integration feasibility. Feasible for a Laravel/Filament/Shield/Spatie stack, but not drop-in. Adoption requires publishing or modifying RoleResource, adding traits to the authenticatable model and role form, configuring components.scan_paths, and running shield:generate-enhanced-components. The additive permission category means existing Page and Resource permissions should remain unaffected, so a staged pilot is practical. The main integration effort is establishing conventions for component discovery and permission keys, not the package install itself.
Technical risk. Moderate. Component discovery is scan-based because there is no registry; that is inherently heuristic and may miss dynamically aliased components, vendor components, anonymous components, or components outside configured paths. The key format can drift when components or actions are renamed, leaving stale permissions. The canShield() fix is operationally safer because missing permissions now return false instead of throwing PermissionDoesNotExist, but it also converts a loud misconfiguration into a silent denial. Routing through can() instead of Spatie's hasPermissionTo() may also change outcomes where Gate policies and Spatie permissions are not aligned. Pre-1.0 versioning implies API instability. The release notes do not state test coverage, supported Filament/Shield versions, or multi-tenancy behavior.
Key questions.
@livewire('alias') usage, class references, and namespaced components, or only PHP classes under configured paths?can() fallback consistently consult Gate policies, and what happens when a Gate policy and a Spatie permission disagree?RoleResource customizations?Stack fit. The package is designed for Laravel applications using Filament Shield and Spatie permissions. It fits best where non-panel Livewire components are shared across pages and currently rely on ad hoc Gate checks or manual permission strings. If the application has no such components, the new category adds complexity without corresponding value.
Migration path. Treat v0.2.0 as an additive pilot. Install and pin the version in a non-production environment, publish the package assets/configuration, and diff the published RoleResource against the existing application copy. Add HasComponentShield to the relevant user model and HasEnhancedRoleForm to the role form. Configure components.scan_paths to include only application-owned component directories, run shield:generate-enhanced-components, assign the generated permissions to a test role, and verify both allowed and denied access paths for a representative shared widget. Existing Page and Resource permissions should not need regeneration, but the canShield() behavior change should be tested explicitly for users with missing or renamed permissions.
Compatibility. Confirm the package's Filament and Shield major-version compatibility before adoption. Check whether the host application has customized RoleResource or overridden Shield's role form; merging EnhancedComponentPermissionsForm into a heavily customized resource is the most likely integration friction. Confirm that components.scan_paths covers the actual component layout, including module or package directories if used. Audit any code that depended on PermissionDoesNotExist being thrown; the new fallback to false changes error handling semantics.
Sequencing.
components.scan_paths.HasComponentShield and HasEnhancedRoleForm; reconcile RoleResource customizations.Maintenance. The generator must be rerun whenever components, actions, or scan paths change. That creates a recurring maintenance task and a drift risk between code and permission rows. Stale permissions should be reviewed periodically. Because the package is pre-1.0, expect upgrade work; pinning versions and tracking release notes is necessary.
Support. The package has a smaller support surface than Filament Shield itself and originates from a project-local fork. Internal ownership is required: someone must understand the key format, generator behavior, and RoleResource integration. External documentation may lag the code. Upgrades to Filament or Shield should trigger a compatibility check against this addon.
Scaling. Permission count grows with components multiplied by actions. That affects the role editing UI, permission table size, and Spatie's permission cache. The scan-based generator itself is a build-time concern and should scale acceptably, but the role form may need grouping, search, or pagination for large permission sets. Multi-tenant installations need a clear decision on whether component permissions are global or tenant-scoped.
Failure modes.
canShield() to return false.RoleResource is not updated with EnhancedComponentPermissionsForm, so administrators cannot assign the new permissions.can() routing produces different authorization outcomes.canShield() fix masks a missing generator run because the previous exception is no longer raised.Ramp-up. The team needs working knowledge of Shield's permission key model, Filament panel versus non-panel Livewire components, and the regeneration workflow. A short enablement session plus an internal runbook covering "add component, configure path, regenerate, assign role, verify denial" is sufficient for a pilot. Broad rollout should wait until the authorization matrix and upgrade path are validated in staging.
How can I help you explore Laravel packages today?