/**
  * Gets called on a authenication request. This method should check sessions or simmilar to
  * verify that the user has access to the backend.
  *
  * This method should return true if the current request is authenicated or false if it's not.
  *
  * @param ManagerEngine $man ManagerEngine reference that the plugin is assigned to.
  * @return bool true/false if the user is authenticated.
  */
 function onAuthenticate(&$man)
 {
     global $moozCMS;
     $config =& $man->getConfig();
     $moozCMSConfig = $moozCMS->getConfig();
     // Override with CMS options
     $prefix = $man->getType() == 'fm' ? 'filemanager' : 'imagemanager';
     foreach ($moozCMSConfig as $key => $value) {
         if (strpos($key, $prefix . '.') === 0) {
             $config[preg_replace('/^' . $prefix . '\\./', '', $key)] = $value;
         }
     }
     return $moozCMS->isAuthenticated();
 }