Uploaded image for project: 'PUBLIC - Liferay Portal Community Edition'
  1. PUBLIC - Liferay Portal Community Edition
  2. LPS-98420

LDAP import Interval setting does not take effect

Details

    Description

      Please note, this is NOT a security vulnerability, so the ticket does not need to be secured.

       

      Description:

      When setting the Import Interval for LDAP, the value is not used.  This is due to a miss-match between the scheduler trigger and the user set interval.

      Currently in master, when activating the UserImportMessageListener class (which imports LDAP users on the given interval), the default interval of 10 is always used in the scheduler.  This is because regardless of the user-set value, the company with ID "0" is used for the configuration, resulting in the default value being used.

      Once this happens, changing the interval is only useful in intervals of 10, because the scheduler has already been set (and will not change) to 10, resulting in the message being received every 10 minutes.  So, and interval of 1 minute will only be called every 10 minutes, and one of 11 minutes will only be called every 20 minutes.  This is because we actually check the last import time against the current time and offset the interval.

      Steps to reproduce:

      1. Change the LDAP import interval to 2 in System Settings -> Authentication -> LDAP -> Import Interval.
      2. Check if the scheduler is triggered after 2 minutes.

      Expected behavior: The scheduler is triggered after 2 minutes. 
      Actual behavior: The scheduler is not triggered after 2 minutes. It gets triggered after 10 minutes which is the starting default value.  Only a server restart or bundle refresh will trigger the new value.

      Reproduced on Master and Branch:
      Master: 91deae5de5d141fa15ded1e864173ada43fd5985
      7.1.x: 47a65b4c47616f1bdb59ded9255c6e59f9bc9839

       

      Script to help reproduce the issue:

      import com.liferay.portal.kernel.scheduler.messaging.SchedulerResponse;
      import com.liferay.portal.kernel.scheduler.SchedulerEngineHelperUtil;
      import com.liferay.portal.kernel.scheduler.StorageType;
      import com.liferay.portal.kernel.messaging.Message;
      import com.liferay.portal.util.PrefsPropsUtil;
      import java.util.List;
      import com.liferay.portal.kernel.scheduler.Trigger;
      
      try {
      boolean enable = PrefsPropsUtil.getBoolean("scheduler.enabled");
      out.println("scheduler.enabled:" + enable);
      
      
      String groupName = "com.liferay.portal.security.ldap.internal.messaging.UserImportMessageListener";
      
          List<SchedulerResponse> schedulerResponses = SchedulerEngineHelperUtil.getScheduledJobs(groupName, StorageType.MEMORY_CLUSTERED);
      
          if (schedulerResponses.isEmpty()) {
           out.println("there is not scheduler executed for this listener");
          }
      
          for (SchedulerResponse schedulerResponse : schedulerResponses) {
           Trigger trigger = schedulerResponse.getTrigger();
           Message message = schedulerResponse.getMessage();
           out.println(message.toString());
       
          }
      }
      catch (Exception e) {
          throw e;
      }

       

       

      Attachments

        Issue Links

          Activity

            People

              joshua.itagaki Joshua Itagaki
              christopher.kian Christopher Kian
              Gábor Lovas Gábor Lovas
              Christopher Kian Christopher Kian
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                3 years, 44 weeks, 5 days ago

                Packages

                  Version Package
                  7.1.10 DXP FP13
                  7.1.X
                  7.2.10 DXP FP1
                  7.2.1 CE GA2
                  7.2.X
                  7.3.10 DXP GA1
                  Master