Procedure to Map LDAP Department Attribute using LdapImport.groovy in Gespage

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\examples

  • Move 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:

    Groovy
    def 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):

    Groovy
    def 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.

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article