Skip to content

Commit

Permalink
Merge pull request #140 from dereuromark/pr/139
Browse files Browse the repository at this point in the history
Pr/139
  • Loading branch information
dereuromark authored Jul 13, 2022
2 parents 5ef9556 + 63c936f commit b096ffe
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 5 deletions.
20 changes: 16 additions & 4 deletions src/Auth/AllowTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,23 @@ protected function _getAllowRule(array $params) {
$allowDefaults = $this->_getAllowDefaultsForCurrentParams($params);

foreach ($rules as $rule) {
if ($params['plugin'] && $params['plugin'] !== $rule['plugin']) {
continue;
if (isset($params['plugin']) && ($params['plugin'] !== null)) {
if ($params['plugin'] !== $rule['plugin']) {
continue;
}
} else {
if (!empty($rule['plugin'])) {
continue;
}
}
if (!empty($params['prefix']) && $params['prefix'] !== $rule['prefix']) {
continue;
if (isset($params['prefix']) && ($params['prefix'] !== null)) {
if ($params['prefix'] !== $rule['prefix']) {
continue;
}
} else {
if (!empty($rule['prefix'])) {
continue;
}
}
if ($params['controller'] !== $rule['controller']) {
continue;
Expand Down
11 changes: 10 additions & 1 deletion src/Controller/Component/AuthenticationComponent.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,16 @@ public function isPublic(array $url = []) {
* @return void
*/
protected function _prepareAuthentication() {
$rule = $this->_getAllowRule($this->_registry->getController()->getRequest()->getAttribute('params'));
$params = $this->_registry->getController()->getRequest()->getAttribute('params');
if (!isset($params['plugin'])) {
$params['plugin'] = null;
}
if (!isset($params['prefix'])) {
$params['prefix'] = null;
}

$rule = $this->_getAllowRule($params);

if (!$rule) {
return;
}
Expand Down

0 comments on commit b096ffe

Please sign in to comment.