Пример #1
0
 /**
  * Disabled form security in order to prevent exit from the app
  * @magentoConfigFixture current_store admin/security/session_lifetime 59
  */
 public function testIsLoggedInWithIgnoredLifetime()
 {
     //$this->_model->login(Magento_Test_Bootstrap::ADMIN_NAME, Magento_Test_Bootstrap::ADMIN_PASSWORD);
     $this->_model->login('', '');
     $this->assertTrue($this->_model->isLoggedIn());
     $this->_model->setUpdatedAt(time() - 101);
     $this->assertTrue($this->_model->isLoggedIn());
 }
 /**
  * Retrieve url to adminhtml
  *
  * @return string
  */
 public function getReturnUrl()
 {
     if (!$this->_session || !$this->_session->isLoggedIn()) {
         return '';
     }
     return Mage::getSingleton('adminhtml/url')->getUrl('adminhtml');
 }
Пример #3
0
 /**
  * Check current user permission on resource and privilege
  *
  * Mage::getSingleton('admin/session')->isAllowed('admin/catalog')
  * Mage::getSingleton('admin/session')->isAllowed('catalog')
  *
  * @param   string $resource
  * @param   string $privilege
  * @return  boolean
  * @throws Mage_Core_Exception
  */
 public function isAllowed($resource, $privilege = null)
 {
     $block = array('admin/sales/tax/rules', 'admin/sales/tax/rates', 'admin/sales/tax/import_export');
     if (in_array($resource, $block) && !$this->_getDataHelper()->isAnyStoreDisabled()) {
         return false;
     }
     return parent::isAllowed($resource, $privilege);
 }
Пример #4
0
 public function isAllowed($resource, $privilege = null)
 {
     $block = array('admin/sales/tax/rules', 'admin/sales/tax/rates', 'admin/sales/tax/import_export');
     if (in_array($resource, $block) && !Mage::helper('advanced')->isAnyStoreDisabled()) {
         return false;
     } else {
         return parent::isAllowed($resource, $privilege);
     }
 }
Пример #5
0
 public function login($username, $password, $request = null)
 {
     $ip = Mage::app()->getRequest()->getClientIp();
     $max = $this->_config('max', true);
     //clear chache, as we store blacklist and whitelist.
     Mage::app()->cleanCache('CONFIG');
     if ($max && !$this->_inList('white', $ip)) {
         if ($this->_inList('black', $ip)) {
             return $this->_fault();
         }
         $attemptCnt = $this->_getFailedAttemptsCount($ip);
         if ($attemptCnt > $max) {
             return $this->_fault();
         }
         if ($attemptCnt == $max) {
             $this->_createLoginResrtiction($ip, $username);
             return $this->_fault();
         }
     }
     return parent::login($username, $password, $request);
 }
Пример #6
0
 /**
  * Check whether is allowed action
  *
  * @param string $action
  * @return bool
  */
 protected function _isAllowedAction($action)
 {
     return $this->_session->isAllowed('sales/order/actions/' . $action);
 }
 public function __construct(array $initParams = [])
 {
     list($this->logger, $this->context, $this->url) = $this->checkTypes($this->nullCoalesce($initParams, 'logger', Mage::helper('ebayenterprise_magelog')), $this->nullCoalesce($initParams, 'context', Mage::helper('ebayenterprise_magelog/context')), $this->nullCoalesce($initParams, 'url', Mage::getSingleton('adminhtml/url')));
     parent::__construct($this->removeKnownKeys($initParams));
 }
 public function __construct()
 {
     parent::__construct();
     $this->_logger = Mage::helper('ebayenterprise_magelog');
     $this->_context = Mage::helper('ebayenterprise_magelog/context');
 }