mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-26 07:14:35 +02:00
LdapUserBackend: Move function retrieveGeneralizedTime into its parent
refs #7343
This commit is contained in:
parent
5dd3950594
commit
e0c0e9c874
@ -4,7 +4,6 @@
|
|||||||
namespace Icinga\Authentication\User;
|
namespace Icinga\Authentication\User;
|
||||||
|
|
||||||
use DateTime;
|
use DateTime;
|
||||||
use Icinga\Application\Logger;
|
|
||||||
use Icinga\Data\ConfigObject;
|
use Icinga\Data\ConfigObject;
|
||||||
use Icinga\Exception\AuthenticationException;
|
use Icinga\Exception\AuthenticationException;
|
||||||
use Icinga\Exception\ProgrammingError;
|
use Icinga\Exception\ProgrammingError;
|
||||||
@ -325,37 +324,6 @@ class LdapUserBackend extends Repository implements UserBackendInterface
|
|||||||
return ((int) $value & $ADS_UF_ACCOUNTDISABLE) === 0;
|
return ((int) $value & $ADS_UF_ACCOUNTDISABLE) === 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Parse the given value based on the ASN.1 standard (GeneralizedTime) and return its timestamp representation
|
|
||||||
*
|
|
||||||
* @param string|null $value
|
|
||||||
*
|
|
||||||
* @return int
|
|
||||||
*/
|
|
||||||
protected function retrieveGeneralizedTime($value)
|
|
||||||
{
|
|
||||||
if ($value === null) {
|
|
||||||
return $value;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (
|
|
||||||
($dateTime = DateTime::createFromFormat('YmdHis.uO', $value)) !== false
|
|
||||||
|| ($dateTime = DateTime::createFromFormat('YmdHis.uZ', $value)) !== false
|
|
||||||
|| ($dateTime = DateTime::createFromFormat('YmdHis.u', $value)) !== false
|
|
||||||
|| ($dateTime = DateTime::createFromFormat('YmdHis', $value)) !== false
|
|
||||||
|| ($dateTime = DateTime::createFromFormat('YmdHi', $value)) !== false
|
|
||||||
|| ($dateTime = DateTime::createFromFormat('YmdH', $value)) !== false
|
|
||||||
) {
|
|
||||||
return $dateTime->getTimeStamp();
|
|
||||||
} else {
|
|
||||||
Logger::debug(sprintf(
|
|
||||||
'Failed to parse "%s" based on the ASN.1 standard (GeneralizedTime) for user backend "%s".',
|
|
||||||
$value,
|
|
||||||
$this->getName()
|
|
||||||
));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return whether the given shadowExpire value defines that a user is permitted to login
|
* Return whether the given shadowExpire value defines that a user is permitted to login
|
||||||
*
|
*
|
||||||
|
@ -599,6 +599,37 @@ abstract class Repository implements Selectable
|
|||||||
return $value;
|
return $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parse the given value based on the ASN.1 standard (GeneralizedTime) and return its timestamp representation
|
||||||
|
*
|
||||||
|
* @param string|null $value
|
||||||
|
*
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
|
protected function retrieveGeneralizedTime($value)
|
||||||
|
{
|
||||||
|
if ($value === null) {
|
||||||
|
return $value;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (
|
||||||
|
($dateTime = DateTime::createFromFormat('YmdHis.uO', $value)) !== false
|
||||||
|
|| ($dateTime = DateTime::createFromFormat('YmdHis.uZ', $value)) !== false
|
||||||
|
|| ($dateTime = DateTime::createFromFormat('YmdHis.u', $value)) !== false
|
||||||
|
|| ($dateTime = DateTime::createFromFormat('YmdHis', $value)) !== false
|
||||||
|
|| ($dateTime = DateTime::createFromFormat('YmdHi', $value)) !== false
|
||||||
|
|| ($dateTime = DateTime::createFromFormat('YmdH', $value)) !== false
|
||||||
|
) {
|
||||||
|
return $dateTime->getTimeStamp();
|
||||||
|
} else {
|
||||||
|
Logger::debug(sprintf(
|
||||||
|
'Failed to parse "%s" based on the ASN.1 standard (GeneralizedTime) in repository "%s".',
|
||||||
|
$value,
|
||||||
|
$this->getName()
|
||||||
|
));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Validate that the requested table exists
|
* Validate that the requested table exists
|
||||||
*
|
*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user