fix(vikon): check writability only for module dirs (sveden, abitur, vsoko)
This commit is contained in:
@@ -32,11 +32,21 @@ class CheckAccessAction
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
$nonWritable = $this->findNonWritable($this->publicPath);
|
$modulePaths = array_map(
|
||||||
|
fn($m) => $this->publicPath . '/' . $m['path'],
|
||||||
|
config('vikon.modules')
|
||||||
|
);
|
||||||
|
|
||||||
|
$nonWritable = [];
|
||||||
|
foreach ($modulePaths as $mp) {
|
||||||
|
if (is_dir($mp) && !is_writable($mp)) {
|
||||||
|
$nonWritable[] = str_replace(base_path() . '/', '', $mp);
|
||||||
|
}
|
||||||
|
}
|
||||||
if (!empty($nonWritable)) {
|
if (!empty($nonWritable)) {
|
||||||
return [
|
return [
|
||||||
'has_access' => false,
|
'has_access' => false,
|
||||||
'error' => 'Нет прав на запись: ' . implode(', ', array_slice($nonWritable, 0, 3)),
|
'error' => 'Нет прав на запись: ' . implode(', ', $nonWritable),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -53,6 +63,8 @@ class CheckAccessAction
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private function findNonWritable(string $path, int $depth = 0): array
|
private function findNonWritable(string $path, int $depth = 0): array
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user