diff --git a/src/Ltb/Directory.php b/src/Ltb/Directory.php index ea0f206..5dc429f 100644 --- a/src/Ltb/Directory.php +++ b/src/Ltb/Directory.php @@ -70,6 +70,11 @@ public function isAccountEnabled($ldap, $dn) : bool; */ public function getLdapDate($date) : string; + /* + * Get PHP date from LDAP date + */ + public function getPhpDate($date) : ?DateTime; + /* * Get password policy configuration */ diff --git a/src/Ltb/Directory/ActiveDirectory.php b/src/Ltb/Directory/ActiveDirectory.php index 39094fe..e0d22b6 100644 --- a/src/Ltb/Directory/ActiveDirectory.php +++ b/src/Ltb/Directory/ActiveDirectory.php @@ -297,6 +297,10 @@ public function getLdapDate($date) : string { return \Ltb\Date::timestamp2adDate( $date->getTimestamp() ); } + public function getPhpDate($date) : ?DateTime { + return \Ltb\Date::adDate2phpDate( $date ); + } + public function getPwdPolicyConfiguration($ldap, $entry_dn, $default_ppolicy_dn) : Array { $ppolicyConfig = array(); diff --git a/src/Ltb/Directory/OpenLDAP.php b/src/Ltb/Directory/OpenLDAP.php index 81a2fcc..f8a4fb9 100644 --- a/src/Ltb/Directory/OpenLDAP.php +++ b/src/Ltb/Directory/OpenLDAP.php @@ -279,6 +279,10 @@ public function getLdapDate($date) : string { return \Ltb\Date::string2ldapDate( $date->format('d/m/Y') ); } + public function getPhpDate($date) : ?DateTime { + return \Ltb\Date::ldapDate2phpDate( $date ); + } + public function getPwdPolicyConfiguration($ldap, $entry_dn, $default_ppolicy_dn) : Array { $ppolicyConfig = array();