Store user's UID in session for use by other plugins (e.g. owncloud)

Small code style fixes
This commit is contained in:
Aleksander Machniak 2012-02-29 13:09:43 +01:00
parent 95c6c727fc
commit d1fecda9de
2 changed files with 19 additions and 5 deletions

View file

@ -346,6 +346,9 @@ class kolab_auth extends rcube_plugin
// Set credentials
if ($record) {
// Store UID in session for use by other plugins
$_SESSION['kolab_uid'] = is_array($record['uid']) ? $record['uid'][0] : $record['uid'];
if ($login_attr)
$this->data['user_login'] = is_array($record[$login_attr]) ? $record[$login_attr][0] : $record[$login_attr];
if ($alias_attr)
@ -405,8 +408,9 @@ class kolab_auth extends rcube_plugin
*/
private function init_ldap()
{
if ($this->ldap)
if ($this->ldap) {
return $this->ldap->ready;
}
$rcmail = rcmail::get_instance();
@ -447,8 +451,9 @@ class kolab_auth extends rcube_plugin
$this->ldap->set_filter($filter);
$results = $this->ldap->list_records();
if (count($results->records) == 1)
if (count($results->records) == 1) {
return $results->records[0];
}
}
/**
@ -480,9 +485,16 @@ class kolab_auth extends rcube_plugin
*/
class kolab_auth_ldap_backend extends rcube_ldap
{
function __construct($p, $debug=false, $mail_domain=null)
{
parent::__construct($p, $debug, $mail_domain);
$this->fieldmap['uid'] = 'uid';
}
function set_filter($filter)
{
if ($filter)
if ($filter) {
$this->prop['filter'] = $filter;
}
}
}

View file

@ -18,9 +18,9 @@
<email>machniak@kolabsys.com</email>
<active>yes</active>
</lead>
<date>2011-11-01</date>
<date>2012-02-29</date>
<version>
<release>0.1</release>
<release>0.2</release>
<api>0.1</api>
</version>
<stability>
@ -38,6 +38,8 @@
<file name="config.inc.php.dist" role="data"></file>
<file name="LICENSE" role="data"></file>
<file name="localization/de_CH.inc" role="data"></file>
<file name="localization/de_DE.inc" role="data"></file>
<file name="localization/en_US.inc" role="data"></file>
<file name="localization/pl_PL.inc" role="data"></file>
</dir>