diff --git a/addons/userrights/userrightsprofile.class.inc.php b/addons/userrights/userrightsprofile.class.inc.php index df80a8caf..10528bc90 100644 --- a/addons/userrights/userrightsprofile.class.inc.php +++ b/addons/userrights/userrightsprofile.class.inc.php @@ -14,6 +14,11 @@ */ +// It is supposed that this profile does exist in the DB +// Possible improvement: add it when executing the setup procedure +// +define('ADMIN_PROFILE_ID', 1); + class URP_Users extends DBObject { public static function Init() @@ -106,7 +111,7 @@ class URP_Dimensions extends DBObject MetaModel::Init_AddFilterFromAttribute("type"); } - public function CheckProjectionSpec($oProjectionSpec) + public function CheckProjectionSpec($oProjectionSpec, $sProjectedClass) { $sExpression = $oProjectionSpec->Get('value'); $sAttribute = $oProjectionSpec->Get('attribute'); @@ -129,30 +134,46 @@ class URP_Dimensions extends DBObject // 2nd - compute the data type for the projection // - $bIsOql = true; - $sExpressionClass = ''; - try + $sTargetClass = ''; + if (($sExpression == '') || ($sExpression == '')) { - $oObjectSearch = DBObjectSearch::FromOQL($sExpression); - $sExpressionClass = $oObjectSearch->GetClass(); + $sTargetClass = $sProjectedClass; } - catch (OqlException $e) + elseif ($sExpression == '') { - $bIsOql = false; + $sTargetClass = ''; } - if ($bIsOql) + else + { + // Evaluate wether it is a constant or not + try + { + $oObjectSearch = DBObjectSearch::FromOQL($sExpression); + + $sTargetClass = $oObjectSearch->GetClass(); + } + catch (OqlException $e) + { + } + } + + if (empty($sTargetClass)) + { + $sFoundType = '_void_'; + } + else { if (empty($sAttribute)) { - $sFoundType = $sExpressionClass; + $sFoundType = $sTargetClass; } else { - if (!MetaModel::IsValidAttCode($sExpressionClass, $sAttribute)) + if (!MetaModel::IsValidAttCode($sTargetClass, $sAttribute)) { - throw new CoreException('Unkown attribute code in projection specification', array('found' => $sAttribute, 'expecting' => MetaModel::GetAttributesList($sExpressionClass), 'class' => $sExpressionClass, 'projection' => $oProjectionSpec)); + throw new CoreException('Unkown attribute code in projection specification', array('found' => $sAttribute, 'expecting' => MetaModel::GetAttributesList($sTargetClass), 'class' => $sTargetClass, 'projection' => $oProjectionSpec)); } - $oAttDef = MetaModel::GetAttributeDef($sExpressionClass, $sAttribute); + $oAttDef = MetaModel::GetAttributeDef($sTargetClass, $sAttribute); if ($oAttDef->IsExternalKey()) { $sFoundType = $oAttDef->GetTargetClass(); @@ -163,13 +184,9 @@ class URP_Dimensions extends DBObject } } } - else - { - $sFoundType = '_scalar_'; - } // Compare the dimension type and projection type - if ($sFoundType != $sExpectedType) + if (($sFoundType != '_void_') && ($sFoundType != $sExpectedType)) { throw new CoreException('Wrong type in projection specification', array('found' => $sFoundType, 'expecting' => $sExpectedType, 'expression' => $sExpression, 'attribute' => $sAttribute, 'projection' => $oProjectionSpec)); } @@ -234,7 +251,7 @@ class URP_ProfileProjection extends DBObject MetaModel::Init_AddAttribute(new AttributeExternalKey("profileid", array("targetclass"=>"URP_Profiles", "jointype"=> "", "label"=>"profile", "description"=>"usage profile", "allowed_values"=>null, "sql"=>"profileid", "is_null_allowed"=>false, "depends_on"=>array()))); MetaModel::Init_AddAttribute(new AttributeExternalField("profile", array("label"=>"Profile", "description"=>"Profile name", "allowed_values"=>null, "extkey_attcode"=> 'profileid', "target_attcode"=>"name"))); - MetaModel::Init_AddAttribute(new AttributeString("value", array("label"=>"Value expression", "description"=>"OQL expression (using \$user) | constant | ", "allowed_values"=>null, "sql"=>"value", "default_value"=>"", "is_null_allowed"=>false, "depends_on"=>array()))); + MetaModel::Init_AddAttribute(new AttributeString("value", array("label"=>"Value expression", "description"=>"OQL expression (using \$user) | constant | | +attribute code", "allowed_values"=>null, "sql"=>"value", "default_value"=>"", "is_null_allowed"=>false, "depends_on"=>array()))); MetaModel::Init_AddAttribute(new AttributeString("attribute", array("label"=>"Attribute", "description"=>"Target attribute code (optional)", "allowed_values"=>null, "sql"=>"attribute", "default_value"=>"", "is_null_allowed"=>false, "depends_on"=>array()))); //MetaModel::Init_InheritFilters(); @@ -245,17 +262,30 @@ class URP_ProfileProjection extends DBObject public function ProjectUser(URP_Users $oUser) { $sExpr = $this->Get('value'); - if (strtolower(substr($sExpr, 0, 6)) == 'select') + if ($sExpr == '') + { + $sColumn = $this->Get('attribute'); + if (empty($sColumn)) + { + $aRes = array($oUser->GetKey()); + } + else + { + $aRes = array($oUser->Get($sColumn)); + } + + } + elseif ($sExpr == '') + { + $aRes = null; + } + elseif (strtolower(substr($sExpr, 0, 6)) == 'select') { $sColumn = $this->Get('attribute'); // SELECT... $oValueSetDef = new ValueSetObjects($sExpr, $sColumn); $aValues = $oValueSetDef->GetValues(array('user' => $oUser), ''); - $aRes = array_values($aValues); - } - elseif ($sExpr == '') - { - $aRes = null; + $aRes = array_keys($aValues); } else { @@ -291,24 +321,42 @@ class URP_ClassProjection extends DBObject MetaModel::Init_AddAttribute(new AttributeString("class", array("label"=>"Class", "description"=>"Target class", "allowed_values"=>null, "sql"=>"class", "default_value"=>"", "is_null_allowed"=>false, "depends_on"=>array()))); - MetaModel::Init_AddAttribute(new AttributeString("value", array("label"=>"Value expression", "description"=>"OQL expression (using \$this) | constant | ", "allowed_values"=>null, "sql"=>"value", "default_value"=>"", "is_null_allowed"=>false, "depends_on"=>array()))); + MetaModel::Init_AddAttribute(new AttributeString("value", array("label"=>"Value expression", "description"=>"OQL expression (using \$this) | constant | | +attribute code", "allowed_values"=>null, "sql"=>"value", "default_value"=>"", "is_null_allowed"=>false, "depends_on"=>array()))); MetaModel::Init_AddAttribute(new AttributeString("attribute", array("label"=>"Attribute", "description"=>"Target attribute code (optional)", "allowed_values"=>null, "sql"=>"attribute", "default_value"=>"", "is_null_allowed"=>false, "depends_on"=>array()))); //MetaModel::Init_InheritFilters(); MetaModel::Init_AddFilterFromAttribute("dimensionid"); + // #@# verifier MetaModel::Init_AddFilterFromAttribute("class"); } public function ProjectObject($oObject) { $sExpr = $this->Get('value'); - if (strtolower(substr($sExpr, 0, 6)) == 'select') + if ($sExpr == '') + { + $sColumn = $this->Get('attribute'); + if (empty($sColumn)) + { + $aRes = array($oObject->GetKey()); + } + else + { + $aRes = array($oObject->Get($sColumn)); + } + + } + elseif ($sExpr == '') + { + $aRes = null; + } + elseif (strtolower(substr($sExpr, 0, 6)) == 'select') { $sColumn = $this->Get('attribute'); // SELECT... $oValueSetDef = new ValueSetObjects($sExpr, $sColumn); - $aValues = $oValueSetDef->GetValues(array('user' => $oObject), ''); - $aRes = array_values($aValues); + $aValues = $oValueSetDef->GetValues(array('this' => $oObject), ''); + $aRes = array_keys($aValues); } elseif ($sExpr == '') { @@ -357,6 +405,7 @@ class URP_ActionGrant extends DBObject MetaModel::Init_AddFilterFromAttribute("profileid"); MetaModel::Init_AddFilterFromAttribute("profile"); MetaModel::Init_AddFilterFromAttribute("class"); + MetaModel::Init_AddFilterFromAttribute("permission"); MetaModel::Init_AddFilterFromAttribute("action"); } @@ -396,6 +445,7 @@ class URP_StimulusGrant extends DBObject MetaModel::Init_AddFilterFromAttribute("profileid"); MetaModel::Init_AddFilterFromAttribute("profile"); MetaModel::Init_AddFilterFromAttribute("class"); + MetaModel::Init_AddFilterFromAttribute("permission"); MetaModel::Init_AddFilterFromAttribute("stimulus"); } @@ -446,19 +496,22 @@ class UserRightsProfile extends UserRightsAddOnAPI ); // Installation: create the very first user - public function CreateAdministrator($sAdminUser, $sAdminPwd, $sAdminEmail, $sFirstName, $sLastName, $sPhoneNumber) + public function CreateAdministrator($sAdminUser, $sAdminPwd) { - // Maybe we should check that no other user with userid == 0 exists $oUser = new URP_Users(); $oUser->Set('login', $sAdminUser); $oUser->Set('password', $sAdminPwd); - $oUser->Set('email', $sAdminEmail); - $oUser->Set('firstname', $sFirstName); - $oUser->Set('lastname', $sLastName); - $oUser->Set('phonenumber', $sPhoneNumber); - $oUser->Set('userid', 1); // one is for root ! + $oUser->Set('email', 'n/a'); + $oUser->Set('firstname', 'administrator'); + $oUser->Set('lastname', 'itop'); + $oUser->Set('userid', 1); // let's mark it as #1 (for what purpose?) $iUserId = $oUser->DBInsertNoReload(); - $this->SetupUser($iUserId, true); + + // Add this user to the very specific 'admin' profile + $oUserProfile = new URP_UserProfile(); + $oUserProfile->Set('userid', $iUserId); + $oUserProfile->Set('profileid', ADMIN_PROFILE_ID); + $oUserProfile->DBInsertNoReload(); return true; } @@ -543,9 +596,9 @@ class UserRightsProfile extends UserRightsAddOnAPI { $iProfileId = $oProfile->GetKey(); - // Create grant records, for any class where it applies + // Create grant records, for any class where it matters (the rest could be done later on) // - foreach(array('bizmodel', 'application', 'gui', 'core/cmdb') as $sCategory) + foreach(array('bizmodel') as $sCategory) { foreach (MetaModel::GetClasses($sCategory) as $sClass) { @@ -633,6 +686,8 @@ class UserRightsProfile extends UserRightsAddOnAPI protected $m_aUserProfiles = array(); // userid,profileid -> object protected $m_aProPro = array(); // profileid,dimensionid -> object + protected $m_aAdmins = array(); // id of users being linked to the profile #ADMIN_PROFILE_ID + protected $m_aClassActionGrants = array(); // profile, class, action -> permission protected $m_aObjectActionGrants = array(); // userid, class, id, action -> permission, list of attributes @@ -667,7 +722,11 @@ class UserRightsProfile extends UserRightsAddOnAPI $oUserProfileSet = new DBObjectSet(DBObjectSearch::FromOQL("SELECT URP_UserProfile")); while ($oUserProfile = $oUserProfileSet->Fetch()) { - $this->m_aUserProfiles[$oUserProfile->Get('userid')][$oUserProfile->Get('profileid')] = $oUserProfile; + $this->m_aUserProfiles[$oUserProfile->Get('userid')][$oUserProfile->Get('profileid')] = $oUserProfile; + if ($oUserProfile->Get('profileid') == ADMIN_PROFILE_ID) + { + $this->m_aAdmins[] = $oUserProfile->Get('userid'); + } } $oProProSet = new DBObjectSet(DBObjectSearch::FromOQL("SELECT URP_ProfileProjection")); @@ -734,7 +793,7 @@ exit; if (isset($aTest)) return $aTest; // Get the permission for this profile/class/action - $oSearch = DBObjectSearch::FromOQL("SELECT URP_ActionGrant WHERE class = :class AND action = :action AND profileid = :profile"); + $oSearch = DBObjectSearch::FromOQL("SELECT URP_ActionGrant WHERE class = :class AND action = :action AND profileid = :profile AND permission = 'yes'"); $oSet = new DBObjectSet($oSearch, array(), array('class'=>$sClass, 'action'=>$sAction, 'profile'=>$iProfile)); if ($oSet->Count() < 1) { @@ -764,14 +823,24 @@ exit; { continue; // loop to the next profile } - elseif ($oGrantRecord->Get('permission') == 'yes') + else { $iInstancePermission = UR_ALLOWED_YES; - // merge the list of attributes allowed for this profile + // update the list of attributes with those allowed for this profile + // $oSearch = DBObjectSearch::FromOQL("SELECT URP_AttributeGrant WHERE actiongrantid = :actiongrantid"); $oSet = new DBObjectSet($oSearch, array(), array('actiongrantid' => $oGrantRecord->GetKey())); - $aAttributes = array_merge($aAttributes, $oSet->GetColumnAsArray('attcode', false)); + $aProfileAttributes = $oSet->GetColumnAsArray('attcode', false); + if (count($aProfileAttributes) == 0) + { + $aAllAttributes = array_keys(MetaModel::ListAttributeDefs($sClass)); + $aAttributes = array_merge($aAttributes, $aAllAttributes); + } + else + { + $aAttributes = array_merge($aAttributes, $aProfileAttributes); + } } } @@ -785,6 +854,9 @@ exit; public function IsActionAllowed($iUserId, $sClass, $iActionCode, dbObjectSet $oInstances) { + // super admin rights + if (in_array($iUserId, $this->m_aAdmins)) return true; + $oUser = $this->m_aUsers[$iUserId]; $oInstances->Rewind(); @@ -798,6 +870,7 @@ exit; if ($iInstancePermission != $iGlobalPermission) { $iGlobalPermission = UR_ALLOWED_DEPENDS; + break; } } else @@ -805,6 +878,8 @@ exit; $iGlobalPermission = $iInstancePermission; } } + $oInstances->Rewind(); + if (isset($iGlobalPermission)) { return $iGlobalPermission; @@ -817,6 +892,9 @@ exit; public function IsActionAllowedOnAttribute($iUserId, $sClass, $sAttCode, $iActionCode, dbObjectSet $oInstances) { + // super admin rights + if (in_array($iUserId, $this->m_aAdmins)) return true; + $oUser = $this->m_aUsers[$iUserId]; $oInstances->Rewind(); @@ -846,6 +924,8 @@ exit; $iGlobalPermission = $iInstancePermission; } } + $oInstances->Rewind(); + if (isset($iGlobalPermission)) { return $iGlobalPermission; @@ -858,6 +938,9 @@ exit; public function IsStimulusAllowed($iUserId, $sClass, $sStimulusCode, dbObjectSet $oInstances) { + // super admin rights + if (in_array($iUserId, $this->m_aAdmins)) return true; + $oUser = $this->m_aUsers[$iUserId]; // Note: this code is VERY close to the code of IsActionAllowed() @@ -869,19 +952,14 @@ exit; foreach($this->GetMatchingProfiles($oUser, $oObject) as $iProfile) { // Get the permission for this profile/class/stimulus - $oSearch = DBObjectSearch::FromOQL("SELECT URP_StimulusGrant WHERE class = :class AND stimulus = :stimulus AND profileid = :profile"); + $oSearch = DBObjectSearch::FromOQL("SELECT URP_StimulusGrant WHERE class = :class AND stimulus = :stimulus AND profileid = :profile AND permission = 'yes'"); $oSet = new DBObjectSet($oSearch, array(), array('class'=>$sClass, 'stimulus'=>$sStimulusCode, 'profile'=>$iProfile)); if ($oSet->Count() < 1) { return UR_ALLOWED_NO; } - - $oGrantRecord = $oSet->Fetch(); - $sPermission = $oGrantRecord->Get('permission'); - if ($sPermission == 'yes') - { - $iInstancePermission = UR_ALLOWED_YES; - } + // no need to fetch the record, we've requested the records having permission = 'yes' + $iInstancePermission = UR_ALLOWED_YES; } if (isset($iGlobalPermission)) { @@ -895,6 +973,8 @@ exit; $iGlobalPermission = $iInstancePermission; } } + $oInstances->Rewind(); + if (isset($iGlobalPermission)) { return $iGlobalPermission; @@ -918,28 +998,31 @@ exit; $aObjectProjection = $this->m_aClassProjs[$sClass][$iDimension]->ProjectObject($oObject); $aRes = array(); - foreach ($this->m_aUserProfiles[$iUser] as $iProfile => $oProfile) + if (array_key_exists($iUser, $this->m_aUserProfiles) > 0) { - if (is_null($aObjectProjection)) + foreach ($this->m_aUserProfiles[$iUser] as $iProfile => $oProfile) { - $aRes[] = $iProfile; - } - else - { - // user projection to be cached on a given page ! - $aUserProjection = $this->m_aProPros[$iProfile][$iDimension]->ProjectUser($oUser); - - if (is_null($aUserProjection)) + if (is_null($aObjectProjection)) { $aRes[] = $iProfile; } else { - $aMatchingValues = array_intersect($aObjectProjection, $aUserProjection); - if (count($aMatchingValues) > 0) + // user projection to be cached on a given page ! + $aUserProjection = $this->m_aProPros[$iProfile][$iDimension]->ProjectUser($oUser); + + if (is_null($aUserProjection)) { $aRes[] = $iProfile; } + else + { + $aMatchingValues = array_intersect($aObjectProjection, $aUserProjection); + if (count($aMatchingValues) > 0) + { + $aRes[] = $iProfile; + } + } } } } diff --git a/business/itop.business.class.inc.php b/business/itop.business.class.inc.php index 764149007..2015210b4 100644 --- a/business/itop.business.class.inc.php +++ b/business/itop.business.class.inc.php @@ -249,7 +249,7 @@ class bizPerson extends bizContact "name_attcode" => "name", "state_attcode" => "", "reconc_keys" => array("org_name", "first_name", "name"), // comment en définir plusieurs - // "reconc_keys" => array("org_name", "employe_number"), + // "reconc_keys" => array("org_name", "employee_number"), "db_table" => "persons", // Can it use the same physical DB table as any contact ? "db_key_field" => "id", "db_finalclass_field" => "", @@ -258,20 +258,21 @@ class bizPerson extends bizContact MetaModel::Init_Params($aParams); MetaModel::Init_InheritAttributes(); MetaModel::Init_AddAttribute(new AttributeString("first_name", array("label"=>"first Name", "description"=>"First name", "allowed_values"=>null, "sql"=>"first_name", "default_value"=>"", "is_null_allowed"=>true, "depends_on"=>array()))); - MetaModel::Init_AddAttribute(new AttributeString("employe_number", array("label"=>"Employe Number", "description"=>"employe number", "allowed_values"=>null, "sql"=>"employe_number", "default_value"=>"", "is_null_allowed"=>true, "depends_on"=>array()))); + MetaModel::Init_AddAttribute(new AttributeString("employee_number", array("label"=>"Employee Number", "description"=>"employee number", "allowed_values"=>null, "sql"=>"employee_number", "default_value"=>"", "is_null_allowed"=>true, "depends_on"=>array()))); -// MetaModel::Init_AddAttribute(new AttributeExternalKey("login_id", array("targetclass"=>"URP_Users", "label"=>"Login", "description"=>"Login information", "allowed_values"=>null, "sql"=>"login_id", "is_null_allowed"=>true, "depends_on"=>array()))); + MetaModel::Init_AddAttribute(new AttributeExternalKey("login_id", array("targetclass"=>"URP_Users", "label"=>"Login", "description"=>"Login information", "allowed_values"=>null, "sql"=>"login_id", "is_null_allowed"=>true, "depends_on"=>array()))); MetaModel::Init_InheritFilters(); MetaModel::Init_AddFilterFromAttribute("first_name"); - MetaModel::Init_AddFilterFromAttribute("employe_number"); + MetaModel::Init_AddFilterFromAttribute("employee_number"); + MetaModel::Init_AddFilterFromAttribute("login_id"); // Display lists - MetaModel::Init_SetZListItems('details', array('first_name', 'name', 'status', 'org_id', 'email', 'location_id', 'phone', 'employe_number')); // Attributes to be displayed for the complete details + MetaModel::Init_SetZListItems('details', array('first_name', 'name', 'status', 'org_id', 'email', 'location_id', 'phone', 'employee_number', 'login_id')); // Attributes to be displayed for the complete details MetaModel::Init_SetZListItems('list', array('first_name', 'name', 'status', 'org_id', 'email', 'location_id', 'phone')); // Attributes to be displayed for a list // Search criteria - MetaModel::Init_SetZListItems('standard_search', array('first_name', 'name', 'status', 'email', 'location_id', 'phone', 'employe_number')); // Criteria of the std search form - MetaModel::Init_SetZListItems('advanced_search', array('first_name', 'name', 'status', 'email', 'location_id', 'phone', 'employe_number')); // Criteria of the advanced search form + MetaModel::Init_SetZListItems('standard_search', array('first_name', 'name', 'status', 'email', 'location_id', 'phone', 'employee_number', 'login_id')); // Criteria of the std search form + MetaModel::Init_SetZListItems('advanced_search', array('first_name', 'name', 'status', 'email', 'location_id', 'phone', 'employee_number', 'login_id')); // Criteria of the advanced search form } public function Generate(cmdbDataGenerator $oGenerator) diff --git a/core/cmdbchangeop.class.inc.php b/core/cmdbchangeop.class.inc.php index aadbc656d..2c0913910 100644 --- a/core/cmdbchangeop.class.inc.php +++ b/core/cmdbchangeop.class.inc.php @@ -194,8 +194,13 @@ class CMDBChangeOpSetAttribute extends CMDBChangeOp public function GetDescription() { $sResult = ''; - $oEmptySet = new DBObjectSet($this->Get('objclass')); - if (UserRights::IsActionAllowedOnAttribute($this->Get('objclass'), $this->Get('attcode'), UR_ACTION_READ, $oEmptySet) == UR_ALLOWED_YES) + $oTargetObjectClass = $this->Get('objclass'); + $oTargetObjectKey = $this->Get('objkey'); + $oTargetSearch = new DBObjectSearch($oTargetObjectClass); + $oTargetSearch->AddCondition('id', $oTargetObjectKey); + + $oMonoObjectSet = new DBObjectSet($oTargetSearch); + if (UserRights::IsActionAllowedOnAttribute($this->Get('objclass'), $this->Get('attcode'), UR_ACTION_READ, $oMonoObjectSet) == UR_ALLOWED_YES) { $oAttDef = MetaModel::GetAttributeDef($this->Get('objclass'), $this->Get('attcode')); $sAttName = $oAttDef->GetLabel(); diff --git a/core/dbobjectset.class.php b/core/dbobjectset.class.php index 6384864d8..d1b80429c 100644 --- a/core/dbobjectset.class.php +++ b/core/dbobjectset.class.php @@ -21,7 +21,7 @@ class DBObjectSet private $m_aId2Row; private $m_iCurrRow; - public function __construct($oFilter, $aOrderBy = array(), $aArgs = array()) + public function __construct(DBObjectSearch $oFilter, $aOrderBy = array(), $aArgs = array()) { $this->m_oFilter = $oFilter; $this->m_aOrderBy = $aOrderBy; diff --git a/core/metamodel.class.php b/core/metamodel.class.php index cbb0b1637..5fe13c140 100644 --- a/core/metamodel.class.php +++ b/core/metamodel.class.php @@ -1173,6 +1173,32 @@ abstract class MetaModel protected static $m_aQueryStructCache = array(); + protected static function PrepareQueryArguments($aArgs) + { + // Translate any object into scalars + // + $aScalarArgs = array(); + foreach($aArgs as $sArgName => $value) + { + if (self::IsValidObject($value)) + { + $aScalarArgs[$sArgName] = $value->GetKey(); + $aScalarArgs[$sArgName.'->id'] = $value->GetKey(); + + $sClass = get_class($value); + foreach(self::ListAttributeDefs($sClass) as $sAttCode => $oAttDef) + { + $aScalarArgs[$sArgName.'->'.$sAttCode] = $value->Get($sAttCode); + } + } + else + { + $aScalarArgs[$sArgName] = (string) $value; + } + } + return $aScalarArgs; + } + public static function MakeSelectQuery(DBObjectSearch $oFilter, $aOrderBy = array(), $aArgs = array()) { // Query caching @@ -1219,30 +1245,9 @@ abstract class MetaModel } } - // Prepare arguments (translate any object into scalars) - // - $aScalarArgs = $oFilter->GetInternalParams(); - foreach($aArgs as $sArgName => $value) - { - if (self::IsValidObject($value)) - { - $aScalarArgs[$sArgName] = $value->GetKey(); - $aScalarArgs[$sArgName.'->id'] = $value->GetKey(); - - $sClass = get_class($value); - foreach(self::ListAttributeDefs($sClass) as $sAttCode => $oAttDef) - { - $aScalarArgs[$sArgName.'->'.$sAttCode] = $value->Get($sAttCode); - } - } - else - { - $aScalarArgs[$sArgName] = (string) $value; - } - } - // Go // + $aScalarArgs = array_merge(self::PrepareQueryArguments($aArgs), $oFilter->GetInternalParams()); $sRes = $oSelect->RenderSelect($aOrderBy, $aScalarArgs); if (self::$m_bTraceQueries) @@ -1277,17 +1282,18 @@ abstract class MetaModel echo "

