Step 1: Prepare and Move the Groovy Script (Prerequisite)
For the import script to be executed, it must be moved from the examples folder to the active scripts directory:
Locate the LdapImport.groovy file in the examples folder:
...\GespageCore\server\resources\scripts\examplesMove the LdapImport.groovy file one level up, into the active directory:
...\GespageCore\server\resources\scripts
Step 2: Configuration in Gespage Administration
You need to configure Gespage to use the custom script and the "Service name" field for departments.
Access the Gespage Administration page.
Navigate to the User Import Settings (LDAP Synchronization).
Activate the import method via Groovy Script.
In the Department Initialization section:
Select the option: "Service name".
Step 3: Modify the Groovy Script (LdapImport.groovy)
This step involves modifying the script to point to the desired LDAP attribute.
Open the LdapImport.groovy file in its new location (
...\scripts).Locate the variable declaration line at the beginning of the script:
Groovydef dep_from_field = "department"; /* Standard field (for AD) used to initialize the department name */Modify the value
"department"by replacing it with the exact name of the LDAP attribute that contains the department information in your directory (e.g.,physicalDeliveryOfficeName,extensionAttribute1, etc.).Example modification (if the LDAP attribute is
physicalDeliveryOfficeName):Groovydef dep_from_field = "physicalDeliveryOfficeName";Save the LdapImport.groovy file.
Step 4: Application and Verification
Restart the Gespage service (if necessary).
In the Gespage Administration, trigger a manual LDAP synchronization.