Class SyncLdapHandler

All Implemented Interfaces:
JcmsConstants, JaliosConstants

public class SyncLdapHandler extends JcmsFormHandler
This form handler performs LDAP synchronization.
  • Field Details

    • logger

      public static final org.apache.log4j.Logger logger
    • op

      protected boolean op
    • opSyncOne

      protected boolean opSyncOne
    • opSyncGroup

      protected boolean opSyncGroup
    • opSyncLdapGroup

      protected boolean opSyncLdapGroup
    • opSyncAll

      protected boolean opSyncAll
    • opImportAll

      protected boolean opImportAll
    • LDAP_IMPORT_ALL_DONE

      public static final String LDAP_IMPORT_ALL_DONE
      See Also:
    • LDAP_GROUP_SYNC_DONE

      public static final String LDAP_GROUP_SYNC_DONE
      See Also:
    • SYNC_PROGRESS_GROUP_CREATED

      public static final int SYNC_PROGRESS_GROUP_CREATED
      See Also:
    • SYNC_PROGRESS_GROUP_UPDATED

      public static final int SYNC_PROGRESS_GROUP_UPDATED
      See Also:
    • SYNC_PROGRESS_GROUP_TREATED

      public static final int SYNC_PROGRESS_GROUP_TREATED
      See Also:
    • SYNC_PROGRESS_MEMBER_CREATED

      public static final int SYNC_PROGRESS_MEMBER_CREATED
      See Also:
    • SYNC_PROGRESS_MEMBER_UPDATED

      public static final int SYNC_PROGRESS_MEMBER_UPDATED
      See Also:
    • SYNC_PROGRESS_MEMBER_TREATED

      public static final int SYNC_PROGRESS_MEMBER_TREATED
      See Also:
  • Constructor Details

    • SyncLdapHandler

      public SyncLdapHandler()
  • Method Details

    • processAction

      public boolean processAction() throws IOException
      Description copied from class: JcmsFormHandler
      Method to be implemented to check/validate action to be performed and process them.

      Default implementation is to return false. No need to call super method.

      This method may NOT be invoked at all if security validation are not met.

      You must ensure your handler and JSP can work properly without any code invoked in this method.

      Overrides:
      processAction in class JcmsFormHandler
      Returns:
      false if no redirection is needed, true otherwise
      Throws:
      IOException - IO Exception
    • validateSyncOne

      public boolean validateSyncOne() throws IOException
      Throws:
      IOException
    • performSyncOne

      public void performSyncOne()
      Synchronize current member with LDAP.
    • validateSyncGroup

      public boolean validateSyncGroup() throws IOException
      Throws:
      IOException
    • performSyncGroup

      public void performSyncGroup()
      Synchronize members of current group with LDAP.
    • validateSyncLdapGroup

      public boolean validateSyncLdapGroup() throws IOException
      Returns:
      true the syncldapgroup operation can be performed
      Throws:
      IOException - if sendRedirect/sendForbidden failed
      Since:
      jcms-5.7.0
    • performSyncLdapGroup

      public void performSyncLdapGroup()
      Synchronize the LDAP group and retrieve all its member from LDAP.
      Since:
      jcms-5.7.0
    • validateSyncAll

      public boolean validateSyncAll() throws IOException
      Throws:
      IOException
    • performSyncAll

      public void performSyncAll()
      Synchronize all members with LDAP.
    • validateImportAll

      public boolean validateImportAll() throws IOException
      Throws:
      IOException
    • performImportAll

      public void performImportAll()
      Import all LDAP members and their group in JCMS.
    • synchronizeMembers

      public static void synchronizeMembers(Set<Member> memberSet, JcmsJspContext ctxt)
      Synchronize all LDAP account in the specified Set of Member.
      Parameters:
      memberSet - the set of Member to synchronize (only LDAP account will be synchronized)
      ctxt - the current JcmsJspContext (used to retrieve logged member as opAuthor, request & session for error message)
    • synchronizeMembers

      public static void synchronizeMembers(Iterator<Member> mbrIterator, JcmsJspContext ctxt)
      Synchronize all LDAP account return by the specified Iterator of Member.
      Parameters:
      mbrIterator - an iterator of Member to synchronize (only LDAP account will be synchronized)
      ctxt - the current JcmsJspContext (used to retrieve logged member as opAuthor, request & session for error message)
      Since:
      jcms-10.0.1 / JCMS-6340
    • synchronizeMembers

      public static void synchronizeMembers(Iterator<? extends Member> mbrIterator, Member opAuthor, Consumer<LDAPMapper> onLdapError, Consumer<Member> onMemberSkipped, Consumer<Member> onMemberSynced)
      Synchronize all LDAP account return by the specified Iterator of Member.
      Parameters:
      mbrIterator - an iterator of Member to synchronize (only LDAP account will be synchronized)
      opAuthor - the Member to use as opAuthor of synchronization operation
      onLdapError - function invoked when LDAP connexion could not be established
      onMemberSkipped - function invoked when member was skipped (not ldap, not account, ldap not connected, ...)
      onMemberSynced - function invoked when member synchronization was invoked (with or without any change being made)
      Since:
      jcms-10.0.8
    • clearLdapGroupBeingSync

      public static void clearLdapGroupBeingSync(javax.servlet.http.HttpSession session)
    • getLdapGroupBeingSync

      public static Group getLdapGroupBeingSync(javax.servlet.http.HttpSession session)
      If LDAP synchronization was request on a LDAP group, return the LDAP Group being synchronized. otherwise return null.
      Parameters:
      session - the current HttpSession
      Returns:
      the group being synchronized
    • updateLdapGroupSyncProgressInformation

      public static void updateLdapGroupSyncProgressInformation(int action, Data data)
      This methods adds information regarding the current LDAP synchronization progress to the session. It allows us to retrieve this information using getLdapGroupSyncProgressInformation().
      This method MUST be call from the thread launched by SyncLdapHandler. If called from another thread, this method as no effect.
      Parameters:
      action - the value to updated, choosen from :
      data - the Data being processed (needed to make sure a data is not being treated twice)
    • getLdapGroupSyncProgressInformation

      public static String getLdapGroupSyncProgressInformation()
      Retrieve progress information of ldap group synchronization.
      Returns:
      a String containing information about current operation progress or null if operation is over This method MUST be call from a thread with access to Channel.getCurrentServletRequest().
    • setOpSyncOne

      public void setOpSyncOne(String v)
    • setOpSyncGroup

      public void setOpSyncGroup(String v)
    • setOpSyncLdapGroup

      public void setOpSyncLdapGroup(String v)
    • setOpSyncAll

      public void setOpSyncAll(String v)
    • setOpImportAll

      public void setOpImportAll(String v)
    • setId

      public void setId(String id)
    • setGid

      public void setGid(String gid)
    • setLdapGid

      public void setLdapGid(String gid)