1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2025-12-12 23:54:04 +00:00

Stop bypassing tenancy initializition when domain is central in domain ID MW (#24)

* Stop bypassing tenancy initialization when host is central domain in domain ID MW

* Delete dataset for testing global domain ID MW + route-level prevent access MW

* Provide ID MW statically in TenantAssetController

* Fix code style (php-cs-fixer)

---------

Co-authored-by: PHP CS Fixer <phpcsfixer@example.com>
This commit is contained in:
lukinovec 2024-01-03 23:35:49 +01:00 committed by GitHub
parent 00a00a2aff
commit df9324b92f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 12 additions and 24 deletions

View file

@ -31,11 +31,6 @@ class InitializeTenancyByDomain extends IdentificationMiddleware implements Usab
return $next($request);
}
if (in_array($request->getHost(), config('tenancy.central_domains', []), true)) {
// Always bypass tenancy initialization when host is in central domains
return $next($request);
}
return $this->initializeTenancy(
$request,
$next,

View file

@ -15,18 +15,13 @@ class InitializeTenancyByDomainOrSubdomain extends InitializeTenancyBySubdomain
{
use UsableWithEarlyIdentification;
/** @return \Illuminate\Http\Response|mixed */
/** @return Response|mixed */
public function handle(Request $request, Closure $next): mixed
{
if ($this->shouldBeSkipped(tenancy()->getRoute($request))) {
return $next($request);
}
if (in_array($request->getHost(), config('tenancy.central_domains', []), true)) {
// Always bypass tenancy initialization when host is in central domains
return $next($request);
}
$domain = $request->getHost();
if ($this->isSubdomain($domain)) {

View file

@ -35,11 +35,6 @@ class InitializeTenancyBySubdomain extends InitializeTenancyByDomain
return $next($request);
}
if (in_array($request->getHost(), config('tenancy.central_domains', []), true)) {
// Always bypass tenancy initialization when host is in central domains
return $next($request);
}
$subdomain = $this->makeSubdomain($request->getHost());
if (is_object($subdomain) && $subdomain instanceof Exception) {