Come join us on November 27-29, 2018 at the Gartner Application Strategies & Solutions Summit 2018 in Las Vegas, USA.

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

...