Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Public Member Functions | Data Fields
Data Class Reference
Inheritance diagram for Data:
AbstractHelper

Public Member Functions

 isDevAllowed ($storeId=null)
 
- Public Member Functions inherited from AbstractHelper
 __construct (Context $context)
 
 isModuleOutputEnabled ($moduleName=null)
 

Data Fields

const XML_PATH_DEV_ALLOW_IPS = 'dev/restrict/allow_ips'
 

Additional Inherited Members

- Protected Member Functions inherited from AbstractHelper
 _getRequest ()
 
 _getModuleName ()
 
 _getUrl ($route, $params=[])
 
- Protected Attributes inherited from AbstractHelper
 $_moduleName
 
 $_request
 
 $_moduleManager
 
 $_logger
 
 $_urlBuilder
 
 $_httpHeader
 
 $_eventManager
 
 $_remoteAddress
 
 $urlEncoder
 
 $urlDecoder
 
 $scopeConfig
 
 $_cacheConfig
 

Detailed Description

Developer config data helper

@api

Since
100.0.2

Definition at line 14 of file Data.php.

Member Function Documentation

◆ isDevAllowed()

isDevAllowed (   $storeId = null)

Check if the client remote address is allowed developer ip

Parameters
string | null$storeId
Returns
bool

Definition at line 27 of file Data.php.

28  {
29  $allow = true;
30 
31  $allowedIps = $this->scopeConfig->getValue(
32  self::XML_PATH_DEV_ALLOW_IPS,
33  \Magento\Store\Model\ScopeInterface::SCOPE_STORE,
34  $storeId
35  );
36  $remoteAddr = $this->_remoteAddress->getRemoteAddress();
37  if (!empty($allowedIps) && !empty($remoteAddr)) {
38  $allowedIps = preg_split('#\s*,\s*#', $allowedIps, null, PREG_SPLIT_NO_EMPTY);
39  if (array_search($remoteAddr, $allowedIps) === false
40  && array_search($this->_httpHeader->getHttpHost(), $allowedIps) === false
41  ) {
42  $allow = false;
43  }
44  }
45 
46  return $allow;
47  }

Field Documentation

◆ XML_PATH_DEV_ALLOW_IPS

const XML_PATH_DEV_ALLOW_IPS = 'dev/restrict/allow_ips'

Dev allow ips config path

Definition at line 19 of file Data.php.


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