Merge branch 'whitelist' into 'master'

whitelist for submodules

See merge request composer/PHP_Library!4
This commit is contained in:
Федор Подлеснов 2022-01-11 13:23:11 +00:00
commit 55a6560634

View file

@ -166,9 +166,11 @@ class Filter_Login extends Filter_Filter
$module = $request->get('module'); $module = $request->get('module');
$action = $request->get('action'); $action = $request->get('action');
$file = Path::join(CMS_PATH, 'modules', $module, 'filters', 'white.json'); $moduleDir = explode('_',$module)[0];
$file = Path::join(CMS_PATH, 'modules', $moduleDir, 'filters', 'white.json');
if (file_exists($file)) { if (file_exists($file)) {
$whiteList = json_decode(file_get_contents($file), true); $whiteList = json_decode(file_get_contents($file), true);
if (in_array($action, $whiteList)) { if (in_array($action, $whiteList)) {
return true; return true;
} }
@ -177,4 +179,3 @@ class Filter_Login extends Filter_Filter
return false; return false;
} }
} }