title: Magento : How to check if admin is logged in within a module controller?
body: <p>I'm creating a Magento Module. Within the controller, I want to check if an admin is logged in or not. So the controller only will be accessible if there is a logged in admin.</p>
  
  <p>I'm trying to use this code on my controller.</p>
  
  <pre><code>Mage::getSingleton('core/session', array('name' =&gt; 'adminhtml')); 
  $session = Mage::getSingleton('admin/session');
  
  // Use the 'admin/session' object to check loggedIn status
  if ( $session-&gt;isLoggedIn() ) {
     echo "logged in";
  } else {
     echo "not logged in";
  }
  </code></pre>
  
  <p>but I always get "not logged in", even if I'm already logged in to the magento admin.</p>
  
  <p>Can anybody help me to resolve this issue?? any help will be much appreciated.
  Thanks</p>