Changeset View
Changeset View
Standalone View
Standalone View
plugins/kolab_auth/kolab_auth.php
Show First 20 Lines • Show All 55 Lines • ▼ Show 20 Lines | public function init() | ||||
$this->add_hook('smtp_connect', array($this, 'smtp_connect')); | $this->add_hook('smtp_connect', array($this, 'smtp_connect')); | ||||
$this->add_hook('identity_form', array($this, 'identity_form')); | $this->add_hook('identity_form', array($this, 'identity_form')); | ||||
// Hook to modify some configuration, e.g. ldap | // Hook to modify some configuration, e.g. ldap | ||||
$this->add_hook('config_get', array($this, 'config_get')); | $this->add_hook('config_get', array($this, 'config_get')); | ||||
// Hook to modify logging directory | // Hook to modify logging directory | ||||
$this->add_hook('write_log', array($this, 'write_log')); | $this->add_hook('write_log', array($this, 'write_log')); | ||||
$this->username = $_SESSION['username']; | $this->username = $_SESSION['username'] ?? null; | ||||
// Enable debug logs (per-user), when logged as another user | // Enable debug logs (per-user), when logged as another user | ||||
if (!empty($_SESSION['kolab_auth_admin']) && $rcmail->config->get('kolab_auth_auditlog')) { | if (!empty($_SESSION['kolab_auth_admin']) && $rcmail->config->get('kolab_auth_auditlog')) { | ||||
$rcmail->config->set('debug_level', 1); | $rcmail->config->set('debug_level', 1); | ||||
$rcmail->config->set('smtp_log', true); | $rcmail->config->set('smtp_log', true); | ||||
$rcmail->config->set('log_logins', true); | $rcmail->config->set('log_logins', true); | ||||
$rcmail->config->set('log_session', true); | $rcmail->config->set('log_session', true); | ||||
$rcmail->config->set('memcache_debug', true); | $rcmail->config->set('memcache_debug', true); | ||||
▲ Show 20 Lines • Show All 588 Lines • ▼ Show 20 Lines | public function authenticate($args) | ||||
$this->data['user_name'] = $name; | $this->data['user_name'] = $name; | ||||
break; | break; | ||||
} | } | ||||
} | } | ||||
// User email(s) for identity (first log in) | // User email(s) for identity (first log in) | ||||
foreach ((array)$email_attr as $field) { | foreach ((array)$email_attr as $field) { | ||||
$email = is_array($record[$field]) ? array_filter($record[$field]) : $record[$field]; | $email = is_array($record[$field]) ? array_filter($record[$field]) : $record[$field]; | ||||
if (!empty($email)) { | if (!empty($email)) { | ||||
$this->data['user_email'] = array_merge((array)$this->data['user_email'], (array)$email); | $this->data['user_email'] = array_merge((array)($this->data['user_email'] ?? null), (array)$email); | ||||
} | } | ||||
} | } | ||||
// Organization name for identity (first log in) | // Organization name for identity (first log in) | ||||
foreach ((array)$org_attr as $field) { | foreach ((array)$org_attr as $field) { | ||||
$organization = is_array($record[$field]) ? $record[$field][0] : $record[$field]; | $organization = is_array($record[$field]) ? $record[$field][0] : $record[$field]; | ||||
if (!empty($organization)) { | if (!empty($organization)) { | ||||
$this->data['user_organization'] = $organization; | $this->data['user_organization'] = $organization; | ||||
break; | break; | ||||
▲ Show 20 Lines • Show All 213 Lines • Show Last 20 Lines |