function CheckPermission()
 {
     $user = new User();
     $user->SetDatabase($this->database);
     $user->SetUsername($this->username);
     if ($this->password != "") {
         $user->SetPassword($this->password);
         $user->Encrypt();
     }
     if ($this->password_md5 != "") {
         $user->SetEncryptedPassword($this->password_md5);
     }
     if ($user->CheckPassword()) {
         $this->prof_id = $user->SelectProfile();
         $user->SelectByName();
         $select = "select modu_id from modules a, brun14.privileges b, users c, roles d " . "where a.modu_id = b.priv_modu_id " . "and c.user_id = " . $user->GetId() . " " . "and d.role_user_id = c.user_id " . "and d.role_prof_id = b.priv_prof_id " . "and b.priv_modu_id = a.modu_id " . "and a.modu_nick = \"" . $this->module_name . "\" " . "and c.user_active = 1";
         $result = $this->database->Execute($select);
         if ($result && mysql_num_rows($result) > 0) {
             return true;
         }
     }
     return false;
 }