I have created a magento extension. I want to implement access to the extension. The extension creates a page in frontend and i want only admin to access that page. So basically
The key to be able to use:
// Ensure we're in the admin session namespace for checking the admin user..
Mage::getSingleton('core/session', array('name' => 'adminhtml'))->start();
$admin_logged_in = Mage::getSingleton('admin/session', array('name' => 'adminhtml'))->isLoggedIn();
// ..get back to the original.
Mage::getSingleton('core/session', array('name' => $this->_sessionNamespace))->start();
is that the controller
must extends Mage_Adminhtml_Controller_Action
than you can use this code in the preDispatch
function.
And setup the routers
for this controller in the admin
section of your config.xml
.