Merge branch 'master' of github.com:yiisoft/yii2 into 7754-google-auth

This commit is contained in:
Klimov Paul
2015-03-19 11:55:08 +02:00
4 changed files with 157 additions and 122 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 14 KiB

View File

@ -4,7 +4,7 @@ Yii Framework 2 debug extension Change Log
2.0.4 under development
-----------------------
- no changes in this release.
- Enh #7655: Added ability to filter access by hostname (thiagotalma)
2.0.3 March 01, 2015

View File

@ -30,6 +30,13 @@ class Module extends \yii\base\Module implements BootstrapInterface
* by localhost.
*/
public $allowedIPs = ['127.0.0.1', '::1'];
/**
* @var array the list of hosts that are allowed to access this module.
* Each array element is a hostname that will be resolved to an IP address that is compared
* with the IP address of the user. A use case is to use a dynamic DNS (DDNS) to allow access.
* The default value is `[]`.
*/
public $allowedHosts = [];
/**
* @inheritdoc
*/
@ -197,6 +204,12 @@ class Module extends \yii\base\Module implements BootstrapInterface
return true;
}
}
foreach ($this->allowedHosts as $hostname) {
$filter = gethostbyname($hostname);
if ($filter === $ip) {
return true;
}
}
Yii::warning('Access to debugger is denied due to IP address restriction. The requesting IP address is ' . $ip, __METHOD__);
return false;
}