1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2026-06-21 01:34:04 +00:00
tenancy/src/Middleware
lukinovec da7eb94c07
Remove redundant universal route check from PreventAccess MW (#1427)
The PreventAcessFromUnwantedDomains MW had the
`tenancy()->routeIsUniversal($route)` check either for returning early,
or it was a leftover from some older implementation, so I removed it.

The middleware aborts if the
`$this->accessingTenantRouteFromCentralDomain($request, $route) ||
$this->accessingCentralRouteFromTenantDomain($request, $route)` check
passes. Meaning, **for the middleware to abort, the route has to be
either in central or tenant mode**. When the route is in universal mode,
the middleware will never reach `return $abortRequest()`. `return
$next($request)` will always get reached, even when the `||
tenancy()->routeIsUniversal($route)` check is deleted from the previous
condition, so that check was basically useless.

Since the docblock for the class does mention the behavior for universal
routes explicitly, we've instead added a comment documenting that things
work this way. That's probably the most reasonable way to have this
explicit behavior for universal routes easily understandable in this
fairly complex logic without redundant code.

Resolves #1418

---------

Co-authored-by: Samuel Štancl <samuel@archte.ch>
2026-05-12 23:59:21 +02:00
..
CheckTenantForMaintenanceMode.php Fix code style (php-cs-fixer) 2025-10-14 15:26:19 +00:00
IdentificationMiddleware.php phpstan improvements 2022-09-29 15:07:16 +02:00
InitializeTenancyByDomain.php Fix code style (php-cs-fixer) 2024-11-09 19:54:56 +00:00
InitializeTenancyByDomainOrSubdomain.php Fix code style (php-cs-fixer) 2024-11-09 19:54:56 +00:00
InitializeTenancyByOriginHeader.php phpstan fix 2025-07-14 21:48:30 +02:00
InitializeTenancyByPath.php [4.x] General code cleanup (#1278) 2024-12-31 00:35:46 +01:00
InitializeTenancyByRequestData.php [4.x] URL generation, request data identification improvements (#1357) 2025-06-02 03:43:47 +02:00
InitializeTenancyBySubdomain.php Fix origin id w/ empty header & using full-hostname subdomain records 2024-11-09 20:48:45 +01:00
PreventAccessFromUnwantedDomains.php Remove redundant universal route check from PreventAccess MW (#1427) 2026-05-12 23:59:21 +02:00
ScopeSessions.php [4.x] Make ScopeSessions usable on universal routes (#1342) 2025-04-04 03:15:37 +02:00