mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-23 18:48:51 +02:00
Improved user rights management: SELECT filtered on objects authorized for the current user (not yet fully implemented)
SVN:trunk[681]
This commit is contained in:
@@ -33,13 +33,16 @@ require_once('./setuppage.class.inc.php');
|
||||
|
||||
class BenchmarkDataCreation
|
||||
{
|
||||
var $m_iIfByServer;
|
||||
var $m_iIfByNWDevice;
|
||||
var $m_aRequested;
|
||||
var $m_aPlanned;
|
||||
var $m_aCreated = array();
|
||||
var $m_aCreatedByClass = array();
|
||||
var $m_aCreatedByDesc = array();
|
||||
|
||||
var $m_aStatsByClass = array();
|
||||
|
||||
public function __construct($iPlannedCIs, $iPlannedContacts, $iPlannedContracts)
|
||||
public function __construct($iPlannedCIs = 0, $iPlannedContacts = 0, $iPlannedContracts = 0)
|
||||
{
|
||||
$this->m_aRequested = array(
|
||||
'CIs' => $iPlannedCIs,
|
||||
@@ -47,10 +50,27 @@ class BenchmarkDataCreation
|
||||
'Contracts' => $iPlannedContracts,
|
||||
);
|
||||
|
||||
$this->m_iIfByServer = 2;
|
||||
$this->m_iIfByNWDevice = 10;
|
||||
|
||||
$iServers = ceil($iPlannedCIs * 9 / 10);
|
||||
$iNWDevices = ceil($iPlannedCIs / 10);
|
||||
$iBigTicketCIs = ceil($iPlannedCIs / 10);
|
||||
$iInterfaces = $iServers * $this->m_iIfByServer + $iNWDevices * $this->m_iIfByNWDevice;
|
||||
$iApplications = $iServers * 10;
|
||||
$iSolutions = $iApplications;
|
||||
$iProcesses = $iSolutions * 2;
|
||||
|
||||
$this->m_aPlanned = array(
|
||||
'Network devices' => ceil($iPlannedCIs / 2),
|
||||
'Servers' => ceil($iPlannedCIs / 2),
|
||||
'Interfaces' => 10 * $iPlannedCIs,
|
||||
'Network devices' => $iNWDevices,
|
||||
'Servers' => $iServers,
|
||||
'Big ticket: CIs' => $iBigTicketCIs,
|
||||
'Interfaces' => $iInterfaces,
|
||||
'Application SW' => 2,
|
||||
'Applications' => $iApplications,
|
||||
'Solutions' => $iSolutions,
|
||||
'Processes' => $iProcesses,
|
||||
|
||||
'Contacts' => $iPlannedContacts,
|
||||
'Contracts' => $iPlannedContracts,
|
||||
'Incidents' => 2 * 12 * $iPlannedCIs,
|
||||
@@ -70,7 +90,7 @@ class BenchmarkDataCreation
|
||||
return $this->m_aRequested;
|
||||
}
|
||||
|
||||
protected function CreateObject($sClass, $aData, $oChange)
|
||||
protected function CreateObject($sClass, $aData, $oChange, $sClassDesc = '')
|
||||
{
|
||||
$mu_t1 = MyHelpers::getmicrotime();
|
||||
|
||||
@@ -82,7 +102,9 @@ class BenchmarkDataCreation
|
||||
|
||||
$iId = $oMyObject->DBInsertTrackedNoReload($oChange);
|
||||
|
||||
$this->m_aCreated[$sClass][] = $iId;
|
||||
$sClassId = "$sClass ($sClassDesc)";
|
||||
$this->m_aCreatedByDesc[$sClassId][] = $iId;
|
||||
$this->m_aCreatedByClass[$sClass][] = $iId;
|
||||
|
||||
$mu_t2 = MyHelpers::getmicrotime();
|
||||
$this->m_aStatsByClass[$sClass][] = $mu_t2 - $mu_t1;
|
||||
@@ -90,9 +112,10 @@ class BenchmarkDataCreation
|
||||
return $iId;
|
||||
}
|
||||
|
||||
protected function RandomId($sClass)
|
||||
protected function RandomId($sClass, $sClassDesc = '')
|
||||
{
|
||||
return $this->m_aCreated[$sClass][array_rand($this->m_aCreated[$sClass])];
|
||||
$sClassId = "$sClass ($sClassDesc)";
|
||||
return $this->m_aCreatedByDesc[$sClassId][array_rand($this->m_aCreatedByDesc[$sClassId])];
|
||||
}
|
||||
|
||||
static protected function FindId($sClass)
|
||||
@@ -121,7 +144,7 @@ class BenchmarkDataCreation
|
||||
|
||||
protected function MakeFeedback($oP, $sClass)
|
||||
{
|
||||
$iSample = reset($this->m_aCreated[$sClass]);
|
||||
$iSample = reset($this->m_aCreatedByClass[$sClass]);
|
||||
$sSample = "<a href=\"../pages/UI.php?operation=details&class=$sClass&id=$iSample\">sample</a>";
|
||||
|
||||
$iDuration = number_format(array_sum($this->m_aStatsByClass[$sClass]), 3);
|
||||
@@ -131,13 +154,156 @@ class BenchmarkDataCreation
|
||||
|
||||
$oP->add("<ul>");
|
||||
$oP->add("<li>");
|
||||
$oP->add("$sClass: ".count($this->m_aCreated[$sClass])." - $sSample<br/>");
|
||||
$oP->add("$sClass: ".count($this->m_aStatsByClass[$sClass])." - $sSample<br/>");
|
||||
$oP->add("Duration: $fDurationMin => $fDurationMax; Avg:$fDurationAverage; Total: $iDuration");
|
||||
$oP->add("</li>");
|
||||
$oP->add("</ul>");
|
||||
}
|
||||
|
||||
public function GoProjections(WebPage $oP, $oChange)
|
||||
public function GoProjectionsOrganization(WebPage $oP, $oChange)
|
||||
{
|
||||
$aClasses = MetaModel::GetClasses();
|
||||
$aActions = array('Read', 'Bulk Read', 'Delete', 'Bulk Delete', 'Modify', 'Bulk Modify');
|
||||
$aStdProfiles = array(2, 3, 4, 5, 6, 7, 8, 9);
|
||||
|
||||
////////////////////////////////////////
|
||||
// Dimension: Organization
|
||||
//
|
||||
$aData = array(
|
||||
'name' => 'organization',
|
||||
'description' => '',
|
||||
'type' => 'Organization',
|
||||
);
|
||||
$iDimLocation = $this->CreateObject('URP_Dimensions', $aData, $oChange);
|
||||
|
||||
////////////////////////////////////////
|
||||
// New specific profile, given access to everything
|
||||
//
|
||||
$aData = array(
|
||||
'name' => 'data guru',
|
||||
'description' => 'could do anything, because everything is granted',
|
||||
);
|
||||
$iGuruProfile = $this->CreateObject('URP_Profiles', $aData, $oChange);
|
||||
foreach($aClasses as $sClass)
|
||||
{
|
||||
foreach($aActions as $sAction)
|
||||
{
|
||||
$aData = array(
|
||||
'profileid' => $iGuruProfile,
|
||||
'class' => $sClass,
|
||||
'permission' => 'yes',
|
||||
'action' => $sAction,
|
||||
);
|
||||
$this->CreateObject('URP_ActionGrant', $aData, $oChange);
|
||||
}
|
||||
}
|
||||
$aData = array(
|
||||
'dimensionid' => $iDimLocation,
|
||||
'profileid' => $iGuruProfile,
|
||||
'value' => '<any>',
|
||||
'attribute' => 'org_id',
|
||||
);
|
||||
$this->CreateObject('URP_ProfileProjection', $aData, $oChange);
|
||||
|
||||
// User login with super access rights
|
||||
//
|
||||
$aData = array(
|
||||
'org_id' => self::FindId('Organization'),
|
||||
'location_id' => self::FindId('Location'),
|
||||
'first_name' => 'Jesus',
|
||||
'name' => 'Deus',
|
||||
'email' => '',
|
||||
);
|
||||
$iPerson = $this->CreateObject('Person', $aData, $oChange);
|
||||
$aData = array(
|
||||
'contactid' => $iPerson,
|
||||
'login' => 'guru',
|
||||
'password' => 'guru',
|
||||
'language' => 'EN US',
|
||||
);
|
||||
$iLogin = $this->CreateObject('UserLocal', $aData, $oChange);
|
||||
|
||||
// Assign profiles to the new login
|
||||
//
|
||||
$aData = array(
|
||||
'userid' => $iLogin,
|
||||
'profileid' => $iGuruProfile,
|
||||
'reason' => 'he is the one',
|
||||
);
|
||||
$this->CreateObject('URP_UserProfile', $aData, $oChange);
|
||||
|
||||
////////////////////////////////////////
|
||||
// User login having all profiles, but seeing only his organization
|
||||
//
|
||||
$aData = array(
|
||||
'org_id' => self::FindId('Organization'),
|
||||
'location_id' => self::FindId('Location'),
|
||||
'first_name' => 'Little ze',
|
||||
'name' => 'Foo',
|
||||
'email' => '',
|
||||
);
|
||||
$iPerson = $this->CreateObject('Person', $aData, $oChange);
|
||||
$aData = array(
|
||||
'contactid' => $iPerson,
|
||||
'login' => 'foo',
|
||||
'password' => 'foo',
|
||||
'language' => 'EN US',
|
||||
);
|
||||
$iLogin = $this->CreateObject('UserLocal', $aData, $oChange);
|
||||
|
||||
// Assign profiles to the new login
|
||||
//
|
||||
foreach($aStdProfiles as $iProfileId)
|
||||
{
|
||||
$aData = array(
|
||||
'userid' => $iLogin,
|
||||
'profileid' => $iProfileId,
|
||||
'reason' => '',
|
||||
);
|
||||
$this->CreateObject('URP_UserProfile', $aData, $oChange);
|
||||
}
|
||||
|
||||
// Project classes
|
||||
//
|
||||
$aMyClassesToProject = array();
|
||||
foreach($aClasses as $sClass)
|
||||
{
|
||||
if (MetaModel::IsValidAttCode($sClass, 'org_id'))
|
||||
{
|
||||
$aMyClassesToProject[$sClass] = 'org_id';
|
||||
}
|
||||
}
|
||||
foreach($aMyClassesToProject as $sClass => $sAttCode)
|
||||
{
|
||||
$aData = array(
|
||||
'dimensionid' => $iDimLocation,
|
||||
'class' => $sClass,
|
||||
'value' => '<this>',
|
||||
'attribute' => $sAttCode,
|
||||
);
|
||||
$this->CreateObject('URP_ClassProjection', $aData, $oChange);
|
||||
}
|
||||
|
||||
// Project profiles
|
||||
//
|
||||
foreach($aStdProfiles as $iProfileId)
|
||||
{
|
||||
$aData = array(
|
||||
'dimensionid' => $iDimLocation,
|
||||
'profileid' => $iProfileId,
|
||||
'value' => 'SELECT Person WHERE id = :user->contactid',
|
||||
'attribute' => 'org_id',
|
||||
);
|
||||
$this->CreateObject('URP_ProfileProjection', $aData, $oChange);
|
||||
}
|
||||
|
||||
$oP->p('Created projections (Cf. login "foo", pwd "foo")');
|
||||
$oP->p('* foo can do configuration management for a given customer');
|
||||
$oP->p('* guru can do everything');
|
||||
}
|
||||
|
||||
// For testing purposes -Romain
|
||||
public function GoProjectionsLocation(WebPage $oP, $oChange)
|
||||
{
|
||||
// User login
|
||||
//
|
||||
@@ -156,7 +322,7 @@ class BenchmarkDataCreation
|
||||
'profileid' => self::FindIdFromOQL("SELECT URP_Profiles WHERE name LIKE 'Configuration Manager'"),
|
||||
'reason' => '',
|
||||
);
|
||||
$iFoo = $this->CreateObject('URP_UserProfile', $aData, $oChange);
|
||||
$this->CreateObject('URP_UserProfile', $aData, $oChange);
|
||||
|
||||
// Dimension
|
||||
//
|
||||
@@ -178,7 +344,7 @@ class BenchmarkDataCreation
|
||||
'value' => '<this>',
|
||||
'attribute' => 'location_name',
|
||||
);
|
||||
$iFoo = $this->CreateObject('URP_ClassProjection', $aData, $oChange);
|
||||
$this->CreateObject('URP_ClassProjection', $aData, $oChange);
|
||||
}
|
||||
|
||||
// Project profiles
|
||||
@@ -192,7 +358,7 @@ class BenchmarkDataCreation
|
||||
'value' => 'Grenoble',
|
||||
'attribute' => '',
|
||||
);
|
||||
$iFoo = $this->CreateObject('URP_ProfileProjection', $aData, $oChange);
|
||||
$this->CreateObject('URP_ProfileProjection', $aData, $oChange);
|
||||
}
|
||||
|
||||
$oP->p('Created projections (Cf. login "foo", pwd "foo")');
|
||||
@@ -216,7 +382,7 @@ class BenchmarkDataCreation
|
||||
//
|
||||
$aData = array(
|
||||
'org_id' => $iOrg,
|
||||
'name' => 'Rio',
|
||||
'name' => 'Rio de Janeiro',
|
||||
);
|
||||
$iLoc = $this->CreateObject('Location', $aData, $oChange);
|
||||
$this->MakeFeedback($oP, 'Location');
|
||||
@@ -247,7 +413,15 @@ class BenchmarkDataCreation
|
||||
'name' => 'Ningem #'.$i,
|
||||
'email' => 'foo'.$i.'@nowhere.fr',
|
||||
);
|
||||
$this->CreateObject('Person', $aData, $oChange);
|
||||
$iPerson = $this->CreateObject('Person', $aData, $oChange);
|
||||
|
||||
// Contract/Infra
|
||||
//
|
||||
$aData = array(
|
||||
'contact_id' => $iPerson,
|
||||
'team_id' => $this->RandomId('Team'),
|
||||
);
|
||||
$this->CreateObject('lnkTeamToContact', $aData, $oChange);
|
||||
}
|
||||
$this->MakeFeedback($oP, 'Person');
|
||||
|
||||
@@ -287,6 +461,19 @@ class BenchmarkDataCreation
|
||||
'support_team_id' => $this->RandomId('Team'),
|
||||
);
|
||||
$iContract = $this->CreateObject('CustomerContract', $aData, $oChange);
|
||||
|
||||
// Contract/Contact (10% of contacts)
|
||||
//
|
||||
$iContactCount = ceil($this->m_aPlanned['Contracts'] / 10);
|
||||
for($iLinked = 0 ; $iLinked < $iContactCount ; $iLinked++)
|
||||
{
|
||||
$aData = array(
|
||||
'contact_id' => $this->RandomId('Person'),
|
||||
'contract_id' => $iContract,
|
||||
'role' => 'role '.$iLinked,
|
||||
);
|
||||
$this->CreateObject('lnkContractToContact', $aData, $oChange);
|
||||
}
|
||||
}
|
||||
$this->MakeFeedback($oP, 'CustomerContract');
|
||||
|
||||
@@ -300,6 +487,7 @@ class BenchmarkDataCreation
|
||||
'org_id' => $iOrg,
|
||||
'location_id' => $iLoc,
|
||||
'name' => 'server'.$i,
|
||||
'status' => 'production',
|
||||
);
|
||||
$iServer = $this->CreateObject('Server', $aData, $oChange);
|
||||
|
||||
@@ -317,16 +505,16 @@ class BenchmarkDataCreation
|
||||
|
||||
// Interfaces
|
||||
//
|
||||
$iInterfaceCount = 5; // See how aPlanned['Interfaces'] is computed
|
||||
for($iLinked = 0 ; $iLinked < $iInterfaceCount ; $iLinked++)
|
||||
for($iLinked = 0 ; $iLinked < $this->m_iIfByServer ; $iLinked++)
|
||||
{
|
||||
$aData = array(
|
||||
'name' => "eth$iLinked",
|
||||
'status' => 'implementation',
|
||||
'org_id' => $iOrg,
|
||||
'device_id' => $iServer,
|
||||
'status' => 'production',
|
||||
);
|
||||
$this->CreateObject('NetworkInterface', $aData, $oChange);
|
||||
$this->CreateObject('NetworkInterface', $aData, $oChange, 'server if');
|
||||
}
|
||||
}
|
||||
$this->MakeFeedback($oP, 'Server');
|
||||
@@ -340,7 +528,8 @@ class BenchmarkDataCreation
|
||||
$aData = array(
|
||||
'org_id' => $iOrg,
|
||||
'location_id' => $iLoc,
|
||||
'name' => 'server'.$i,
|
||||
'name' => 'equipment #'.$i,
|
||||
'status' => 'production',
|
||||
);
|
||||
$iNWDevice = $this->CreateObject('NetworkDevice', $aData, $oChange);
|
||||
|
||||
@@ -358,21 +547,118 @@ class BenchmarkDataCreation
|
||||
|
||||
// Interfaces
|
||||
//
|
||||
$iInterfaceCount = 5; // See how aPlanned['Interfaces'] is computed
|
||||
for($iLinked = 0 ; $iLinked < $iInterfaceCount ; $iLinked++)
|
||||
for($iLinked = 0 ; $iLinked < $this->m_iIfByNWDevice ; $iLinked++)
|
||||
{
|
||||
$aData = array(
|
||||
'name' => "eth$iLinked",
|
||||
'status' => 'implementation',
|
||||
'org_id' => $iOrg,
|
||||
'device_id' => $iNWDevice,
|
||||
'connected_if' => $this->RandomId('NetworkInterface', 'server if'),
|
||||
'status' => 'production',
|
||||
);
|
||||
$this->CreateObject('NetworkInterface', $aData, $oChange);
|
||||
$this->CreateObject('NetworkInterface', $aData, $oChange, 'equipment if');
|
||||
}
|
||||
}
|
||||
$this->MakeFeedback($oP, 'NetworkDevice');
|
||||
$this->MakeFeedback($oP, 'NetworkInterface');
|
||||
|
||||
/////////////////////////
|
||||
//
|
||||
// Application Software
|
||||
//
|
||||
for($i = 0 ; $i < $this->m_aPlanned['Application SW'] ; $i++)
|
||||
{
|
||||
$aData = array(
|
||||
'name' => 'Software #'.$i,
|
||||
);
|
||||
$iNWDevice = $this->CreateObject('Application', $aData, $oChange);
|
||||
}
|
||||
$this->MakeFeedback($oP, 'Application');
|
||||
|
||||
/////////////////////////
|
||||
//
|
||||
// Applications
|
||||
//
|
||||
for($i = 0 ; $i < $this->m_aPlanned['Applications'] ; $i++)
|
||||
{
|
||||
$aData = array(
|
||||
'org_id' => $iOrg,
|
||||
'device_id' => $this->RandomId('Server'),
|
||||
'software_id' => $this->RandomId('Application'),
|
||||
'name' => 'Application #'.$i,
|
||||
'status' => 'production',
|
||||
);
|
||||
$iNWDevice = $this->CreateObject('ApplicationInstance', $aData, $oChange);
|
||||
|
||||
// Contract/Infra
|
||||
//
|
||||
$iContractCount = 1;
|
||||
for($iLinked = 0 ; $iLinked < $iContractCount ; $iLinked++)
|
||||
{
|
||||
$aData = array(
|
||||
'contract_id' => $this->RandomId('CustomerContract'),
|
||||
'ci_id' => $iNWDevice,
|
||||
);
|
||||
$this->CreateObject('lnkContractToCI', $aData, $oChange);
|
||||
}
|
||||
}
|
||||
$this->MakeFeedback($oP, 'ApplicationInstance');
|
||||
|
||||
/////////////////////////
|
||||
//
|
||||
// Application Solution
|
||||
//
|
||||
for($i = 0 ; $i < $this->m_aPlanned['Solutions'] ; $i++)
|
||||
{
|
||||
$aData = array(
|
||||
'org_id' => $iOrg,
|
||||
'name' => 'Solution #'.$i,
|
||||
'status' => 'production',
|
||||
);
|
||||
$iNWDevice = $this->CreateObject('ApplicationSolution', $aData, $oChange);
|
||||
|
||||
// Contract/Infra
|
||||
//
|
||||
$iContractCount = 1;
|
||||
for($iLinked = 0 ; $iLinked < $iContractCount ; $iLinked++)
|
||||
{
|
||||
$aData = array(
|
||||
'contract_id' => $this->RandomId('CustomerContract'),
|
||||
'ci_id' => $iNWDevice,
|
||||
);
|
||||
$this->CreateObject('lnkContractToCI', $aData, $oChange);
|
||||
}
|
||||
}
|
||||
$this->MakeFeedback($oP, 'ApplicationSolution');
|
||||
|
||||
/////////////////////////
|
||||
//
|
||||
// Business Process
|
||||
//
|
||||
for($i = 0 ; $i < $this->m_aPlanned['Processes'] ; $i++)
|
||||
{
|
||||
$aData = array(
|
||||
'org_id' => $iOrg,
|
||||
'name' => 'Process #'.$i,
|
||||
'status' => 'production',
|
||||
);
|
||||
$iNWDevice = $this->CreateObject('BusinessProcess', $aData, $oChange);
|
||||
|
||||
// Contract/Infra
|
||||
//
|
||||
$iContractCount = 1;
|
||||
for($iLinked = 0 ; $iLinked < $iContractCount ; $iLinked++)
|
||||
{
|
||||
$aData = array(
|
||||
'contract_id' => $this->RandomId('CustomerContract'),
|
||||
'ci_id' => $iNWDevice,
|
||||
);
|
||||
$this->CreateObject('lnkContractToCI', $aData, $oChange);
|
||||
}
|
||||
}
|
||||
$this->MakeFeedback($oP, 'BusinessProcess');
|
||||
|
||||
/////////////////////////
|
||||
//
|
||||
// Incident Tickets
|
||||
@@ -418,6 +704,47 @@ class BenchmarkDataCreation
|
||||
}
|
||||
$this->MakeFeedback($oP, 'Incident');
|
||||
|
||||
/////////////////////////
|
||||
//
|
||||
// Big Ticket
|
||||
//
|
||||
$aData = array(
|
||||
'org_id' => $iOrg,
|
||||
'caller_id' => $this->RandomId('Person'),
|
||||
'workgroup_id' => $this->RandomId('Team'),
|
||||
'agent_id' => $this->RandomId('Person'),
|
||||
'service_id' => $this->RandomId('Service'),
|
||||
'servicesubcategory_id' => $this->RandomId('ServiceSubcategory'),
|
||||
'title' => 'Big ticket',
|
||||
'ticket_log' => 'Testing...',
|
||||
);
|
||||
$iTicket = $this->CreateObject('Incident', $aData, $oChange);
|
||||
|
||||
// Incident/Infra
|
||||
//
|
||||
$iInfraCount = $this->m_aPlanned['Big ticket: CIs'];
|
||||
for($iLinked = 0 ; $iLinked < $iInfraCount ; $iLinked++)
|
||||
{
|
||||
$aData = array(
|
||||
'ci_id' => $this->RandomId('Server'),
|
||||
'ticket_id' => $iTicket,
|
||||
);
|
||||
$this->CreateObject('lnkTicketToCI', $aData, $oChange);
|
||||
}
|
||||
|
||||
// Incident/Contact
|
||||
//
|
||||
$iInfraCount = rand(0, 6) ;
|
||||
for($iLinked = 0 ; $iLinked < $iInfraCount ; $iLinked++)
|
||||
{
|
||||
$aData = array(
|
||||
'contact_id' => $this->RandomId('Person'),
|
||||
'ticket_id' => $iTicket,
|
||||
'role' => 'role '.$iLinked,
|
||||
);
|
||||
$this->CreateObject('lnkTicketToContact', $aData, $oChange);
|
||||
}
|
||||
|
||||
/////////////////////////
|
||||
//
|
||||
// Change Tickets
|
||||
@@ -529,6 +856,17 @@ function DisplayStep1(SetupWebPage $oP)
|
||||
{
|
||||
$sNextOperation = 'step2';
|
||||
$oP->add("<h1>iTop benchmarking</h1>\n");
|
||||
|
||||
$oP->add("<form method=\"post\" onSubmit=\"return DoSubmit('Please wait...', 10)\">\n");
|
||||
$oP->add("<input type=\"hidden\" name=\"operation\" value=\"createprofiles_organization\">\n");
|
||||
$oP->add("<button type=\"submit\">Create profiles!</button>\n");
|
||||
$oP->add("</form>\n");
|
||||
|
||||
$oP->add("<form method=\"post\" onSubmit=\"return DoSubmit('Please wait...', 10)\">\n");
|
||||
$oP->add("<input type=\"hidden\" name=\"operation\" value=\"createprofiles_location\">\n");
|
||||
$oP->add("<button type=\"submit\">Create profiles (unit tests)!</button>\n");
|
||||
$oP->add("</form>\n");
|
||||
|
||||
$oP->add("<h2>Please specify the requested volumes</h2>\n");
|
||||
$oP->add("<form method=\"post\" onSubmit=\"return DoSubmit('Evaluating real plans...', 10)\">\n");
|
||||
$oP->add("<fieldset><legend>Data load configuration</legend>\n");
|
||||
@@ -600,10 +938,39 @@ function DisplayStep3(SetupWebPage $oP, $oDataCreation)
|
||||
$oMyChange->Set("userinfo", "Administrator");
|
||||
$iChangeId = $oMyChange->DBInsertNoReload();
|
||||
|
||||
$oDataCreation->GoProjections($oP, $oMyChange);
|
||||
$oDataCreation->GoVolume($oP, $oMyChange);
|
||||
}
|
||||
|
||||
/**
|
||||
* Do create a profile management context
|
||||
*/
|
||||
function CreateProfilesOrganization(SetupWebPage $oP, $oDataCreation)
|
||||
{
|
||||
// $sNextOperation = 'step3';
|
||||
|
||||
$oMyChange = MetaModel::NewObject("CMDBChange");
|
||||
$oMyChange->Set("date", time());
|
||||
$oMyChange->Set("userinfo", "Administrator");
|
||||
$iChangeId = $oMyChange->DBInsertNoReload();
|
||||
|
||||
$oDataCreation->GoProjectionsOrganization($oP, $oMyChange);
|
||||
}
|
||||
|
||||
/**
|
||||
* Do create the data set... could take some time to execute
|
||||
*/
|
||||
function CreateProfilesLocation(SetupWebPage $oP, $oDataCreation)
|
||||
{
|
||||
// $sNextOperation = 'step3';
|
||||
|
||||
$oMyChange = MetaModel::NewObject("CMDBChange");
|
||||
$oMyChange->Set("date", time());
|
||||
$oMyChange->Set("userinfo", "Administrator");
|
||||
$iChangeId = $oMyChange->DBInsertNoReload();
|
||||
|
||||
$oDataCreation->GoProjectionsLocation($oP, $oMyChange);
|
||||
}
|
||||
|
||||
/**
|
||||
* Main program
|
||||
*/
|
||||
@@ -620,7 +987,19 @@ try
|
||||
case 'step1':
|
||||
DisplayStep1($oP);
|
||||
break;
|
||||
|
||||
|
||||
case 'createprofiles_organization':
|
||||
$oP->no_cache();
|
||||
$oDataCreation = new BenchmarkDataCreation();
|
||||
CreateProfilesOrganization($oP, $oDataCreation);
|
||||
break;
|
||||
|
||||
case 'createprofiles_location':
|
||||
$oP->no_cache();
|
||||
$oDataCreation = new BenchmarkDataCreation();
|
||||
CreateProfilesLocation($oP, $oDataCreation);
|
||||
break;
|
||||
|
||||
case 'step2':
|
||||
$oP->no_cache();
|
||||
$iPlannedCIs = Utils::ReadParam('plannedcis');
|
||||
|
||||
Reference in New Issue
Block a user