Magento Module: Lockdown

Just another access restriction module.

Details

This module was developed to restrict visitors from accessing areas of the website based on account status criteria. The merchant launched a private store view and needed a way to limit access to select areas.

Screenshots

Configuring restricted features

Configuring advanced restriction settings

Demo of add-to-cart restriction and matching settings

Technical Features

Code Sample

protected function _deny($route, $useGateway = false)
{
    // Write message to session
    if ( ($message = Mage::getStoreConfig('lockdown/advanced/redirect_message')) ) {
        $this->_getSession()->setLockdownMessage($message);
    }

    $redirectType = Mage::getStoreConfig('lockdown/advanced/redirect_type');

    // Force gateway redirects when specified
    if ( !$useGateway && $redirectType === Groove_Lockdown_Model_System_Config_Source_Redirecttype::TYPE_GATEWAY ) {
        $useGateway = true;
    }

    if ($useGateway) {
        return $this->_redirect('lockdown');
    }

    // Set return URL if necessary
    if (
            $redirectType === Groove_Lockdown_Model_System_Config_Source_Redirecttype::TYPE_LOGIN &&
            !Mage::getSingleton('customer/session')->getBeforeAuthUrl()
    ) {
        Mage::getSingleton('customer/session')->setBeforeAuthUrl(Mage::helper('core/url')->getCurrentUrl());
    }

    Mage::app()->getResponse()
        ->setRedirect(Mage::helper('groove_lockdown')->getRedirectUrl($route));

    return;
}

Static Analysis