The Sync LDAP User Directory Manager allows one to import user objects from LDAP server on demand into Joget Workflow's built-in user directory manager to reduce its dependency on the LDAP server for improved performance. In this article,  we will learn on how to automatically synchronize LDAP based on a schedule, eliminating the need to perform such action manually.

Sync LDAP User Directory Manager อนุญาตให้หนึ่งนำเข้าวัตถุผู้ใช้จากเซิร์ฟเวอร์ LDAP ตามความต้องการไปยังตัวจัดการไดเรกทอรีผู้ใช้ในตัวของ Joget Workflow เพื่อลดการพึ่งพาบนเซิร์ฟเวอร์ LDAP เพื่อประสิทธิภาพที่ดียิ่งขึ้น ในบทความนี้เราจะเรียนรู้วิธีการซิงโครไนซ์ LDAP โดยอัตโนมัติตามกำหนดเวลาทำให้ไม่จำเป็นต้องดำเนินการดังกล่าวด้วยตนเอง

同步LDAP用户目录管理器允许按需将用户对象从LDAP服务器导入到Joget Workflow的内置用户目录管理器中,以减少其对LDAP服务器的依赖性,从而提高性能。在本文中,我们将学习如何根据时间表自动同步LDAP,从而无需手动执行此类操作。


This guide requires the scheduler plugin in Joget Marketplace to perform functions based on a schedule. One of the features of the scheduler plugin is that it allows bean shell script to be executed at defined durations, in a form of CRON expressions.

คู่มือนี้ต้องการปลั๊กอินตัวกำหนดตารางเวลาใน Joget Marketplace เพื่อทำหน้าที่ตามตารางเวลา หนึ่งในคุณสมบัติของปลั๊กอินตัวกำหนดตารางเวลาก็คือมันช่วยให้สามารถดำเนินการสคริปต์เปลือกถั่วตามระยะเวลาที่กำหนดในรูปแบบของ CRON expressions

本指南要求Joget Marketplace中的Scheduler插件根据时间表执行功能。 Scheduler插件的功能之一是它允许以CRON表达式的形式在定义的持续时间执行Bean Shell脚本。


First, download and import the plugin appended below, into your Joget installation.

ก่อนอื่นให้ดาวน์โหลดและนำเข้าปลั๊กอินต่อท้ายลงในการติดตั้ง Joget ของคุณ

首先,下载并把下面所附的插件导入到Joget安装中。


Scheduler v6 plugin

After importing the plugin, add the scheduler userview element into your userview. Then, define the schedule frequency using CRON expression. Then select the bean shell option in "Plugin" and click on the "Configure Plugin" button, copy and paste the following bean shell code below. The code below is intended and must be used for Sync LDAP User Directory Manager (can be used along with Security Enhanced Directory Manager).

หลังจากนำเข้าปลั๊กอินให้เพิ่มองค์ประกอบ userview ตัวกำหนดตารางเวลาลงใน userview ของคุณ จากนั้นกำหนดความถี่ของกำหนดการโดยใช้นิพจน์ CRON จากนั้นเลือกตัวเลือกเปลือกถั่วใน "ปลั๊กอิน" และคลิกที่ปุ่ม "กำหนดค่าปลั๊กอิน" คัดลอกและวางรหัสเปลือกถั่วต่อไปนี้ด้านล่าง รหัสด้านล่างมีจุดประสงค์และต้องใช้สำหรับ  Sync LDAP User Directory Manager (สามารถใช้ร่วมกับ Security Enhanced Directory Manager)

导入插件后,将scheduler程序userview元素添加到您的userview中。然后,使用CRON表达式定义调度频率。然后在``插件''中选择bean shell选项,然后单击``配置插件''按钮,将以下bean shell代码复制并粘贴到下面。以下代码是预期的,必须用于同步LDAP用户目录管理器(可与Security Enhanced Directory Manager一起使用)。


Save the record.

บันทึก record

保存记录。

import org.joget.directory.model.service.DirectoryManagerProxyImpl;
import org.joget.directory.model.service.DirectoryManager;
import org.joget.apps.app.service.AppUtil;
import org.joget.plugin.ldap.SyncLdapUserDirectoryManagerImpl;
import org.joget.plugin.directory.SecureDirectoryManagerImpl;

DirectoryManagerProxyImpl proxy = (DirectoryManagerProxyImpl) AppUtil.getApplicationContext().getBean("directoryManager");
DirectoryManager dm = proxy.getDirectoryManagerImpl();
if (dm != null) {
    if (dm instanceof SecureDirectoryManagerImpl) {
        dm = ((SecureDirectoryManagerImpl) dm).getEdm(1);
    }
    if (dm instanceof SyncLdapUserDirectoryManagerImpl) {
        int total = ((SyncLdapUserDirectoryManagerImpl) dm).syncUsers();
        System.out.println("Total users : " + total);
    }
}