Ejemplo n.º 1
0
 function EnumerateRoles2($paramSet)
 {
     try {
         $this->unitTestParamVm->Execute("Select ParamValue from Params WHERE ParamSet={$paramSet} AND ParamName=\"USER\"");
         $this->arrayParam["USER"] = $this->unitTestParamVm->GetString("ParamValue");
         $this->unitTestParamVm->Execute("Select ParamValue from Params WHERE ParamSet={$paramSet} AND ParamName=\"LOGIN\"");
         $this->arrayParam['LOGIN'] = $this->unitTestParamVm->GetString("ParamValue") . "";
         $this->unitTestParamVm->Execute("Select ParamValue from Params WHERE ParamSet={$paramSet} AND ParamName=\"PASSWORD\"");
         $this->arrayParam['PASSWORD'] = $this->unitTestParamVm->GetString("ParamValue") . "";
         $userInfo = new MgUserInformation();
         $userInfo->SetMgUsernamePassword($this->arrayParam['LOGIN'], $this->arrayParam['PASSWORD']);
         $userInfo->SetLocale("en");
         $site2 = new MgSite();
         $site2->Open($userInfo);
         $collection = $site2->EnumerateRoles($this->arrayParam['USER']);
         $site2->Close();
         return new Result(Utils::MgStringCollectionToString($collection), "text/plain");
     } catch (MgException $e) {
         return new Result(get_class($e), "text/plain");
     } catch (SqliteException $s) {
         return new Result($s->GetExceptionMessage(), "text/plain");
     }
 }
Ejemplo n.º 2
0
 // Determine the available site servers
 $numSites = $site->GetSiteServerCount();
 if ($numSites == 1) {
     // Create session
     $adminSession = $site->CreateSession();
     // Save session variables
     SaveSessionVars();
     // Success - switch to ServerManagement page.
     header('Location:  servermanagement.php?' . strip_tags(SID));
     exit;
 } else {
     $siteInfo = GetSiteServerSelection($serverSelectionID);
     if ($siteInfo != NULL) {
         // Close the existing site connection
         if ($site != NULL) {
             $site->Close();
         }
         // Determine the selected site
         $site = new MgSite();
         // Create a connection to the selected site
         $site->Open($userInfo, $siteInfo);
         // Create a session
         $adminSession = $site->CreateSession();
         $userInfo->SetMgSessionId($adminSession);
         // Save the session variables. All requests will now be directed to
         // our selected server since it hosts the current session.
         SaveSessionVars();
         header('Location:  servermanagement.php?' . strip_tags(SID));
         exit;
     }
 }