/** * 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.'); }
/** * Check: is this user the super user defined * in project.ini? * * @param string $login_name * @return boolean */ protected function isProjectUser($login_name) { return $this->project->getSuperAdminName() == $login_name; }