You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Current »

This guide requires the scheduler plugin in Joget Marketplace to perform functions based on 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.

 

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

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).

Save the 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);
    }
}

 

 

 

  • No labels