Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
CustomerAuthorization.php
Go to the documentation of this file.
1 <?php
8 
11 
18 {
22  protected $userContext;
23 
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 }
aroundIsAllowed(\Magento\Framework\Authorization $subject, \Closure $proceed, $resource, $privilege=null)
$resource
Definition: bulk.php:12