Magento Extensions Rating 2024
EXTENSIONS BY CATEGORY
B2B (Business-To-Business)
Blog
Customer
ERP (Enterprise Resource Planning)
Mega Menu
One Step Checkout
Order
POS (Point Of Sale)
Search
Shopping Cart
Sitemap
SEO
Social
Stock & Inventory Management
EXTENSIONS BY DEVELOPER
aheadWorks
Amasty
Boost My Shop
BSS Commerce
Magestore
MageWorx
Mirasvit
Templates Master
Wyomind
XTENTO
Magento 2 Documentation
Magento 2 Documentation
2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
vendor
magento
module-customer
Model
Plugin
CustomerAuthorization.php
Go to the documentation of this file.
1
<?php
7
namespace
Magento\Customer\Model\Plugin
;
8
9
use
Magento\Authorization\Model\UserContextInterface
;
10
use
Magento\Integration\Api\AuthorizationServiceInterface
as AuthorizationService;
11
17
class
CustomerAuthorization
18
{
22
protected
$userContext
;
23
29
public
function
__construct
(
UserContextInterface
$userContext
)
30
{
31
$this->userContext =
$userContext
;
32
}
33
46
public
function
aroundIsAllowed
(
47
\
Magento
\Framework\Authorization $subject,
48
\Closure $proceed,
49
$resource
,
50
$privilege =
null
51
) {
52
if
(
$resource
== AuthorizationService::PERMISSION_SELF
53
&& $this->userContext->getUserId()
54
&& $this->userContext->getUserType() ===
UserContextInterface::USER_TYPE_CUSTOMER
55
) {
56
return
true
;
57
}
else
{
58
return
$proceed(
$resource
, $privilege);
59
}
60
}
61
}
Magento\Customer\Model\Plugin\CustomerAuthorization\$userContext
$userContext
Definition:
CustomerAuthorization.php:22
Magento\Customer\Model\Plugin\CustomerAuthorization\__construct
__construct(UserContextInterface $userContext)
Definition:
CustomerAuthorization.php:29
Magento\Authorization\Model\UserContextInterface
Definition:
UserContextInterface.php:15
Magento\Customer\Model\Plugin\CustomerAuthorization\aroundIsAllowed
aroundIsAllowed(\Magento\Framework\Authorization $subject, \Closure $proceed, $resource, $privilege=null)
Definition:
CustomerAuthorization.php:46
$resource
$resource
Definition:
bulk.php:12
Magento\Integration\Api\AuthorizationServiceInterface
Definition:
AuthorizationServiceInterface.php:17
Magento
Magento\Customer\Model\Plugin\CustomerAuthorization
Definition:
CustomerAuthorization.php:17
Magento\Authorization\Model\UserContextInterface\USER_TYPE_CUSTOMER
const USER_TYPE_CUSTOMER
Definition:
UserContextInterface.php:22
Magento\Customer\Model\Plugin
Definition:
AllowedCountries.php:7