Details
-
Bug
-
Status: Closed
-
Resolution: Fixed
-
7.0.X, 7.1.X, 7.2.X, Master
-
7.2.x, 7.1.x
-
Committed
-
3
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:
- Change the LDAP import interval to 2 in System Settings -> Authentication -> LDAP -> Import Interval.
- 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
- demands
-
LRDOCS-7184 (DevOps?) Instance-level LDAP Import Interval depends on minimum value defined in System Settings
-
- Open
-
- is related to
-
LPS-175209 Simplify logic in UserImportConfigurationModelListener
-
- Closed
-