summaryrefslogtreecommitdiff
path: root/inc/auth/ad.class.php
diff options
context:
space:
mode:
Diffstat (limited to 'inc/auth/ad.class.php')
-rw-r--r--inc/auth/ad.class.php32
1 files changed, 15 insertions, 17 deletions
diff --git a/inc/auth/ad.class.php b/inc/auth/ad.class.php
index f535556a8..a6f3b0513 100644
--- a/inc/auth/ad.class.php
+++ b/inc/auth/ad.class.php
@@ -41,7 +41,7 @@
* @author Andreas Gohr <andi@splitbrain.org>
*/
-require_once(DOKU_INC.'inc/adLDAP.php');
+require_once(DOKU_INC.'inc/adLDAP/adLDAP.php');
class auth_ad extends auth_basic {
/**
@@ -176,8 +176,8 @@ class auth_ad extends auth_basic {
$fields = array_unique($fields);
//get info for given user
- $result = $adldap->user_info($this->_userName($user), $fields);
- if($result == false) {
+ $result = $this->adldap->user()->info($this->_userName($user), $fields);
+ if($result == false){
return array();
}
@@ -199,7 +199,7 @@ class auth_ad extends auth_basic {
}
// handle ActiveDirectory memberOf
- $info['grps'] = $adldap->user_groups($this->_userName($user), (bool) $this->opts['recursive_groups']);
+ $info['grps'] = $this->adldap->user()->groups($this->_userName($user),(bool) $this->opts['recursive_groups']);
if(is_array($info['grps'])) {
foreach($info['grps'] as $ndx => $group) {
@@ -219,11 +219,9 @@ class auth_ad extends auth_basic {
}
// check expiry time
- if($info['expires'] && $this->cnf['expirywarn']) {
- $result = $adldap->domain_info(array('maxpwdage')); // maximum pass age
- $maxage = -1 * $result['maxpwdage'][0] / 10000000; // negative 100 nanosecs
- $timeleft = $maxage - (time() - $info['lastpwd']);
- $timeleft = round($timeleft / (24 * 60 * 60));
+ if($info['expires'] && $this->cnf['expirywarn']){
+ $timeleft = $this->adldap->user()->passwordExpiry($user); // returns unixtime
+ $timeleft = round($timeleft/(24*60*60));
$info['expiresin'] = $timeleft;
// if this is the current user, warn him (once per request only)
@@ -318,8 +316,8 @@ class auth_ad extends auth_basic {
if($this->users === null) {
//get info for given user
- $result = $adldap->all_users();
- if(!$result) return array();
+ $result = $this->adldap->user()->all();
+ if (!$result) return array();
$this->users = array_fill_keys($result, false);
}
@@ -358,9 +356,9 @@ class auth_ad extends auth_basic {
// password changing
if(isset($changes['pass'])) {
try {
- $return = $adldap->user_password($this->_userName($user), $changes['pass']);
- } catch(adLDAPException $e) {
- if($this->cnf['debug']) msg('AD Auth: '.$e->getMessage(), -1);
+ $return = $this->adldap->user()->password($this->_userName($user),$changes['pass']);
+ } catch (adLDAPException $e) {
+ if ($this->cnf['debug']) msg('AD Auth: '.$e->getMessage(), -1);
$return = false;
}
if(!$return) msg('AD Auth: failed to change the password. Maybe the password policy was not met?', -1);
@@ -380,9 +378,9 @@ class auth_ad extends auth_basic {
}
if(count($adchanges)) {
try {
- $return = $return & $adldap->user_modify($this->_userName($user), $adchanges);
- } catch(adLDAPException $e) {
- if($this->cnf['debug']) msg('AD Auth: '.$e->getMessage(), -1);
+ $return = $return & $this->adldap->user()->modify($this->_userName($user),$adchanges);
+ } catch (adLDAPException $e) {
+ if ($this->cnf['debug']) msg('AD Auth: '.$e->getMessage(), -1);
$return = false;
}
}