/**
  * Determine a users permission for a template
  * 
  * This will return the permissions for the user specified by $user for 
  * the template specified by $templateID. These permissions found using 
  * calls to {@link getDetailedUserrealmAccess}
  * 
  * @param mixed $user The user id or name
  * @param int $templateID The template ID
  * @return boolean True/false if access is allowed/denied respectively
  */
 public static function templateAccessAllowed($templateID, $user)
 {
     global $cfg;
     BasicLogger::logMessage("Checking template access for user: {$user} for templateID: {$templateID}", self::module, "debug");
     $db = Database::getInstance($cfg['Auth']['dsn']);
     if (eval("return " . $cfg['Auth']['authUtilClassModule'] . "::isUserID({$user});")) {
         $uid = $user;
     } else {
         $uid = AuthUtil::getUserID($user);
     }
     $ridsql = "SELECT realmid FROM templates WHERE templateid = '{$templateID}'";
     $realm = $db->getOne($ridsql);
     $allow = false;
     $realmPath = eval("return " . $cfg['Auth']['authUtilClassModule'] . "::getRealmPath({$realm});");
     $access = AuthUtil::getDetailedUserrealmAccess($realmPath, $uid);
     if ($access) {
         $allow = true;
     }
     BasicLogger::logMessage("Template access for user: {$user} for templateID: {$templateID} is {$allow}", self::module, "debug");
     return $allow;
 }
 /**
  * Sets/updates the user/userID class variables respectively
  *
  * @param string $username The username to be stored
  */
 private function setUser($username)
 {
     $this->user = $username;
     if (is_null($username)) {
         $this->userID = null;
     } else {
         $this->userID = AuthUtil::getUserID($username);
     }
 }