From 944e0e60477541562953c51b67202868e81d2668 Mon Sep 17 00:00:00 2001 From: Miles Lott Date: Sat, 8 Sep 2001 06:19:06 +0000 Subject: [PATCH] Fix unsetting of status --- phpgwapi/inc/class.accounts_ldap.inc.php | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/phpgwapi/inc/class.accounts_ldap.inc.php b/phpgwapi/inc/class.accounts_ldap.inc.php index 64d7285cbe..a347d9207d 100644 --- a/phpgwapi/inc/class.accounts_ldap.inc.php +++ b/phpgwapi/inc/class.accounts_ldap.inc.php @@ -80,7 +80,7 @@ $this->data['lastlogin'] = $allValues[0]['phpgwaccountlastlogin'][0]; $this->data['lastloginfrom'] = $allValues[0]['phpgwaccountlastloginfrom'][0]; $this->data['lastpasswd_change'] = $allValues[0]['phpgwlastpasswdchange'][0]; - $this->data['status'] = $allValues[0]['phpgwaccountstatus'][0]; + $this->data['status'] = trim($allValues[0]['phpgwaccountstatus'][0]); $this->data['type'] = $allValues[0]['phpgwaccounttype'][0]; $this->data['expires'] = $allValues[0]['phpgwaccountexpires'][0]; @@ -268,6 +268,20 @@ } } } + /* If status is to be set inactive, insert a space here. This is trimmed in read_repository. */ + if (!$entry['phpgwaccountstatus']) + { + if (!$allValues[0]['phpgwaccountstatus'][0]) + { + /* attribute was not in LDAP, add it */ + ldap_mod_add($this->ds, $allValues[0]['dn'], array('phpgwaccountstatus' => ' ')); + } + else + { + /* attribute was in LDAP, modify it */ + ldap_modify($this->ds, $allValues[0]['dn'], array('phpgwaccountstatus' => ' ')); + } + } } }