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

Public Member Functions

 __construct (Builder $aclBuilder)
 
 isAllowed ($roleId, $resourceId, $privilege=null)
 

Protected Attributes

 $_aclBuilder
 

Detailed Description

Definition at line 14 of file Acl.php.

Constructor & Destructor Documentation

◆ __construct()

__construct ( Builder  $aclBuilder)
Parameters
Builder$aclBuilder

Definition at line 24 of file Acl.php.

25  {
26  $this->_aclBuilder = $aclBuilder;
27  }

Member Function Documentation

◆ isAllowed()

isAllowed (   $roleId,
  $resourceId,
  $privilege = null 
)

Check whether given role has access to give id

Parameters
string$roleId
string$resourceId
string$privilege
Returns
bool

Implements PolicyInterface.

Definition at line 37 of file Acl.php.

38  {
39  try {
40  return $this->_aclBuilder->getAcl()->isAllowed($roleId, $resourceId, $privilege);
41  } catch (\Exception $e) {
42  try {
43  if (!$this->_aclBuilder->getAcl()->has($resourceId)) {
44  return $this->_aclBuilder->getAcl()->isAllowed($roleId, null, $privilege);
45  }
46  } catch (\Exception $e) {
47  }
48  }
49  return false;
50  }
$roleId
Definition: webapi_user.php:22

Field Documentation

◆ $_aclBuilder

$_aclBuilder
protected

Definition at line 19 of file Acl.php.


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