Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

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.

Code Block
languagejava
linenumberstrue
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 != null && dm instanceof SyncLdapUserDirectoryManagerImpl) {
        int total = ((SyncLdapUserDirectoryManagerImpl) dm).syncUsers();
        System.out.println("Total users : " + total);
    }
}

...