Example #1
0
function plugin_init_webservices()
{
    global $PLUGIN_HOOKS, $CFG_GLPI, $WEBSERVICE_LINKED_OBJECTS;
    Plugin::registerClass('PluginWebservicesClient');
    $PLUGIN_HOOKS['csrf_compliant']['webservices'] = true;
    if (Session::haveright("config", UPDATE)) {
        $PLUGIN_HOOKS["menu_toadd"]['webservices'] = array('config' => 'PluginWebservicesClient');
    }
    $PLUGIN_HOOKS['webservices']['webservices'] = 'plugin_webservices_registerMethods';
    //Store objects that can be retrieved when querying another object
    $WEBSERVICE_LINKED_OBJECTS = array('with_infocom' => array('help' => 'bool, optional', 'itemtype' => 'Infocom', 'allowed_types' => $CFG_GLPI['infocom_types'], 'class' => 'PluginWebservicesMethodInventaire'), 'with_networkport' => array('help' => 'bool, optional', 'itemtype' => 'NetworkPort', 'allowed_types' => plugin_webservices_getNetworkPortItemtypes(), 'class' => 'PluginWebservicesMethodInventaire'), 'with_phone' => array('help' => 'bool, optional (Computer only)', 'itemtype' => 'Phone', 'allowed_types' => array('Computer'), 'class' => 'PluginWebservicesMethodInventaire'), 'with_printer' => array('help' => 'bool', 'optional (Computer only)', 'itemtype' => 'Printer', 'allowed_types' => array('Computer'), 'class' => 'PluginWebservicesMethodInventaire'), 'with_monitor' => array('help' => 'bool', 'optional (Computer only)', 'itemtype' => 'Monitor', 'allowed_types' => array('Computer'), 'class' => 'PluginWebservicesMethodInventaire'), 'with_peripheral' => array('help' => 'bool', 'optional (Computer only)', 'itemtype' => 'Peripheral', 'allowed_types' => array('Computer'), 'class' => 'PluginWebservicesMethodInventaire'), 'with_document' => array('help' => 'bool', 'optional', 'itemtype' => 'Document', 'allowed_types' => plugin_webservices_getDocumentItemtypes(), 'class' => 'PluginWebservicesMethodInventaire'), 'with_ticket' => array('help' => 'bool', 'optional', 'itemtype' => 'Ticket', 'allowed_types' => plugin_webservices_getTicketItemtypes(), 'class' => 'PluginWebservicesMethodHelpdesk'), 'with_tickettask' => array('help' => 'bool', 'optional (Ticket only)', 'itemtype' => 'TicketTask', 'allowed_types' => array('Ticket'), 'class' => 'PluginWebservicesMethodHelpdesk'), 'with_ticketfollowup' => array('help' => 'bool', 'optional (Ticket only)', 'itemtype' => 'TicketFollowup', 'allowed_types' => array('Ticket'), 'class' => 'PluginWebservicesMethodHelpdesk'), 'with_ticketvalidation' => array('help' => 'bool', 'optional (Ticket only)', 'itemtype' => 'TicketValidation', 'allowed_types' => array('Ticket'), 'class' => 'PluginWebservicesMethodHelpdesk'), 'with_reservation' => array('help' => 'bool', 'itemtype' => 'Reservation', 'allowed_types' => $CFG_GLPI['reservation_types'], 'class' => 'PluginWebservicesMethodInventaire'), 'with_software' => array('help' => 'bool', 'itemtype' => 'Software', 'allowed_types' => array('Computer'), 'class' => 'PluginWebservicesMethodInventaire'), 'with_softwareversion' => array('help' => 'bool', 'itemtype' => 'SoftwareVersion', 'allowed_types' => array('Software'), 'class' => 'PluginWebservicesMethodInventaire'), 'with_softwarelicense' => array('help' => 'bool', 'itemtype' => 'SoftwareLicense', 'allowed_types' => array('Software'), 'class' => 'PluginWebservicesMethodInventaire'), 'with_contract' => array('help' => 'bool', 'itemtype' => 'Contract', 'allowed_types' => $CFG_GLPI['contract_types'], 'class' => 'PluginWebservicesMethodInventaire'));
}