mirror of
https://github.com/LDAPAccountManager/lam.git
synced 2025-10-03 01:39:33 +02:00
Compare commits
4 commits
4c8f3434fc
...
30ac0025bf
Author | SHA1 | Date | |
---|---|---|---|
![]() |
30ac0025bf | ||
![]() |
b6cf9b2b88 | ||
![]() |
23044ac06e | ||
![]() |
3c005187ea |
3 changed files with 22 additions and 62 deletions
|
@ -1110,15 +1110,7 @@ if (interface_exists('\LAM\JOB\Job', false)) {
|
|||
}
|
||||
|
||||
/**
|
||||
* Checks if a user needs to change his password.
|
||||
*
|
||||
* @param integer $jobID job ID
|
||||
* @param array $options job settings
|
||||
* @param PDO $pdo PDO
|
||||
* @param DateTime $now current time
|
||||
* @param array $policyOptions list of max age values (policy DN => maxAge)
|
||||
* @param array $user user attributes
|
||||
* @param boolean $isDryRun just do a dry run, nothing is modified
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected function checkSingleUser($jobID, $options, &$pdo, $now, $policyOptions, $user, $isDryRun) {
|
||||
// skip if user is locked
|
||||
|
@ -1220,15 +1212,7 @@ if (interface_exists('\LAM\JOB\Job', false)) {
|
|||
}
|
||||
|
||||
/**
|
||||
* Checks if a user needs to change his password.
|
||||
*
|
||||
* @param integer $jobID job ID
|
||||
* @param array $options job settings
|
||||
* @param PDO $pdo PDO
|
||||
* @param DateTime $now current time
|
||||
* @param array $policyOptions list of max age values (policy DN => maxAge)
|
||||
* @param array $user user attributes
|
||||
* @param boolean $isDryRun just do a dry run, nothing is modified
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected function checkSingleUser($jobID, $options, &$pdo, $now, $policyOptions, $user, $isDryRun) {
|
||||
$dn = $user['dn'];
|
||||
|
@ -1313,15 +1297,7 @@ if (interface_exists('\LAM\JOB\Job', false)) {
|
|||
}
|
||||
|
||||
/**
|
||||
* Checks if a user is expired.
|
||||
*
|
||||
* @param integer $jobID job ID
|
||||
* @param array $options job settings
|
||||
* @param PDO $pdo PDO
|
||||
* @param DateTime $now current time
|
||||
* @param array $policyOptions list of policy options by getPolicyOptions()
|
||||
* @param array $user user attributes
|
||||
* @param boolean $isDryRun just do a dry run, nothing is modified
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected function checkSingleUser($jobID, $options, &$pdo, $now, $policyOptions, $user, $isDryRun) {
|
||||
$expireTimeUnix = $user['shadowexpire'][0] * 3600 * 24;
|
||||
|
|
|
@ -4347,7 +4347,7 @@ class windowsUser extends baseModule implements passwordService, AccountStatusPr
|
|||
* Returns the formatted value for the password expiration date.
|
||||
*
|
||||
* @param array $attributes user attributes ($this->attributes if null)
|
||||
* @return String date or -
|
||||
* @return string date or -
|
||||
*/
|
||||
private function formatPasswordExpires($attributes = null) {
|
||||
if ($attributes == null) {
|
||||
|
@ -4363,8 +4363,8 @@ class windowsUser extends baseModule implements passwordService, AccountStatusPr
|
|||
/**
|
||||
* Formats a value in file time (100 ns since 1601-01-01).
|
||||
*
|
||||
* @param integer $value time value
|
||||
* @return String formatted value
|
||||
* @param string $value time value
|
||||
* @return string formatted value
|
||||
*/
|
||||
private function formatFileTime($value) {
|
||||
if (empty($value) || ($value == '-1')) {
|
||||
|
@ -4380,7 +4380,7 @@ class windowsUser extends baseModule implements passwordService, AccountStatusPr
|
|||
/**
|
||||
* Returns a value in file time (100 ns since 1601-01-01).
|
||||
*
|
||||
* @param integer $value time value as int
|
||||
* @param string $value time value as int
|
||||
* @return DateTime|null time value
|
||||
*/
|
||||
public static function getFileTime($value): ?DateTime {
|
||||
|
@ -4396,11 +4396,11 @@ class windowsUser extends baseModule implements passwordService, AccountStatusPr
|
|||
|
||||
/**
|
||||
* Sets the expiration date of this account.
|
||||
* If all parameters are null the expiration date will be removed.
|
||||
* If all parameters are null, the expiration date will be removed.
|
||||
*
|
||||
* @param String $year year (e.g. 2040)
|
||||
* @param String $month month (e.g. 8)
|
||||
* @param String $day day (e.g. 27)
|
||||
* @param int|null $year year (e.g. 2040)
|
||||
* @param int|null $month month (e.g. 8)
|
||||
* @param int|null $day day (e.g. 27)
|
||||
*/
|
||||
public function setExpirationDate($year, $month, $day) {
|
||||
if (($year == null) && ($month == null) && ($day == null)) {
|
||||
|
@ -5017,31 +5017,23 @@ if (interface_exists('\LAM\JOB\Job', false)) {
|
|||
}
|
||||
|
||||
/**
|
||||
* Checks if a user needs to change his password.
|
||||
*
|
||||
* @param integer $jobID job ID
|
||||
* @param array $options job settings
|
||||
* @param PDO $pdo PDO
|
||||
* @param DateTime $now current time
|
||||
* @param array $policyOptions not used
|
||||
* @param array $user user attributes
|
||||
* @param boolean $isDryRun just do a dry run, nothing is modified
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected function checkSingleUser($jobID, $options, &$pdo, $now, $policyOptions, $user, $isDryRun) {
|
||||
$dn = $user['dn'];
|
||||
// skip if password does not expire at all
|
||||
// skip if the password does not expire at all
|
||||
if (windowsUser::isNeverExpiring($user)) {
|
||||
$this->jobResultLog->logDebug($dn . ' does not expire.');
|
||||
return;
|
||||
}
|
||||
// skip if password does not expire
|
||||
// skip if the password does not expire
|
||||
if (empty($user['msds-userpasswordexpirytimecomputed'][0])
|
||||
|| ($user['msds-userpasswordexpirytimecomputed'][0] == windowsUser::ACCOUNT_DOES_NOT_EXPIRE)
|
||||
|| ($user['msds-userpasswordexpirytimecomputed'][0] == '0')) {
|
||||
$this->jobResultLog->logDebug($dn . ': password does not expire.');
|
||||
return;
|
||||
}
|
||||
// skip if account itself is expired
|
||||
// skip if the account itself is expired
|
||||
if (!empty($user['accountexpires'][0])) {
|
||||
$accountExpiration = windowsUser::getFileTime($user['accountexpires'][0]);
|
||||
if ($accountExpiration <= $now) {
|
||||
|
@ -5049,7 +5041,7 @@ if (interface_exists('\LAM\JOB\Job', false)) {
|
|||
return;
|
||||
}
|
||||
}
|
||||
// skip if account is deactivated
|
||||
// skip if the account is deactivated
|
||||
if (windowsUser::isDeactivated($user)) {
|
||||
$this->jobResultLog->logDebug($dn . ' is deactivated.');
|
||||
return;
|
||||
|
@ -5277,8 +5269,8 @@ if (interface_exists('\LAM\JOB\Job', false)) {
|
|||
/**
|
||||
* Returns if the job should run.
|
||||
*
|
||||
* @param $pdo PDO
|
||||
* @param $jobId job id
|
||||
* @param PDO $pdo PDO
|
||||
* @param string $jobId job id
|
||||
* @param DateTime $baseDate base date
|
||||
* @param int $monthInterval month interval
|
||||
* @return bool should run
|
||||
|
@ -5512,15 +5504,7 @@ if (interface_exists('\LAM\JOB\Job', false)) {
|
|||
}
|
||||
|
||||
/**
|
||||
* Checks if a user is expired.
|
||||
*
|
||||
* @param integer $jobID job ID
|
||||
* @param array $options job settings
|
||||
* @param PDO $pdo PDO
|
||||
* @param DateTime $now current time
|
||||
* @param array $policyOptions list of policy options by getPolicyOptions()
|
||||
* @param array $user user attributes
|
||||
* @param boolean $isDryRun just do a dry run, nothing is modified
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected function checkSingleUser($jobID, $options, &$pdo, $now, $policyOptions, $user, $isDryRun) {
|
||||
$seconds = substr($user['accountexpires'][0], 0, -7);
|
||||
|
|
|
@ -342,7 +342,7 @@ class ConfigDataImporter {
|
|||
$steps[] = new ImporterStep(_('General settings'), 'mainConfig', $value);
|
||||
break;
|
||||
case 'certificates':
|
||||
$steps[] = new ImporterStep(_('SSL certificates'), 'certificates', $value);
|
||||
$steps[] = new ImporterStep(_('SSL certificates'), 'certificates', [$value]);
|
||||
break;
|
||||
case 'serverProfiles':
|
||||
$mainStep = new ImporterStep(_('Server profiles'), 'serverProfiles', $value);
|
||||
|
@ -424,7 +424,7 @@ class ConfigDataImporter {
|
|||
* Runs the actual import.
|
||||
*
|
||||
* @param ImporterStep[] $steps import steps
|
||||
* @throws LAMException if error occurred
|
||||
* @throws LAMException if an error occurred
|
||||
*/
|
||||
public function runImport($steps) {
|
||||
foreach ($steps as $step) {
|
||||
|
@ -434,7 +434,7 @@ class ConfigDataImporter {
|
|||
$key = $step->getKey();
|
||||
match ($key) {
|
||||
'mainConfig' => $this->importMainConfig($step->getValue()),
|
||||
'certificates' => $this->importCertificates($step->getValue()),
|
||||
'certificates' => $this->importCertificates($step->getValue()[0]),
|
||||
'serverProfiles' => $this->importServerProfiles($step),
|
||||
'accountProfiles' => $this->importAccountProfiles($step),
|
||||
'accountProfileTemplates' => $this->importAccountProfileTemplates($step),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue