Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
RemoveAction.php
Go to the documentation of this file.
1 <?php
10 
12 
18 {
22  protected $registry;
23 
27  protected $protectedModels;
28 
33  public function __construct(\Magento\Framework\Registry $registry, array $protectedModels = [])
34  {
35  $this->registry = $registry;
36  $this->protectedModels = $protectedModels;
37  }
38 
45  public function isAllowed(AbstractModel $model)
46  {
47  $isAllowed = true;
48 
49  if ($this->registry->registry('isSecureArea')) {
50  $isAllowed = true;
51  } elseif (in_array($this->getBaseClassName($model), $this->protectedModels)) {
52  $isAllowed = false;
53  }
54 
55  return $isAllowed;
56  }
57 
63  protected function getBaseClassName($object)
64  {
65  $className = ltrim(get_class($object), "\\");
66  $className = str_replace(['\Interceptor', '\Proxy'], [''], $className);
67 
68  return $className;
69  }
70 }
elseif(isset( $params[ 'redirect_parent']))
Definition: iframe.phtml:17
$isAllowed
Definition: get.php:20
__construct(\Magento\Framework\Registry $registry, array $protectedModels=[])
if($currentSelectedMethod==$_code) $className
Definition: form.phtml:31