Class CommonDBConnexity
Common DataBase Connexity Table Manager Class This class factorize code for CommonDBChild and CommonDBRelation. Both classes themselves factorize and normalize the behaviour of all Child and Relations. As such, several elements are directly managed by these two classes since 0.84 : - Check: all can* methods (canCreate, canUpdate, canViewItem, canDeleteItem ...) are defined. - Update: when we try to update an attached element, we check if we change its parent item(s). If we change its parent(s), then we check if we can delete the item with previous parent(s) (cf. "check" before) AND we can create the item with the new parent(s). - Entity: Entity is automatically setted or updated when setting or changing an attached item. Thus, you don't have any more to worry about entities. (May be disable using $disableAutoEntityForwarding) - Log: when we create, update or delete an item, we update its parent(s)'s histories to notify them of the creation, update or deletion - Flying items : some items can be on the stock. For instance, before beeing plugged inside a computer, an Item_DeviceProcessor can be without any parent. It is now possible to define such items and transfer them from parent to parent.
The aim of the new check is that the rights on a Child or a Relation are driven by the parent(s): you can create, delete or update the item if and only if you can update its parent(s); you can view the item if and only if you can view its parent(s). Beware that it differs from the default behaviour of CommonDBTM: if you don't define canUpdate or canDelete, then it checks canCreate and by default canCreate returns false (thus, if you don't do anything, you don't have any right). A side effect is that if you define specific rights (see NetworkName::canCreate()) for your classes you must define all rights (canCreate, canView, canUpdate and canDelete).
- CommonGLPI
-
CommonDBTM
-
CommonDBConnexity
Indirect known subclasses
Calendar_Holiday, CalendarSegment, Change_User, NotificationTargetCrontask, NotificationTargetDBConnection, NotificationTargetFieldUnicity, NotificationTargetInfocom, NotificationTargetMailCollector, NotificationTargetObjectLock, NotificationTargetPlanningRecall, NotificationTargetProblem, NotificationTargetProject, NotificationTargetProjectTask, ChangeCost, NotificationTargetReservation, NotificationTargetSavedsearch_Alert, NotificationTargetSoftwareLicense, NotificationTargetTicket, NotificationTargetUser, NotificationTemplateTranslation, OLA, OlaLevelAction, OlaLevelCriteria, Pdu_Plug, ChangeValidation, PDU_Rack, PlanningRecall, Problem_Supplier, Problem_Ticket, Problem_User, ProblemCost, Profile_Reminder, Profile_RSSFeed, Profile_User, ProfileRight, CommonITILActor, ProjectCost, ProjectTask, ProjectTask_Ticket, ProjectTaskTeam, ProjectTeam, RegisteredID, Reminder_User, Reservation, ReservationItem, RSSFeed_User, CommonITILCost, RuleAction, RuleCriteria, SavedSearch_Alert, SavedSearch_User, SLA, SlaLevelAction, SlaLevelCriteria, SoftwareVersion, Supplier_Ticket, Ticket_Ticket, CommonITILValidation, Ticket_User, TicketCost, TicketFollowup, TicketTemplateHiddenField, TicketTemplateMandatoryField, TicketTemplatePredefinedField, TicketValidation, UserEmail, Computer_Item, Computer_SoftwareLicense, Computer_SoftwareVersion, ComputerAntivirus, Cartridge, ComputerVirtualMachine, Consumable, Contact_Supplier, Contract_Item, Contract_Supplier, ContractCost, Document_Item, DropdownTranslation, Entity_KnowbaseItem, Entity_Reminder, CartridgeItem_PrinterModel, Entity_RSSFeed, FQDNLabel, Group_KnowbaseItem, Group_Problem, Group_Reminder, Group_RSSFeed, Group_Ticket, Group_User, Infocom, IPAddress, Certificate_Item, IPAddress_IPNetwork, IPNetmask, IPNetwork_Vlan, Item_DeviceBattery, Item_DeviceCase, Item_DeviceControl, Item_DeviceDrive, Item_DeviceFirmware, Item_DeviceGeneric, Item_DeviceGraphicCard, Change_Group, Item_DeviceHardDrive, Item_DeviceMemory, Item_DeviceMotherboard, Item_DeviceNetworkCard, Item_DevicePci, Item_DevicePowerSupply, Item_DeviceProcessor, Item_Devices, Item_DeviceSensor, Item_DeviceSimcard, Change_Item, Item_DeviceSoundCard, Item_Disk, Item_Enclosure, Item_OperatingSystem, Item_Problem, Item_Project, Item_Rack, Item_Ticket, Itil_Project, ITILFollowup, Change_Problem, ITILSolution, KnowbaseItem_Item, KnowbaseItem_Profile, KnowbaseItem_User, KnowbaseItemTranslation, LevelAgreement, Link_Itemtype, NetworkAlias, NetworkName, NetworkPort, Change_Supplier, NetworkPort_NetworkPort, NetworkPort_Vlan, NetworkPortAggregate, NetworkPortAlias, NetworkPortDialup, NetworkPortEthernet, NetworkPortFiberchannel, NetworkPortInstantiation, NetworkPortLocal, NetworkPortMigration, Change_Ticket, NetworkPortWifi, Notepad, Notification_NotificationTemplate, NotificationTarget, NotificationTargetCartridgeItem, NotificationTargetCertificate, NotificationTargetChange, NotificationTargetCommonITILObject, NotificationTargetConsumableItem, NotificationTargetContractSince: 0.84
Warning:
You have to care of calling CommonDBChild or CommonDBRelation methods if you override their methods (for instance: call parent::prepareInputForAdd($input) if you define prepareInputForAdd). You can find an example with UserEmail::prepareInputForAdd($input).
Located at commondbconnexity.class.php
public static
string
|
#
getSQLRequestToSearchForItem( string $itemtype, integer $items_id )
Return the SQL request to get all the connexities corresponding to $itemtype[$items_id] That is used by cleanDBOnItem : the only interesting field is static::getIndexName() But CommonDBRelation also use it to get more complex result |
public static
array|null
|
#
getSQLCriteriaToSearchForItem( string $itemtype, integer $items_id )
Return the SQL request to get all the connexities corresponding to $itemtype[$items_id] That is used by cleanDBOnItem : the only interesting field is static::getIndexName() But CommonDBRelation also use it to get more complex result |
public
|
#
cleanDBonItemDelete( string $itemtype, integer $items_id )
Clean the Connecity Table when item of the relation is deleted To be call from the cleanDBonPurge of each Item class |
public
|
#
getConnexityItem( string $itemtype, string $items_id, boolean $getFromDB = true, boolean $getEmpty = true, boolean $getFromDBOrEmpty = false )
get associated item (defined by $itemtype and $items_id) |
public static
|
#
getItemFromArray( string $itemtype, string $items_id, array $array, boolean $getFromDB = true, boolean $getEmpty = true, boolean $getFromDBOrEmpty = false )
get associated item (defined by $itemtype and $items_id) |
public
true
|
#
checkAttachedItemChangesAllowed( array $input, array $fields )
Factorization of prepareInputForUpdate for CommonDBRelation and CommonDBChild. Just check if we can change the item |
public
boolean
|
|
public static
boolean
|
#
canConnexity( string $method, integer $item_right, string $itemtype, string $items_id )
Factorization of canCreate, canView, canUpate and canDelete. It checks the ability to create, view, update or delete the item if it is possible (ie : $itemtype != 'itemtype') |
public
true
|
#
canConnexityItem( string $methodItem, string $methodNotItem, integer $item_right, string $itemtype, string $items_id,
Factorization of canCreateItem, canViewItem, canUpateItem and canDeleteItem. It checks the ability to create, view, update or delete the item. If we cannot check the item (none is existing), then we can do the action of the current connexity |
public
array
|
|
public
array
|
#
getItemsForLog( string $itemtype, string $items_id )
Factorized method to search difference when updating a connexity : return both previous item and new item if both are different. Otherwise returns new items |
public static
array
|
#
getConnexityMassiveActionsSpecificities( )
Get all specificities of the current itemtype concerning the massive actions |
public static
|
#
getMassiveActionsForItemtype( array & $actions, string $itemtype, boolean $is_deleted = 0,
|
public static
boolean
|
|
public static
array
|
#
getConnexityInputForProcessingOfMassiveActions( string $action,
|
public static
|
integer |
DONT_CHECK_ITEM_RIGHTS
|
#
1
|
integer |
HAVE_VIEW_RIGHT_ON_ITEM
|
#
2
|
integer |
HAVE_SAME_RIGHT_ON_ITEM
|
#
3
|
public static
boolean
|
$canDeleteOnItemClean
|
#
true
|
public static
boolean
|
$disableAutoEntityForwarding
|
#
false
|
$displaylist,
$othertabs,
$showdebug,
$type
|