Skip to content

Commit b979e0a

Browse files
committed
Refactor: GuestAuthorization plugin
1 parent 3ee2bd5 commit b979e0a

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

app/code/Magento/Webapi/Model/Plugin/GuestAuthorization.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6+
declare(strict_types=1);
67

78
namespace Magento\Webapi\Model\Plugin;
89

@@ -11,7 +12,7 @@
1112
/**
1213
* Plugin around \Magento\Framework\Authorization::isAllowed
1314
*
14-
* Plugin to allow guest users to access resources with anonymous permission
15+
* Allow guest users to access resources with "anonymous" resource
1516
*/
1617
class GuestAuthorization
1718
{
@@ -22,8 +23,7 @@ class GuestAuthorization
2223
* @param \Closure $proceed
2324
* @param string $resource
2425
* @param string $privilege
25-
* @return bool true If resource permission is anonymous,
26-
* to allow any user access without further checks in parent method
26+
* @return bool Is resource permission "anonymous", to allow any user access without further checks in parent method
2727
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
2828
*/
2929
public function aroundIsAllowed(
@@ -32,10 +32,10 @@ public function aroundIsAllowed(
3232
$resource,
3333
$privilege = null
3434
) {
35-
if ($resource == AuthorizationService::PERMISSION_ANONYMOUS) {
35+
if ($resource === AuthorizationService::PERMISSION_ANONYMOUS) {
3636
return true;
37-
} else {
38-
return $proceed($resource, $privilege);
3937
}
38+
39+
return $proceed($resource, $privilege);
4040
}
4141
}

0 commit comments

Comments
 (0)