epubli4/permission-bundle
Symfony bundle that eases permission handling for e4 microservices using API Platform. Install with Composer, configure your microservice name and permission export/aggregation routes, then enable the Doctrine self-permission filter. Works with l0wskilled/api-platform-test for unit tests.
SelfPermissionFilter and SelfPermissionInterface support row-level "only my records" filtering. This informs decisions about whether you need per-object scoping (multi-tenant dashboards, "my orders" endpoints) vs. plain resource-level permissions.collectionOperations, security_post_denormalize, _api_resource_class). Adopting it pins your roadmap to APIP2 semantics; migrating to API Platform 3 (attributes) would require forking or rewriting the integration points.JWTMockTrait and UnitTestTrait helpers signal a testing-first posture — useful for deciding how much to invest in permission-matrix test coverage vs. manual QA for authorization.Consider (or at least study) it when:
{user_id}.SQLFilter — the SelfPermissionInterface/SelfPermissionTrait pattern is a clean reference.AccessToken), plus annotations to declare custom permissions on controller methods.JWTMockTrait, UnitTestTrait, and unit-test config/data DTOs are genuinely useful patterns even if you reimplement them.Look elsewhere when:
spatie/laravel-permission or a policy engine (OPA/Cedar) instead.To executives: This is a small, abandoned-but-useful Symfony bundle that shows how to run federated permissions across microservices — each service owns its permission keys, and a central user service aggregates them per user. Stars (3), dependents (0), and a 2021 last release mean we should treat it as a design reference, not a vendor dependency. Recommendation: adopt the pattern and a few classes (the Doctrine self-permission filter, the JWT access-token service, the test helpers) into an internal package we own, rather than adding a stale third-party dependency to production. Cost of adoption is low; cost of being stuck on it is high because it's pinned to API Platform 2.x annotation conventions. Expected effort to internalize: modest — most of the value is in a few hundred lines of straightforward Symfony/Doctrine code.
To engineering: It gives you a working blueprint for cross-service permissions on API Platform: epubli_permission.yaml config (microservice name, export route, aggregated-permissions route), the SelfPermissionFilter Doctrine filter for row-level "my records only" scoping, an injectable AccessToken service (JTI, user id, hasPermissionKey()), and @Permission annotations for declaring controller-level permissions with automatic service-name prefixes. The testing tooling (JWTMockTrait, UnitTestTrait, unit-test config DTOs) is worth reusing almost verbatim. Caveats: it targets API Platform 2.x annotations, is tied to the original author's l0wskilled/api-platform-test for tests, and has no maintainer activity since mid-2021. Pitch: vendor a trimmed fork (or re-implement the ~5 classes we actually need) with our own CI and API Platform 3 attribute support, and keep the permission-export/aggregation contract as documented internal API.
How can I help you explore Laravel packages today?