#370 standard argument for CLI/REST services: param_file

SVN:trunk[1220]
This commit is contained in:
Romain Quetiez
2011-04-19 15:48:39 +00:00
parent 7e2982b848
commit 88a29fd8d1
5 changed files with 148 additions and 13 deletions

View File

@@ -107,8 +107,26 @@ function CronExec($oP, $aBackgroundProcesses, $bVerbose)
if (utils::IsModeCLI())
{
$oP = new CLIPage("iTop - Bulk import");
$oP = new CLIPage("iTop - CRON");
}
else
{
$oP = new WebPage("iTop - CRON");
}
try
{
utils::UseParamFile();
}
catch(Exception $e)
{
$oP->p("Error: ".$e->GetMessage());
$oP->output();
exit -2;
}
if (utils::IsModeCLI())
{
// Next steps:
// specific arguments: 'csvfile'
//
@@ -121,7 +139,8 @@ if (utils::IsModeCLI())
else
{
$oP->p("Access wrong credentials ('$sAuthUser')");
exit;
$oP->output();
exit -1;
}
}
else
@@ -129,15 +148,13 @@ else
$_SESSION['login_mode'] = 'basic';
require_once(APPROOT.'/application/loginwebpage.class.inc.php');
LoginWebPage::DoLogin(); // Check user rights and prompt if needed
$oP = new WebPage("iTop - CRON");
}
if (!UserRights::IsAdministrator())
{
$oP->p("Access restricted to administrators");
$oP->Output();
exit;
exit -1;
}