本文整理汇总了PHP中Gems_Util::isAllowedIP方法的典型用法代码示例。如果您正苦于以下问题:PHP Gems_Util::isAllowedIP方法的具体用法?PHP Gems_Util::isAllowedIP怎么用?PHP Gems_Util::isAllowedIP使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Gems_Util
的用法示例。
在下文中一共展示了Gems_Util::isAllowedIP方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: authorizeOrgIp
/**
* Checks if the user is allowed to login using the current IP address
* according to his BASE organization
*
* An adapter authorizes and if the end resultis boolean, string or array
* it is converted into a \Zend_Auth_Result.
*
* @return mixed \Zend_Auth_Adapter_Interface|\Zend_Auth_Result|boolean|string|array
*/
protected function authorizeOrgIp()
{
//special case: project user should have no restriction
if ($this->project->getSuperAdminName() == $this->getLoginName()) {
return true;
}
//In unit test REMOTE_ADDR is not available and will return null
$request = $this->getRequest();
// E.g. command line user
if (!$request instanceof \Zend_Controller_Request_Http) {
return true;
}
$remoteIp = $request->getServer('REMOTE_ADDR');
if ($this->util->isAllowedIP($remoteIp, $this->getBaseOrganization()->getAllowedIpRanges())) {
return true;
}
return $this->_('You are not allowed to login from this location.');
}
示例2: testAllowedIPEmptyRange
public function testAllowedIPEmptyRange()
{
$this->assertTrue($this->object->isAllowedIP('127.0.0.1', ''));
}