diff --git a/trunk/addons/userrights/userrightsprofile.class.inc.php b/trunk/addons/userrights/userrightsprofile.class.inc.php index 75d582cfc..cb2aa797d 100644 --- a/trunk/addons/userrights/userrightsprofile.class.inc.php +++ b/trunk/addons/userrights/userrightsprofile.class.inc.php @@ -717,6 +717,7 @@ class UserRightsProfile extends UserRightsAddOnAPI public function Setup() { + SetupITILProfiles::DoCreateDimensions(); SetupITILProfiles::DoCreateProfiles(); return true; } @@ -735,7 +736,7 @@ class UserRightsProfile extends UserRightsAddOnAPI protected $m_aLogin2UserId = array(); // login -> id - protected $m_aAdmins = array(); // id of users being linked to the profile #ADMIN_PROFILE_ID + protected $m_aAdmins = array(); // id of users being linked to the well-known admin profile protected $m_aClassActionGrants = array(); // profile, class, action -> permission protected $m_aClassStimulusGrants = array(); // profile, class, stimulus -> permission @@ -1106,7 +1107,7 @@ exit; { // user projection to be cached on a given page ! $aUserProjection = $this->m_aProPros[$iProfile][$iDimension]->ProjectUser($oUser); - + if (is_null($aUserProjection)) { $aRes[] = $iProfile; @@ -1184,6 +1185,14 @@ class SetupITILProfiles ), ); */ + + protected static $m_aDimensions = array( + 'organization' => array( + 'description' => '', + 'type' => 'bizOrganization', + ), + ); + protected static $m_aActions = array( UR_ACTION_READ => 'Read', UR_ACTION_MODIFY => 'Modify', @@ -1325,6 +1334,26 @@ class SetupITILProfiles ), ), ); + + protected static function DoCreateClassProjection($iDimension, $sClass) + { + $oNewObj = MetaModel::NewObject("URP_ClassProjection"); + $oNewObj->Set('dimensionid', $iDimension); + $oNewObj->Set('class', $sClass); + $oNewObj->Set('attribute', ''); + $iId = $oNewObj->DBInsertNoReload(); + return $iId; + } + + protected static function DoCreateDimension($sName, $aDimensionData) + { + $oNewObj = MetaModel::NewObject("URP_Dimensions"); + $oNewObj->Set('name', $sName); + $oNewObj->Set('description', $aDimensionData['description']); + $oNewObj->Set('type', $aDimensionData['type']); + $iId = $oNewObj->DBInsertNoReload(); + return $iId; + } protected static function DoCreateProfileProjection($iProfile, $iDimension) @@ -1361,6 +1390,18 @@ class SetupITILProfiles return $iId; } + protected static function DoCreateAdminProfile() + { + $oNewObj = MetaModel::NewObject("URP_Profiles"); + $oNewObj->Set('name', 'Administrator'); + $oNewObj->Set('description', 'Has the rights on everything (bypassing any control)'); + $iNewId = $oNewObj->DBInsertNoReload(); + if ($iNewId != ADMIN_PROFILE_ID) + { + throw new CoreException('Admin profile could not be created with its standard id', array('requested'=>ADMIN_PROFILE_ID, 'obtained'=>$iNewId)); + } + } + protected static function DoCreateOneProfile($sName, $aProfileData) { $sDescription = $aProfileData['description']; @@ -1430,8 +1471,25 @@ class SetupITILProfiles } } + public static function DoCreateDimensions() + { + $aClass = MetaModel::GetClasses(); + foreach(self::$m_aDimensions as $sName => $aDimensionData) + { + $iDimension = self::DoCreateDimension($sName, $aDimensionData); + + foreach($aClass as $sClass) + { + self::DoCreateClassProjection($iDimension, $sClass); + } + } + } + + public static function DoCreateProfiles() { + self::DoCreateAdminProfile(); + foreach(self::$m_aProfiles as $sName => $aProfileData) { self::DoCreateOneProfile($sName, $aProfileData); diff --git a/trunk/application/itopwebpage.class.inc.php b/trunk/application/itopwebpage.class.inc.php index d0a118de0..068a4b9ae 100644 --- a/trunk/application/itopwebpage.class.inc.php +++ b/trunk/application/itopwebpage.class.inc.php @@ -274,7 +274,8 @@ EOF $sOnClick = " onclick=\"this.value='';this.onclick=null;\""; } $sUserName = UserRights::GetUser(); - echo "
Logged in as '$sUserName'   "; + $sIsAdmin = UserRights::IsAdministrator() ? '(Administrator)' : ''; + echo "
Logged in as '$sUserName' $sIsAdmin  "; echo "
\n"; echo "\n"; echo "\n"; diff --git a/trunk/setup/data/structure/10.dimensions.xml b/trunk/setup/data/structure/10.dimensions.xml index 3104cd3d5..63335fbfe 100644 --- a/trunk/setup/data/structure/10.dimensions.xml +++ b/trunk/setup/data/structure/10.dimensions.xml @@ -1,13 +1,3 @@ - -organization - -bizOrganization - - -site - - - - \ No newline at end of file + diff --git a/trunk/setup/data/structure/11.profiles.xml b/trunk/setup/data/structure/11.profiles.xml index b0f8d78ac..63335fbfe 100644 --- a/trunk/setup/data/structure/11.profiles.xml +++ b/trunk/setup/data/structure/11.profiles.xml @@ -1,7 +1,3 @@ - -Administrator -Has the rights on everything (ignores the grant records) - diff --git a/trunk/setup/data/structure/12.classprojection.xml b/trunk/setup/data/structure/12.classprojection.xml index 267714046..63335fbfe 100644 --- a/trunk/setup/data/structure/12.classprojection.xml +++ b/trunk/setup/data/structure/12.classprojection.xml @@ -1,555 +1,3 @@ - -1 -bizOrganization -<this> - - - -1 -logRealObject -<this> -org_id - - -1 -bizContact -<this> -org_id - - -1 -bizPerson -<this> -org_id - - -1 -bizTeam -<this> -org_id - - -1 -bizDocument -<this> -org_id - - -1 -bizDocVersion -<any> - - - -1 -lnkDocumentRealObject -<any> - - - -1 -lnkContactRealObject -<any> - - - -1 -logInfra -<this> -org_id - - -1 -bizLocation -<this> -org_id - - -1 -bizCircuit -<this> -org_id - - -1 -bizInterface -<this> -org_id - - -1 -lnkInterfaces -<this> -org_id - - -1 -bizDevice -<this> -org_id - - -1 -bizPC -<this> -org_id - - -1 -bizServer -<this> -org_id - - -1 -bizNetworkDevice -<this> -org_id - - -1 -bizInfraGroup -<this> -org_id - - -1 -bizApplication -<this> -org_id - - -1 -lnkInfraGrouping -<any> - - - -1 -lnkClientServer -<any> - - - -1 -bizPatch -<this> -org_id - - -1 -bizIncidentTicket -<this> -customer_id - - -1 -lnkRelatedTicket -<any> - - - -1 -lnkInfraTicket -<any> - - - -1 -lnkContactTicket -<any> - - - -1 -bizWorkgroup -<this> -org_id - - -1 -bizContract -<this> -org_id - - -1 -lnkInfraContract -<any> - - - -1 -lnkContactContract -<any> - - - -1 -lnkDocumentContract -<any> - - - -1 -bizChangeTicket -<this> -customer_id - - -1 -lnkInfraChangeTicket -<any> - - - -1 -lnkContactChange -<any> - - - -1 -bizKnownError -<this> -cust_id - - -1 -lnkInfraError -<any> - - - -1 -lnkDocumentError -<any> - - - -1 -AuditCategory -<any> - - - -1 -AuditRule -<any> - - - -1 -menuNode -<any> - - - -1 -CMDBChange -<any> - - - -1 -CMDBChangeOp -<any> - - - -1 -CMDBChangeOpCreate -<any> - - - -1 -CMDBChangeOpDelete -<any> - - - -1 -CMDBChangeOpSetAttribute -<any> - - - -2 -bizOrganization -<any> - - - -2 -logRealObject -<any> - - - -2 -bizContact -<any> - - - -2 -bizPerson -<any> - - - -2 -bizTeam -<any> - - - -2 -bizDocument -<any> - - - -2 -bizDocVersion -<any> - - - -2 -lnkDocumentRealObject -<any> - - - -2 -lnkContactRealObject -<any> - - - -2 -logInfra -<any> - - - -2 -bizLocation -<any> - - - -2 -bizCircuit -<any> - - - -2 -bizInterface -<any> - - - -2 -lnkInterfaces -<any> - - - -2 -bizDevice -<any> - - - -2 -bizPC -<any> - - - -2 -bizServer -<any> - - - -2 -bizNetworkDevice -<any> - - - -2 -bizInfraGroup -<any> - - - -2 -bizApplication -<any> - - - -2 -lnkInfraGrouping -<any> - - - -2 -lnkClientServer -<any> - - - -2 -bizPatch -<any> - - - -2 -bizIncidentTicket -<any> - - - -2 -lnkRelatedTicket -<any> - - - -2 -lnkInfraTicket -<any> - - - -2 -lnkContactTicket -<any> - - - -2 -bizWorkgroup -<any> - - - -2 -bizContract -<any> - - - -2 -lnkInfraContract -<any> - - - -2 -lnkContactContract -<any> - - - -2 -lnkDocumentContract -<any> - - - -2 -bizChangeTicket -<any> - - - -2 -lnkInfraChangeTicket -<any> - - - -2 -lnkContactChange -<any> - - - -2 -bizKnownError -<any> - - - -2 -lnkInfraError -<any> - - - -2 -lnkDocumentError -<any> - - - -2 -AuditCategory -<any> - - - -2 -AuditRule -<any> - - - -2 -menuNode -<any> - - - -2 -CMDBChange -<any> - - - -2 -CMDBChangeOp -<any> - - - -2 -CMDBChangeOpCreate -<any> - - - -2 -CMDBChangeOpDelete -<any> - - - -2 -CMDBChangeOpSetAttribute -<any> - - - \ No newline at end of file + diff --git a/trunk/setup/data/structure/13.profileprojection.xml b/trunk/setup/data/structure/13.profileprojection.xml index c139269dc..63335fbfe 100644 --- a/trunk/setup/data/structure/13.profileprojection.xml +++ b/trunk/setup/data/structure/13.profileprojection.xml @@ -1,15 +1,3 @@ - -1 -1 -true - - - -2 -1 -true - - diff --git a/trunk/setup/index.php b/trunk/setup/index.php index c76b86a23..91fd34717 100644 --- a/trunk/setup/index.php +++ b/trunk/setup/index.php @@ -381,7 +381,7 @@ function DisplayStep4(setup_web_page $oP, Config $oConfig, $sAdminUser, $sAdminP $oP->add("

Step 4: Loading of sample data

\n"); $oP->p("
Do you want to load sample data into the database ? \n"); $oP->p(" Yes, for testing purposes, populate the database with sample data.\n"); - $oP->p(" No, this is a production system, I will load real data myself.\n"); + $oP->p(" No, this is a production system, load only the data required by the application.\n"); $oP->p("
\n"); $oP->add("\n"); $oP->add("    \n");