mirror of
https://github.com/archtechx/tenancy.git
synced 2026-09-20 13:54:03 +00:00
Throw an exception in possibleTenantSymlinks if the disk is not tenant-aware
When a disk in url_override and root_override is absent from tenancy.filesystem.disks, FilesystemTenancyBootstrapper leaves its root unchanged, possibleTenantSymlinks allows creating a symlink for that unscoped disk (= a disk with a central root), which can expose shared files. Fixed by throwing an exception in possibleTenantSymlinks saying that the disk should be tenant-aware (= included in the tenancy.filesystem.disks config).
This commit is contained in:
parent
b6e6aa634c
commit
0eb2cf18a4
1 changed files with 6 additions and 0 deletions
|
|
@ -50,6 +50,12 @@ trait DealsWithTenantSymlinks
|
||||||
throw new Exception("Disk $disk is not a local disk. Only local disks can be symlinked.");
|
throw new Exception("Disk $disk is not a local disk. Only local disks can be symlinked.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (! in_array($disk, config('tenancy.filesystem.disks'), true)) {
|
||||||
|
// The bootstrapper only scopes disks listed in tenancy.filesystem.disks. Without that,
|
||||||
|
// the disk root stays central, and the symlink of every tenant would point to it.
|
||||||
|
throw new Exception("Disk $disk is not tenant-aware. Add it to the tenancy.filesystem.disks config to make its root tenant-specific.");
|
||||||
|
}
|
||||||
|
|
||||||
$publicPath = str_replace('%tenant%', (string) $tenantKey, $publicPath);
|
$publicPath = str_replace('%tenant%', (string) $tenantKey, $publicPath);
|
||||||
|
|
||||||
$symlinks[public_path($publicPath)] = $tenantDisks[$disk]['root'];
|
$symlinks[public_path($publicPath)] = $tenantDisks[$disk]['root'];
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue