Getting organization from ldap/AD into identity.

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Getting organization from ldap/AD into identity.

Neil Price
This is what I've done. Seems to work. Hope it helps someone without
crashing everything. Debian stretch standard package.

---
/usr/share/roundcube/plugins/new_user_identity/new_user_identity.php.orig
2018-10-03 09:40:46.814463985 +0200
+++ /usr/share/roundcube/plugins/new_user_identity/new_user_identity.php
2018-10-04 15:08:42.176370477 +0200
@@ -33,8 +33,10 @@
              if (count($results->records) == 1) {
                  $user_name  = is_array($results->records[0]['name']) ?
$results->records[0]['name'][0] : $results->records[0]['name'];
                  $user_email = is_array($results->records[0]['email'])
? $results->records[0]['email'][0] : $results->records[0]['email'];
+                $user_org =
is_array($results->records[0]['organization']) ?
$results->records[0]['organization'][0] :
$results->records[0]['organization'];

                  $args['user_name']  = $user_name;
+                $args['user_org']  = $user_org;
                  $args['email_list'] = array();

                  if (!$args['user_email'] && strpos($user_email, '@')) {
@@ -70,9 +72,8 @@
          $identities = $this->rc->user->list_emails();
          $ldap_entry = $this->lookup_user_name(array(
                  'user' => $this->rc->user->data['username'],
-                'host' => $this->rc->user->data['mail_host'],
+                'host' => $this->rc->user->data['mail_host']
          ));
-
          foreach ((array) $ldap_entry['email_list'] as $email) {
              foreach ($identities as $identity) {
                  if ($identity['email'] == $email) {

--- /usr/share/roundcube/program/lib/Roundcube/rcube_user.php.orig
2016-11-27 18:08:58.000000000 +0200
+++ /usr/share/roundcube/program/lib/Roundcube/rcube_user.php 2018-10-04
15:17:32.542990608 +0200
@@ -630,7 +630,7 @@
              $user_name   = $data['user_name'];
              $user_email  = $data['user_email'];
              $email_list  = $data['email_list'];
-
+            $user_org  = $data['user_org'];
              if (empty($email_list)) {
                  if (empty($user_email)) {
                      $user_email = strpos($data['user'], '@') ? $user :
sprintf('%s@%s', $data['user'], $mail_domain);
@@ -667,6 +667,7 @@

                  $record['user_id']  = $user_id;
                  $record['standard'] = $standard;
+                $record['organization'] = $user_org;

                  $plugin = $rcube->plugins->exec_hook('identity_create',
                      array('login' => true, 'record' => $record));
_______________________________________________
Roundcube Users mailing list
[hidden email]
http://lists.roundcube.net/mailman/listinfo/users