Count of built queries: ".count(self::$m_aQueriesLog)."

"; } - public static function MakeDeleteQuery(DBObjectSearch $oFilter) + public static function MakeDeleteQuery(DBObjectSearch $oFilter, $aArgs = array()) { $aTranslation = array(); $aClassAliases = array(); $aTableAliases = array(); $oConditionTree = $oFilter->GetCriteria(); $oSelect = self::MakeQuery($oFilter->GetClassAlias(), $oConditionTree, $aClassAliases, $aTableAliases, $aTranslation, $oFilter); - return $oSelect->RenderDelete(); + $aScalarArgs = array_merge(self::PrepareQueryArguments($aArgs), $oFilter->GetInternalParams()); + return $oSelect->RenderDelete($aScalarArgs); } - public static function MakeUpdateQuery(DBObjectSearch $oFilter, $aValues) + public static function MakeUpdateQuery(DBObjectSearch $oFilter, $aValues, $aArgs = array()) { // $aValues is an array of $sAttCode => $value $aTranslation = array(); @@ -1295,7 +1301,8 @@ abstract class MetaModel $aTableAliases = array(); $oConditionTree = $oFilter->GetCriteria(); $oSelect = self::MakeQuery($oFilter->GetClassAlias(), $oConditionTree, $aClassAliases, $aTableAliases, $aTranslation, $oFilter, array(), $aValues); - return $oSelect->RenderUpdate(); + $aScalarArgs = array_merge(self::PrepareQueryArguments($aArgs), $oFilter->GetInternalParams()); + return $oSelect->RenderUpdate($aScalarArgs); } private static function MakeQuery($sGlobalTargetAlias, &$oConditionTree, &$aClassAliases, &$aTableAliases, &$aTranslation, DBObjectSearch $oFilter, $aExpectedAtts = array(), $aValues = array()) @@ -2439,6 +2446,9 @@ abstract class MetaModel if (self::DBExists()) { CMDBSource::SelectDB(self::$m_sDBName); + + // Some of the init could not be done earlier (requiring classes to be declared and DB to be accessible) + self::InitPlugins(); } else { @@ -2447,8 +2457,6 @@ abstract class MetaModel throw new CoreException('Database not found, check your configuration file', array('config_file'=>$sConfigFile, 'db_name'=>self::$m_sDBName)); } } - // Some of the init could not be done earlier (requiring classes to be declared and DB to be accessible) - self::InitPlugins(); } public static function LoadConfig($sConfigFile) diff --git a/core/sqlquery.class.inc.php b/core/sqlquery.class.inc.php index 1661ed4a2..700d0b33b 100644 --- a/core/sqlquery.class.inc.php +++ b/core/sqlquery.class.inc.php @@ -171,7 +171,7 @@ class SQLQuery } // Interface, build the SQL query - public function RenderDelete() + public function RenderDelete($aArgs = array()) { // The goal will be to complete the list as we build the Joins $aFrom = array(); @@ -193,12 +193,12 @@ class SQLQuery throw new CoreException("Building a request wich will delete every object of a given table -looks suspicious- please use truncate instead..."); } */ - $sWhere = self::ClauseWhere($oCondition); + $sWhere = self::ClauseWhere($oCondition, $aArgs); return "DELETE $sDelete FROM $sFrom WHERE $sWhere"; } // Interface, build the SQL query - public function RenderUpdate() + public function RenderUpdate($aArgs = array()) { // The goal will be to complete the list as we build the Joins $aFrom = array(); @@ -210,7 +210,7 @@ class SQLQuery $sFrom = self::ClauseFrom($aFrom); $sValues = self::ClauseValues($aSetValues); - $sWhere = self::ClauseWhere($oCondition); + $sWhere = self::ClauseWhere($oCondition, $aArgs); return "UPDATE $sFrom SET $sValues WHERE $sWhere"; } diff --git a/pages/usermanagement_classproj.php b/pages/usermanagement_classproj.php index 826f04111..18ee898bb 100644 --- a/pages/usermanagement_classproj.php +++ b/pages/usermanagement_classproj.php @@ -52,18 +52,18 @@ function ComputeProjections($oPage, $sScope) foreach ($aDimensions as $iDimension => $oDimension) { // #@# to be moved, may be time consuming - $oDimension->CheckProjectionSpec($aClassProjs[$sClass][$iDimension]); + $oDimension->CheckProjectionSpec($aClassProjs[$sClass][$iDimension], $sClass); $aValues = $aClassProjs[$sClass][$iDimension]->ProjectObject($oObject); if (is_null($aValues)) { - $sValues = ''; + $sValues = htmlentities(''); } else { $sValues = implode(', ', $aValues); } - $oObjectProj['dim'.$oDimension->GetKey()] = htmlentities($sValues); + $oObjectProj['dim'.$oDimension->GetKey()] = $sValues; } $aDisplayData[] = $oObjectProj; diff --git a/pages/usermanagement_profileproj.php b/pages/usermanagement_profileproj.php index 4ca6d6aa5..c29f80849 100644 --- a/pages/usermanagement_profileproj.php +++ b/pages/usermanagement_profileproj.php @@ -62,18 +62,18 @@ function ComputeProjections($oPage) foreach ($aDimensions as $iDimension => $oDimension) { // #@# to be moved, may be time consuming - $oDimension->CheckProjectionSpec($aProPros[$iProfile][$iDimension]); + $oDimension->CheckProjectionSpec($aProPros[$iProfile][$iDimension], get_class($oUser)); $aValues = $aProPros[$iProfile][$iDimension]->ProjectUser($oUser); if (is_null($aValues)) { - $sValues = ''; + $sValues = htmlentities(''); } else { $sValues = implode(', ', $aValues); } - $aUserProfileProj['dim'.$oDimension->GetKey()] = htmlentities($sValues); + $aUserProfileProj['dim'.$oDimension->GetKey()] = $sValues; } $aDisplayData[] = $aUserProfileProj; diff --git a/pages/usermanagement_userstatus.php b/pages/usermanagement_userstatus.php index 475e39ad8..8b243ff2a 100644 --- a/pages/usermanagement_userstatus.php +++ b/pages/usermanagement_userstatus.php @@ -45,18 +45,18 @@ function ComputeObjectProjections($oPage, $oObject) foreach ($aDimensions as $iDimension => $oDimension) { // #@# to be moved, may be time consuming - $oDimension->CheckProjectionSpec($aClassProjs[$sClass][$iDimension]); + $oDimension->CheckProjectionSpec($aClassProjs[$sClass][$iDimension], $sClass); $aValues = $aClassProjs[$sClass][$iDimension]->ProjectObject($oObject); if (is_null($aValues)) { - $sValues = ''; + $sValues = htmlentities(''); } else { $sValues = implode(', ', $aValues); } - $oObjectProj['dim'.$oDimension->GetKey()] = htmlentities($sValues); + $oObjectProj['dim'.$oDimension->GetKey()] = $sValues; } $aDisplayData[] = $oObjectProj; @@ -117,18 +117,18 @@ function ComputeUserProjections($oPage, $oUser) foreach ($aDimensions as $iDimension => $oDimension) { // #@# to be moved, may be time consuming - $oDimension->CheckProjectionSpec($aProPros[$iProfile][$iDimension]); + $oDimension->CheckProjectionSpec($aProPros[$iProfile][$iDimension], get_class($oUser)); $aValues = $aProPros[$iProfile][$iDimension]->ProjectUser($oUser); if (is_null($aValues)) { - $sValues = ''; + $sValues = htmlentities(''); } else { $sValues = implode(', ', $aValues); } - $aUserProfileProj['dim'.$oDimension->GetKey()] = htmlentities($sValues); + $aUserProfileProj['dim'.$oDimension->GetKey()] = $sValues; } $aDisplayData[] = $aUserProfileProj; diff --git a/setup/data/03.persons.xml b/setup/data/03.persons.xml index 9a102ad6e..edee771b0 100644 --- a/setup/data/03.persons.xml +++ b/setup/data/03.persons.xml @@ -8,7 +8,8 @@ 29 Jules - + + Dumas @@ -18,7 +19,8 @@ 1 Dumas - + + Hugo @@ -28,6 +30,7 @@ 33172382223 1 Victor -e12345 +e12345 + diff --git a/setup/data/23.dimensions.xml b/setup/data/23.dimensions.xml new file mode 100644 index 000000000..3104cd3d5 --- /dev/null +++ b/setup/data/23.dimensions.xml @@ -0,0 +1,13 @@ + + + +organization + +bizOrganization + + +site + + + + \ No newline at end of file diff --git a/setup/data/24.profiles.xml b/setup/data/24.profiles.xml new file mode 100644 index 000000000..77121719e --- /dev/null +++ b/setup/data/24.profiles.xml @@ -0,0 +1,11 @@ + + + +Administrator +Has the rights on everything (ignores the grant records) + + +Delivery Manager France +Persons in charge of the operations for French customers + + diff --git a/setup/data/25.classprojection.xml b/setup/data/25.classprojection.xml new file mode 100644 index 000000000..267714046 --- /dev/null +++ b/setup/data/25.classprojection.xml @@ -0,0 +1,555 @@ + + + +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/setup/data/26.profileprojection.xml b/setup/data/26.profileprojection.xml new file mode 100644 index 000000000..6d9446278 --- /dev/null +++ b/setup/data/26.profileprojection.xml @@ -0,0 +1,15 @@ + + + +1 +2 +1;2 + + + +2 +2 +<any> + + + diff --git a/setup/data/27.actiongrant.xml b/setup/data/27.actiongrant.xml new file mode 100644 index 000000000..6375b1b8d --- /dev/null +++ b/setup/data/27.actiongrant.xml @@ -0,0 +1,1659 @@ + + + +2 +bizOrganization +yes +read + + +2 +bizOrganization +yes +modify + + +2 +bizOrganization +yes +delete + + +2 +bizOrganization +yes +bulk read + + +2 +bizOrganization +yes +bulk modify + + +2 +bizOrganization +yes +bulk delete + + +2 +logRealObject +yes +read + + +2 +logRealObject +yes +modify + + +2 +logRealObject +yes +delete + + +2 +logRealObject +yes +bulk read + + +2 +logRealObject +yes +bulk modify + + +2 +logRealObject +yes +bulk delete + + +2 +bizContact +yes +read + + +2 +bizContact +yes +modify + + +2 +bizContact +yes +delete + + +2 +bizContact +yes +bulk read + + +2 +bizContact +yes +bulk modify + + +2 +bizContact +yes +bulk delete + + +2 +bizPerson +yes +read + + +2 +bizPerson +yes +modify + + +2 +bizPerson +yes +delete + + +2 +bizPerson +yes +bulk read + + +2 +bizPerson +yes +bulk modify + + +2 +bizPerson +yes +bulk delete + + +2 +bizTeam +yes +read + + +2 +bizTeam +yes +modify + + +2 +bizTeam +yes +delete + + +2 +bizTeam +yes +bulk read + + +2 +bizTeam +yes +bulk modify + + +2 +bizTeam +yes +bulk delete + + +2 +bizDocument +yes +read + + +2 +bizDocument +yes +modify + + +2 +bizDocument +yes +delete + + +2 +bizDocument +yes +bulk read + + +2 +bizDocument +yes +bulk modify + + +2 +bizDocument +yes +bulk delete + + +2 +bizDocVersion +yes +read + + +2 +bizDocVersion +yes +modify + + +2 +bizDocVersion +yes +delete + + +2 +bizDocVersion +yes +bulk read + + +2 +bizDocVersion +yes +bulk modify + + +2 +bizDocVersion +yes +bulk delete + + +2 +lnkDocumentRealObject +yes +read + + +2 +lnkDocumentRealObject +yes +modify + + +2 +lnkDocumentRealObject +yes +delete + + +2 +lnkDocumentRealObject +yes +bulk read + + +2 +lnkDocumentRealObject +yes +bulk modify + + +2 +lnkDocumentRealObject +yes +bulk delete + + +2 +lnkContactRealObject +yes +read + + +2 +lnkContactRealObject +yes +modify + + +2 +lnkContactRealObject +yes +delete + + +2 +lnkContactRealObject +yes +bulk read + + +2 +lnkContactRealObject +yes +bulk modify + + +2 +lnkContactRealObject +yes +bulk delete + + +2 +logInfra +yes +read + + +2 +logInfra +yes +modify + + +2 +logInfra +yes +delete + + +2 +logInfra +yes +bulk read + + +2 +logInfra +yes +bulk modify + + +2 +logInfra +yes +bulk delete + + +2 +bizLocation +yes +read + + +2 +bizLocation +yes +modify + + +2 +bizLocation +yes +delete + + +2 +bizLocation +yes +bulk read + + +2 +bizLocation +yes +bulk modify + + +2 +bizLocation +yes +bulk delete + + +2 +bizCircuit +yes +read + + +2 +bizCircuit +yes +modify + + +2 +bizCircuit +yes +delete + + +2 +bizCircuit +yes +bulk read + + +2 +bizCircuit +yes +bulk modify + + +2 +bizCircuit +yes +bulk delete + + +2 +bizInterface +yes +read + + +2 +bizInterface +yes +modify + + +2 +bizInterface +yes +delete + + +2 +bizInterface +yes +bulk read + + +2 +bizInterface +yes +bulk modify + + +2 +bizInterface +yes +bulk delete + + +2 +lnkInterfaces +yes +read + + +2 +lnkInterfaces +yes +modify + + +2 +lnkInterfaces +yes +delete + + +2 +lnkInterfaces +yes +bulk read + + +2 +lnkInterfaces +yes +bulk modify + + +2 +lnkInterfaces +yes +bulk delete + + +2 +bizDevice +yes +read + + +2 +bizDevice +yes +modify + + +2 +bizDevice +yes +delete + + +2 +bizDevice +yes +bulk read + + +2 +bizDevice +yes +bulk modify + + +2 +bizDevice +yes +bulk delete + + +2 +bizPC +yes +read + + +2 +bizPC +yes +modify + + +2 +bizPC +yes +delete + + +2 +bizPC +yes +bulk read + + +2 +bizPC +yes +bulk modify + + +2 +bizPC +yes +bulk delete + + +2 +bizServer +yes +read + + +2 +bizServer +yes +modify + + +2 +bizServer +yes +delete + + +2 +bizServer +yes +bulk read + + +2 +bizServer +yes +bulk modify + + +2 +bizServer +yes +bulk delete + + +2 +bizNetworkDevice +yes +read + + +2 +bizNetworkDevice +yes +modify + + +2 +bizNetworkDevice +yes +delete + + +2 +bizNetworkDevice +yes +bulk read + + +2 +bizNetworkDevice +yes +bulk modify + + +2 +bizNetworkDevice +yes +bulk delete + + +2 +bizInfraGroup +yes +read + + +2 +bizInfraGroup +yes +modify + + +2 +bizInfraGroup +yes +delete + + +2 +bizInfraGroup +yes +bulk read + + +2 +bizInfraGroup +yes +bulk modify + + +2 +bizInfraGroup +yes +bulk delete + + +2 +bizApplication +yes +read + + +2 +bizApplication +yes +modify + + +2 +bizApplication +yes +delete + + +2 +bizApplication +yes +bulk read + + +2 +bizApplication +yes +bulk modify + + +2 +bizApplication +yes +bulk delete + + +2 +lnkInfraGrouping +yes +read + + +2 +lnkInfraGrouping +yes +modify + + +2 +lnkInfraGrouping +yes +delete + + +2 +lnkInfraGrouping +yes +bulk read + + +2 +lnkInfraGrouping +yes +bulk modify + + +2 +lnkInfraGrouping +yes +bulk delete + + +2 +lnkClientServer +yes +read + + +2 +lnkClientServer +yes +modify + + +2 +lnkClientServer +yes +delete + + +2 +lnkClientServer +yes +bulk read + + +2 +lnkClientServer +yes +bulk modify + + +2 +lnkClientServer +yes +bulk delete + + +2 +bizPatch +yes +read + + +2 +bizPatch +yes +modify + + +2 +bizPatch +yes +delete + + +2 +bizPatch +yes +bulk read + + +2 +bizPatch +yes +bulk modify + + +2 +bizPatch +yes +bulk delete + + +2 +bizIncidentTicket +yes +read + + +2 +bizIncidentTicket +no +modify + + +2 +bizIncidentTicket +no +delete + + +2 +bizIncidentTicket +yes +bulk read + + +2 +bizIncidentTicket +no +bulk modify + + +2 +bizIncidentTicket +no +bulk delete + + +2 +lnkRelatedTicket +yes +read + + +2 +lnkRelatedTicket +yes +modify + + +2 +lnkRelatedTicket +yes +delete + + +2 +lnkRelatedTicket +yes +bulk read + + +2 +lnkRelatedTicket +yes +bulk modify + + +2 +lnkRelatedTicket +yes +bulk delete + + +2 +lnkInfraTicket +yes +read + + +2 +lnkInfraTicket +yes +modify + + +2 +lnkInfraTicket +yes +delete + + +2 +lnkInfraTicket +yes +bulk read + + +2 +lnkInfraTicket +yes +bulk modify + + +2 +lnkInfraTicket +yes +bulk delete + + +2 +lnkContactTicket +yes +read + + +2 +lnkContactTicket +yes +modify + + +2 +lnkContactTicket +yes +delete + + +2 +lnkContactTicket +yes +bulk read + + +2 +lnkContactTicket +yes +bulk modify + + +2 +lnkContactTicket +yes +bulk delete + + +2 +bizWorkgroup +yes +read + + +2 +bizWorkgroup +yes +modify + + +2 +bizWorkgroup +yes +delete + + +2 +bizWorkgroup +yes +bulk read + + +2 +bizWorkgroup +yes +bulk modify + + +2 +bizWorkgroup +yes +bulk delete + + +2 +bizContract +yes +read + + +2 +bizContract +yes +modify + + +2 +bizContract +yes +delete + + +2 +bizContract +yes +bulk read + + +2 +bizContract +yes +bulk modify + + +2 +bizContract +yes +bulk delete + + +2 +lnkInfraContract +yes +read + + +2 +lnkInfraContract +yes +modify + + +2 +lnkInfraContract +yes +delete + + +2 +lnkInfraContract +yes +bulk read + + +2 +lnkInfraContract +yes +bulk modify + + +2 +lnkInfraContract +yes +bulk delete + + +2 +lnkContactContract +yes +read + + +2 +lnkContactContract +yes +modify + + +2 +lnkContactContract +yes +delete + + +2 +lnkContactContract +yes +bulk read + + +2 +lnkContactContract +yes +bulk modify + + +2 +lnkContactContract +yes +bulk delete + + +2 +lnkDocumentContract +yes +read + + +2 +lnkDocumentContract +yes +modify + + +2 +lnkDocumentContract +yes +delete + + +2 +lnkDocumentContract +yes +bulk read + + +2 +lnkDocumentContract +yes +bulk modify + + +2 +lnkDocumentContract +yes +bulk delete + + +2 +bizChangeTicket +yes +read + + +2 +bizChangeTicket +no +modify + + +2 +bizChangeTicket +no +delete + + +2 +bizChangeTicket +yes +bulk read + + +2 +bizChangeTicket +no +bulk modify + + +2 +bizChangeTicket +no +bulk delete + + +2 +lnkInfraChangeTicket +yes +read + + +2 +lnkInfraChangeTicket +yes +modify + + +2 +lnkInfraChangeTicket +yes +delete + + +2 +lnkInfraChangeTicket +yes +bulk read + + +2 +lnkInfraChangeTicket +yes +bulk modify + + +2 +lnkInfraChangeTicket +yes +bulk delete + + +2 +lnkContactChange +yes +read + + +2 +lnkContactChange +yes +modify + + +2 +lnkContactChange +yes +delete + + +2 +lnkContactChange +yes +bulk read + + +2 +lnkContactChange +yes +bulk modify + + +2 +lnkContactChange +yes +bulk delete + + +2 +bizKnownError +yes +read + + +2 +bizKnownError +yes +modify + + +2 +bizKnownError +yes +delete + + +2 +bizKnownError +yes +bulk read + + +2 +bizKnownError +yes +bulk modify + + +2 +bizKnownError +yes +bulk delete + + +2 +lnkInfraError +yes +read + + +2 +lnkInfraError +yes +modify + + +2 +lnkInfraError +yes +delete + + +2 +lnkInfraError +yes +bulk read + + +2 +lnkInfraError +yes +bulk modify + + +2 +lnkInfraError +yes +bulk delete + + +2 +lnkDocumentError +yes +read + + +2 +lnkDocumentError +yes +modify + + +2 +lnkDocumentError +yes +delete + + +2 +lnkDocumentError +yes +bulk read + + +2 +lnkDocumentError +yes +bulk modify + + +2 +lnkDocumentError +yes +bulk delete + + +2 +AuditCategory +yes +read + + +2 +AuditCategory +yes +modify + + +2 +AuditCategory +yes +delete + + +2 +AuditCategory +yes +bulk read + + +2 +AuditCategory +yes +bulk modify + + +2 +AuditCategory +yes +bulk delete + + +2 +AuditRule +yes +read + + +2 +AuditRule +yes +modify + + +2 +AuditRule +yes +delete + + +2 +AuditRule +yes +bulk read + + +2 +AuditRule +yes +bulk modify + + +2 +AuditRule +yes +bulk delete + + +2 +menuNode +yes +read + + +2 +menuNode +yes +modify + + +2 +menuNode +yes +delete + + +2 +menuNode +yes +bulk read + + +2 +menuNode +yes +bulk modify + + +2 +menuNode +yes +bulk delete + + +2 +CMDBChange +yes +read + + +2 +CMDBChange +yes +modify + + +2 +CMDBChange +yes +delete + + +2 +CMDBChange +yes +bulk read + + +2 +CMDBChange +yes +bulk modify + + +2 +CMDBChange +yes +bulk delete + + +2 +CMDBChangeOp +yes +read + + +2 +CMDBChangeOp +yes +modify + + +2 +CMDBChangeOp +yes +delete + + +2 +CMDBChangeOp +yes +bulk read + + +2 +CMDBChangeOp +yes +bulk modify + + +2 +CMDBChangeOp +yes +bulk delete + + +2 +CMDBChangeOpCreate +yes +read + + +2 +CMDBChangeOpCreate +yes +modify + + +2 +CMDBChangeOpCreate +yes +delete + + +2 +CMDBChangeOpCreate +yes +bulk read + + +2 +CMDBChangeOpCreate +yes +bulk modify + + +2 +CMDBChangeOpCreate +yes +bulk delete + + +2 +CMDBChangeOpDelete +yes +read + + +2 +CMDBChangeOpDelete +yes +modify + + +2 +CMDBChangeOpDelete +yes +delete + + +2 +CMDBChangeOpDelete +yes +bulk read + + +2 +CMDBChangeOpDelete +yes +bulk modify + + +2 +CMDBChangeOpDelete +yes +bulk delete + + +2 +CMDBChangeOpSetAttribute +yes +read + + +2 +CMDBChangeOpSetAttribute +yes +modify + + +2 +CMDBChangeOpSetAttribute +yes +delete + + +2 +CMDBChangeOpSetAttribute +yes +bulk read + + +2 +CMDBChangeOpSetAttribute +yes +bulk modify + + +2 +CMDBChangeOpSetAttribute +yes +bulk delete + + diff --git a/setup/data/28.attributegrant.xml b/setup/data/28.attributegrant.xml new file mode 100644 index 000000000..cf1461167 --- /dev/null +++ b/setup/data/28.attributegrant.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/setup/data/29.stimulusgrant.xml b/setup/data/29.stimulusgrant.xml new file mode 100644 index 000000000..974b929ea --- /dev/null +++ b/setup/data/29.stimulusgrant.xml @@ -0,0 +1,189 @@ + + + +2 +bizServer +no +ev_store + + +2 +bizServer +no +ev_ship + + +2 +bizServer +no +ev_plug + + +2 +bizServer +no +ev_configuration_finished + + +2 +bizServer +no +ev_val_failed + + +2 +bizServer +no +ev_mtp + + +2 +bizServer +no +ev_start_change + + +2 +bizServer +no +ev_end_change + + +2 +bizServer +no +ev_decommission + + +2 +bizServer +no +ev_obsolete + + +2 +bizServer +no +ev_recycle + + +2 +bizIncidentTicket +no +ev_assign + + +2 +bizIncidentTicket +no +ev_reassign + + +2 +bizIncidentTicket +no +ev_start_working + + +2 +bizIncidentTicket +no +ev_close + + +2 +bizContract +no +ev_freeze_version + + +2 +bizContract +no +ev_sign + + +2 +bizContract +no +ev_begin + + +2 +bizContract +no +ev_notice + + +2 +bizContract +no +ev_terminate + + +2 +bizContract +no +ev_elapsed + + +2 +bizChangeTicket +yes +ev_validate + + +2 +bizChangeTicket +yes +ev_reject + + +2 +bizChangeTicket +no +ev_reopen + + +2 +bizChangeTicket +no +ev_plan + + +2 +bizChangeTicket +yes +ev_approve + + +2 +bizChangeTicket +no +ev_replan + + +2 +bizChangeTicket +yes +ev_notapprove + + +2 +bizChangeTicket +no +ev_implement + + +2 +bizChangeTicket +no +ev_monitor + + +2 +bizChangeTicket +yes +ev_finish + + diff --git a/setup/data/export.cmd b/setup/data/export.cmd index 5c95ce860..923d30177 100644 --- a/setup/data/export.cmd +++ b/setup/data/export.cmd @@ -1,27 +1,36 @@ SET WEBROOT=http://localhost:81 SET USER=Erwan SET PWD=Taloc + REM The order (numbering) of the files is important since REM it dictates the order to import them back -wget --output-document=01.organizations.xml --post-data="auth_user=%USER%&auth_pwd=%PWD%&operation=login" "%WEBROOT%/pages/export.php?expression=SELECT bizOrganization&format=xml" -wget --output-document=02.locations.xml --post-data="auth_user=%USER%&auth_pwd=%PWD%&operation=login" "%WEBROOT%/pages/export.php?expression=SELECT bizLocation&format=xml" -wget --output-document=03.persons.xml --post-data="auth_user=%USER%&auth_pwd=%PWD%&operation=login" "%WEBROOT%/pages/export.php?expression=SELECT bizPerson&format=xml" -wget --output-document=04.teams.xml --post-data="auth_user=%USER%&auth_pwd=%PWD%&operation=login" "%WEBROOT%/pages/export.php?expression=SELECT bizTeam&format=xml" -wget --output-document=05.pcs.xml --post-data="auth_user=%USER%&auth_pwd=%PWD%&operation=login" "%WEBROOT%/pages/export.php?expression=SELECT bizPC&format=xml" -wget --output-document=06.servers.xml --post-data="auth_user=%USER%&auth_pwd=%PWD%&operation=login" "%WEBROOT%/pages/export.php?expression=SELECT bizServer&format=xml" -wget --output-document=07.applications.xml --post-data="auth_user=%USER%&auth_pwd=%PWD%&operation=login" "%WEBROOT%/pages/export.php?expression=SELECT bizApplication&format=xml" -wget --output-document=08.nw-devices.xml --post-data="auth_user=%USER%&auth_pwd=%PWD%&operation=login" "%WEBROOT%/pages/export.php?expression=SELECT bizNetworkDevice&format=xml" -wget --output-document=09.links_contacts.xml --post-data="auth_user=%USER%&auth_pwd=%PWD%&operation=login" "%WEBROOT%/pages/export.php?expression=SELECT lnkContactRealObject&format=xml" -wget --output-document=10.workgroups.xml --post-data="auth_user=%USER%&auth_pwd=%PWD%&operation=login" "%WEBROOT%/pages/export.php?expression=SELECT bizWorkgroup&format=xml" -wget --output-document=11.incidents.xml --post-data="auth_user=%USER%&auth_pwd=%PWD%&operation=login" "%WEBROOT%/pages/export.php?expression=SELECT bizIncidentTicket&format=xml" -wget --output-document=12.relatedtickets.xml --post-data="auth_user=%USER%&auth_pwd=%PWD%&operation=login" "%WEBROOT%/pages/export.php?expression=SELECT lnkRelatedTicket&format=xml" -wget --output-document=13.infratickets.xml --post-data="auth_user=%USER%&auth_pwd=%PWD%&operation=login" "%WEBROOT%/pages/export.php?expression=SELECT lnkInfraTicket&format=xml" -wget --output-document=14.contacttickets.xml --post-data="auth_user=%USER%&auth_pwd=%PWD%&operation=login" "%WEBROOT%/pages/export.php?expression=SELECT lnkContactTicket&format=xml" -wget --output-document=15.changetickets.xml --post-data="auth_user=%USER%&auth_pwd=%PWD%&operation=login" "%WEBROOT%/pages/export.php?expression=SELECT bizChangeTicket&format=xml" -wget --output-document=16.infrachangetickets.xml --post-data="auth_user=%USER%&auth_pwd=%PWD%&operation=login" "%WEBROOT%/pages/export.php?expression=SELECT lnkInfraChangeTicket&format=xml" -wget --output-document=17.contactchangetickets.xml --post-data="auth_user=%USER%&auth_pwd=%PWD%&operation=login" "%WEBROOT%/pages/export.php?expression=SELECT lnkContactChange&format=xml" -wget --output-document=18.contracts.xml --post-data="auth_user=%USER%&auth_pwd=%PWD%&operation=login" "%WEBROOT%/pages/export.php?expression=SELECT bizContract&format=xml" -wget --output-document=19.infracontracts.xml --post-data="auth_user=%USER%&auth_pwd=%PWD%&operation=login" "%WEBROOT%/pages/export.php?expression=SELECT lnkInfraContract&format=xml" -wget --output-document=20.contactcontracts.xml --post-data="auth_user=%USER%&auth_pwd=%PWD%&operation=login" "%WEBROOT%/pages/export.php?expression=SELECT lnkContactContract&format=xml" -wget --output-document=21.auditcategories.xml --post-data="auth_user=%USER%&auth_pwd=%PWD%&operation=login" "%WEBROOT%/pages/export.php?expression=SELECT AuditCategory&format=xml" -wget --output-document=22.auditrules.xml --post-data="auth_user=%USER%&auth_pwd=%PWD%&operation=login" "%WEBROOT%/pages/export.php?expression=SELECT AuditRule&format=xml" +wget --output-document=01.organizations.xml --post-data="auth_user=%USER%&auth_pwd=%PWD%&operation=login" "%EXPORT%?expression=SELECT bizOrganization&format=xml" +wget --output-document=02.locations.xml --post-data="auth_user=%USER%&auth_pwd=%PWD%&operation=login" "%EXPORT%?expression=SELECT bizLocation&format=xml" +wget --output-document=03.persons.xml --post-data="auth_user=%USER%&auth_pwd=%PWD%&operation=login" "%EXPORT%?expression=SELECT bizPerson&format=xml" +wget --output-document=04.teams.xml --post-data="auth_user=%USER%&auth_pwd=%PWD%&operation=login" "%EXPORT%?expression=SELECT bizTeam&format=xml" +wget --output-document=05.pcs.xml --post-data="auth_user=%USER%&auth_pwd=%PWD%&operation=login" "%EXPORT%?expression=SELECT bizPC&format=xml" +wget --output-document=06.servers.xml --post-data="auth_user=%USER%&auth_pwd=%PWD%&operation=login" "%EXPORT%?expression=SELECT bizServer&format=xml" +wget --output-document=07.applications.xml --post-data="auth_user=%USER%&auth_pwd=%PWD%&operation=login" "%EXPORT%?expression=SELECT bizApplication&format=xml" +wget --output-document=08.nw-devices.xml --post-data="auth_user=%USER%&auth_pwd=%PWD%&operation=login" "%EXPORT%?expression=SELECT bizNetworkDevice&format=xml" +wget --output-document=09.links_contacts.xml --post-data="auth_user=%USER%&auth_pwd=%PWD%&operation=login" "%EXPORT%?expression=SELECT lnkContactRealObject&format=xml" +wget --output-document=10.workgroups.xml --post-data="auth_user=%USER%&auth_pwd=%PWD%&operation=login" "%EXPORT%?expression=SELECT bizWorkgroup&format=xml" +wget --output-document=11.incidents.xml --post-data="auth_user=%USER%&auth_pwd=%PWD%&operation=login" "%EXPORT%?expression=SELECT bizIncidentTicket&format=xml" +wget --output-document=12.relatedtickets.xml --post-data="auth_user=%USER%&auth_pwd=%PWD%&operation=login" "%EXPORT%?expression=SELECT lnkRelatedTicket&format=xml" +wget --output-document=13.infratickets.xml --post-data="auth_user=%USER%&auth_pwd=%PWD%&operation=login" "%EXPORT%?expression=SELECT lnkInfraTicket&format=xml" +wget --output-document=14.contacttickets.xml --post-data="auth_user=%USER%&auth_pwd=%PWD%&operation=login" "%EXPORT%?expression=SELECT lnkContactTicket&format=xml" +wget --output-document=15.changetickets.xml --post-data="auth_user=%USER%&auth_pwd=%PWD%&operation=login" "%EXPORT%?expression=SELECT bizChangeTicket&format=xml" +wget --output-document=16.infrachangetickets.xml --post-data="auth_user=%USER%&auth_pwd=%PWD%&operation=login" "%EXPORT%?expression=SELECT lnkInfraChangeTicket&format=xml" +wget --output-document=17.contactchangetickets.xml --post-data="auth_user=%USER%&auth_pwd=%PWD%&operation=login" "%EXPORT%?expression=SELECT lnkContactChange&format=xml" +wget --output-document=18.contracts.xml --post-data="auth_user=%USER%&auth_pwd=%PWD%&operation=login" "%EXPORT%?expression=SELECT bizContract&format=xml" +wget --output-document=19.infracontracts.xml --post-data="auth_user=%USER%&auth_pwd=%PWD%&operation=login" "%EXPORT%?expression=SELECT lnkInfraContract&format=xml" +wget --output-document=20.contactcontracts.xml --post-data="auth_user=%USER%&auth_pwd=%PWD%&operation=login" "%EXPORT%?expression=SELECT lnkContactContract&format=xml" +wget --output-document=21.auditcategories.xml --post-data="auth_user=%USER%&auth_pwd=%PWD%&operation=login" "%EXPORT%?expression=SELECT AuditCategory&format=xml" +wget --output-document=22.auditrules.xml --post-data="auth_user=%USER%&auth_pwd=%PWD%&operation=login" "%EXPORT%?expression=SELECT AuditRule&format=xml" +wget --output-document=23.dimensions.xml --post-data="auth_user=%USER%&auth_pwd=%PWD%&operation=login" "%EXPORT%?expression=SELECT URP_Dimensions&format=xml" +wget --output-document=24.profiles.xml --post-data="auth_user=%USER%&auth_pwd=%PWD%&operation=login" "%EXPORT%?expression=SELECT URP_Profiles&format=xml" +wget --output-document=25.classprojection.xml --post-data="auth_user=%USER%&auth_pwd=%PWD%&operation=login" "%EXPORT%?expression=SELECT URP_ClassProjection&format=xml" +wget --output-document=26.profileprojection.xml --post-data="auth_user=%USER%&auth_pwd=%PWD%&operation=login" "%EXPORT%?expression=SELECT URP_ProfileProjection&format=xml" +wget --output-document=27.actiongrant.xml --post-data="auth_user=%USER%&auth_pwd=%PWD%&operation=login" "%EXPORT%?expression=SELECT URP_ActionGrant&format=xml" +wget --output-document=28.attributegrant.xml --post-data="auth_user=%USER%&auth_pwd=%PWD%&operation=login" "%EXPORT%?expression=SELECT URP_AttributeGrant&format=xml" +wget --output-document=29.stimulusgrant.xml --post-data="auth_user=%USER%&auth_pwd=%PWD%&operation=login" "%EXPORT%?expression=SELECT URP_StimulusGrant&format=xml" +pause