In order to link to external inventory applications, esup-helpdesk uses URL generators. The URL generated are automatically added to the web interface and allow the managers to navigate from the helpdesk application to the inventory application.
URL generators are defined in the configuration file /properties/domain/computerUrl.xml. Three generators are available in the distribution:
- null : no URL
- glpi : URLs to the GLPI application
- glpiThroughCas : URLs to the GLPI application via a CAS authentication
Default URL generator
The URL generator is set for each department. The generator used for new departments is set by this porperty (set in properties/config.properties):
#defaultComputerUrlBuilderName=null
For each department, this property can be changed at any time through the web interface.
Links to the GLPI application
When one of the generators glpi or glpiThroughCas is used, they rely on this property to build the URLs:
#computerUrl.glpiPattern=http://glpi.domain.edu/front/computer.php?contains[0]=%s&field[0]=1&sort=1&deleted=N&start=0
%s is automatically replaced by the name of the machine.
The URL of the CAS server, used when the property defaultComputerUrlBuilderName is set to glpiThroughCas:
#computerUrl.casServiceUrl=https://cas.domain.edu?service=%s
Links to another application
The steps to add a new URL generator are:
- write a class that implements the interface org.esupportail.helpdesk.domain.computerUrl.ComputerUrlBuilder, for instance by inheriting of an existing class
- declarer a bean of this class in the configuration file /properties/domain/computerUrl.xml and add a reference to this bean in the attribute map of the bean computerUrlBuilderStore
- allow the automatic recovering of the new class and the configuration file /properties/domain/computerUrl.xml when upgrading (see Recovering previous configuration and customizations when upgrading).
Using several instances of GLPI
Let us assume here that a department named ENSSAT wants to use a new URL generator that will lead managers to their own GLPI instance.
Add two beans in /properties/domain/computerUrl.xml:
<bean id="computerUrlBuilderStore" class="org.esupportail.helpdesk.domain.computerUrl.ComputerUrlBuilderStoreImpl" lazy-init="true" > <description>A store for the computer URL builders.</description> <property name="map" > <map> <entry key="null" value-ref="nullComputerUrlBuilder" /> <entry key="glpi" value-ref="glpiComputerUrlBuilder" /> <entry key="glpiThroughCas" value-ref="glpiThroughCasComputerUrlBuilder" /> <entry key="enssatGlpi" value-ref="enssatGlpiComputerUrlBuilder" /> <entry key="enssatGlpiThroughCas" value-ref="enssatGlpiThroughCasComputerUrlBuilder" /> </map> </property> </bean> ... <bean id="enssatGlpiComputerUrlBuilder" parent="abstractComputerUrlBuilder" class="org.esupportail.helpdesk.domain.computerUrl.PatternBasedComputerUrlBuilderImpl" lazy-init="true" > <property name="pattern" value="${computerUrl.enssatGlpiPattern}" /> <property name="i18nDescriptionKey" value="DOMAIN.COMPUTER_URL_BUILDER.ENSSAT_GLPI" /> </bean> <bean id="enssatGlpiThroughCasComputerUrlBuilder" parent="abstractComputerUrlBuilder" class="org.esupportail.helpdesk.domain.computerUrl.CasPatternBasedComputerUrlBuilderImpl" lazy-init="true" > <property name="pattern" value="${computerUrl.enssatGlpiPattern}" /> <property name="casServiceUrl" value="${computerUrl.casServiceUrl}" /> <property name="i18nDescriptionKey" value="DOMAIN.COMPUTER_URL_BUILDER.ENSSAT_GLPI_THROUGH_CAS" /> </bean>
Declare the property computerUrl.enssatGlpiPattern in /properties/config.properties:
computerUrl.enssatGlpiPattern=http://glpi.enssat.univ-rennes1.fr/front/computer.php?contains[0]=%s&field[0]=1&sort=1&deleted=N&start=0
Add the i18n keys to the bundles.
/properties/i18n/bundles/Custom_fr.properties:
DOMAIN.COMPUTER_URL_BUILDER.ENSSAT_GLPI = GLPI (ENSSAT) DOMAIN.COMPUTER_URL_BUILDER.ENSSAT_GLPI_THROUGH_CAS = GLPI via CAS (ENSSAT)
/properties/i18n/bundles/Custom_en.properties:
DOMAIN.COMPUTER_URL_BUILDER.ENSSAT_GLPI = GLPI (ENSSAT) DOMAIN.COMPUTER_URL_BUILDER.ENSSAT_GLPI_THROUGH_CAS = GLPI through CAS (ENSSAT)
Tell esup-helpdesk to automatically recover your modified configuration file at the next upgrade in /build.properties:
custom.recover.files= \ ... \ /properties/domain/computerUrl.xml