Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Public Member Functions | Protected Attributes
Authorization Class Reference
Inheritance diagram for Authorization:
AuthorizationInterface AuthorizationMock AuthorizationMock AuthorizationMock

Public Member Functions

 __construct (\Magento\Framework\Authorization\PolicyInterface $aclPolicy, \Magento\Framework\Authorization\RoleLocatorInterface $roleLocator)
 
 isAllowed ($resource, $privilege=null)
 

Protected Attributes

 $_aclPolicy
 
 $_aclRoleLocator
 

Detailed Description

Definition at line 10 of file Authorization.php.

Constructor & Destructor Documentation

◆ __construct()

Parameters
\Magento\Framework\Authorization\PolicyInterface$aclPolicy
\Magento\Framework\Authorization\RoleLocatorInterface$roleLocator

Definition at line 30 of file Authorization.php.

33  {
34  $this->_aclPolicy = $aclPolicy;
35  $this->_aclRoleLocator = $roleLocator;
36  }

Member Function Documentation

◆ isAllowed()

isAllowed (   $resource,
  $privilege = null 
)

Check current user permission on resource and privilege

Parameters
string$resource
string$privilege
Returns
boolean

Implements AuthorizationInterface.

Definition at line 45 of file Authorization.php.

46  {
47  return $this->_aclPolicy->isAllowed($this->_aclRoleLocator->getAclRoleId(), $resource, $privilege);
48  }
$resource
Definition: bulk.php:12

Field Documentation

◆ $_aclPolicy

$_aclPolicy
protected

Definition at line 17 of file Authorization.php.

◆ $_aclRoleLocator

$_aclRoleLocator
protected

Definition at line 24 of file Authorization.php.


The documentation for this class was generated from the following file: