pwdExpireWarning for PPolicy notification job
This commit is contained in:
		
							parent
							
								
									4e18e82f0b
								
							
						
					
					
						commit
						c04ee71ddd
					
				| 
						 | 
				
			
			@ -10,6 +10,7 @@ March 2016 5.3
 | 
			
		|||
  - LAM Pro:
 | 
			
		||||
   -> Support for LDAP views based on nsview object class
 | 
			
		||||
   -> Password notification jobs support to print expiration date in email
 | 
			
		||||
   -> PPolicy password notification job takes pwdExpireWarning into account
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
15.12.2015 5.2
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -2006,8 +2006,22 @@ mysql> GRANT ALL PRIVILEGES ON lam_cron.* TO 'lam_cron'@'localhost';
 | 
			
		|||
          second warning at a later time).</para>
 | 
			
		||||
 | 
			
		||||
          <para>LAM calculates the expiration date based on the last password
 | 
			
		||||
          change and the assigned password policy (or the default
 | 
			
		||||
          policy).</para>
 | 
			
		||||
          change and the assigned password policy (or the default policy)
 | 
			
		||||
          using attributes pwdMaxAge and pwdExpireWarning.</para>
 | 
			
		||||
 | 
			
		||||
          <para>Examples:</para>
 | 
			
		||||
 | 
			
		||||
          <para>Warning time (pwdExpireWarning) = 14 days, notification period
 | 
			
		||||
          = 10: LAM will send out the email 24 days before the password
 | 
			
		||||
          expires</para>
 | 
			
		||||
 | 
			
		||||
          <para>Warning time (pwdExpireWarning) = 14 days, notification period
 | 
			
		||||
          = 0: LAM will send out the email 14 days before the password
 | 
			
		||||
          expires</para>
 | 
			
		||||
 | 
			
		||||
          <para>No warning time (pwdExpireWarning), notification period = 10:
 | 
			
		||||
          LAM will send out the email 10 days before the password
 | 
			
		||||
          expires</para>
 | 
			
		||||
 | 
			
		||||
          <screenshot>
 | 
			
		||||
            <mediaobject>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -52,9 +52,9 @@ class PPolicyUserPasswordNotifyJobTest extends PHPUnit_Framework_TestCase {
 | 
			
		|||
		$this->job->method('getConfigPrefix')->willReturn('test');
 | 
			
		||||
		$this->job->method('sendMail')->willReturn(true);
 | 
			
		||||
		$this->job->method('getPolicyOptions')->willReturn(array(
 | 
			
		||||
				PPolicyUserPasswordNotifyJobTest::ONE_YEAR_POLICY => 365 * 3600 * 24,
 | 
			
		||||
				PPolicyUserPasswordNotifyJobTest::DEFAULT_POLICY => 14 * 3600 * 24,
 | 
			
		||||
				PPolicyUserPasswordNotifyJobTest::NOEXPIRE_POLICY => 0,
 | 
			
		||||
				PPolicyUserPasswordNotifyJobTest::ONE_YEAR_POLICY => array('pwdmaxage' => 365 * 3600 * 24),
 | 
			
		||||
				PPolicyUserPasswordNotifyJobTest::DEFAULT_POLICY => array('pwdmaxage' => 14 * 3600 * 24),
 | 
			
		||||
				PPolicyUserPasswordNotifyJobTest::NOEXPIRE_POLICY => array('pwdmaxage' => 0),
 | 
			
		||||
		));
 | 
			
		||||
		$this->options['test_mailNotificationPeriod' . PPolicyUserPasswordNotifyJobTest::JOB_ID][0] = PPolicyUserPasswordNotifyJobTest::WARNING;
 | 
			
		||||
		$this->options['test_mailDefaultPolicy' . PPolicyUserPasswordNotifyJobTest::JOB_ID][0] = PPolicyUserPasswordNotifyJobTest::DEFAULT_POLICY;
 | 
			
		||||
| 
						 | 
				
			
			@ -188,6 +188,32 @@ class PPolicyUserPasswordNotifyJobTest extends PHPUnit_Framework_TestCase {
 | 
			
		|||
		$this->job->execute(PPolicyUserPasswordNotifyJobTest::JOB_ID, $this->options, $pdo, true);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public function testGetWarningTimeInSeconds() {
 | 
			
		||||
		$confDays = 7;
 | 
			
		||||
		$policy = array('pwdmaxage' => 365 * 3600 * 24, 'pwdexpirewarning' => 10000);
 | 
			
		||||
 | 
			
		||||
		$seconds = $this->job->getWarningTimeInSeconds($confDays, $policy);
 | 
			
		||||
 | 
			
		||||
		$this->assertEquals((7*3600*24 + 10000), $seconds);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		$confDays = 0;
 | 
			
		||||
		$policy = array('pwdmaxage' => 365 * 3600 * 24, 'pwdexpirewarning' => 10000);
 | 
			
		||||
 | 
			
		||||
		$seconds = $this->job->getWarningTimeInSeconds($confDays, $policy);
 | 
			
		||||
 | 
			
		||||
		$this->assertEquals(10000, $seconds);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		$confDays = 7;
 | 
			
		||||
		$policy = array('pwdmaxage' => 365 * 3600 * 24);
 | 
			
		||||
 | 
			
		||||
		$seconds = $this->job->getWarningTimeInSeconds($confDays, $policy);
 | 
			
		||||
 | 
			
		||||
		$this->assertEquals(7*3600*24, $seconds);
 | 
			
		||||
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue