fix: [ACL] fix wildcard controller checks failing

pull/79/head
iglocska 2021-11-28 23:42:22 +01:00
parent 7fa0537cfd
commit 22be309dc2
No known key found for this signature in database
GPG Key ID: BEA224F1FEF113AC
1 changed files with 10 additions and 0 deletions

View File

@ -267,9 +267,19 @@ class ACLComponent extends Component
return true; return true;
} }
//$this->__checkLoggedActions($user, $controller, $action); //$this->__checkLoggedActions($user, $controller, $action);
if (isset($this->aclList['*'][$action])) {
if ($this->evaluateAccessLeaf('*', $action)) {
return true;
}
}
if (!isset($this->aclList[$controller])) { if (!isset($this->aclList[$controller])) {
return $this->__error(404, __('Invalid controller.'), $soft); return $this->__error(404, __('Invalid controller.'), $soft);
} }
return $this->evaluateAccessLeaf($controller, $action);
}
private function evaluateAccessLeaf(string $controller, string $action): bool
{
if (isset($this->aclList[$controller][$action]) && !empty($this->aclList[$controller][$action])) { if (isset($this->aclList[$controller][$action]) && !empty($this->aclList[$controller][$action])) {
if (in_array('*', $this->aclList[$controller][$action])) { if (in_array('*', $this->aclList[$controller][$action])) {
return true; return true;