Skip to content

Commit

Permalink
Merge pull request #50 from ltb-project/getphpdate
Browse files Browse the repository at this point in the history
Add getPhpDate in Directory module
  • Loading branch information
coudot authored Nov 19, 2024
2 parents a47ecb9 + 3c490d8 commit a11285f
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/Ltb/Directory.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down
4 changes: 4 additions & 0 deletions src/Ltb/Directory/ActiveDirectory.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
4 changes: 4 additions & 0 deletions src/Ltb/Directory/OpenLDAP.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit a11285f

Please sign in to comment.