<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On 6 February 2014 11:50, Alexander Fisher <span dir="ltr">&lt;<a href="mailto:alex@alexfisher.me.uk" target="_blank">alex@alexfisher.me.uk</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div><div><div>Hi<br><br></div>I have a situation as follows.<br><br></div>I&#39;m creating two zendto sites: <a href="http://dropoff.companyname1.com" target="_blank">dropoff.companyname1.com</a> and <a href="http://dropoff.companyname2.com" target="_blank">dropoff.companyname2.com</a><br>

<br></div><div>I&#39;ll skin each site differently, but the internal users for both sites will be the same and authenticated against AD.  Each user has one email account, with several aliases.  ie <a href="mailto:user.name@companyname1.com" target="_blank">user.name@companyname1.com</a> and <a href="mailto:user.name@companyname2.com" target="_blank">user.name@companyname2.com</a> etc.<br>

<br></div><div>Can I easily change the LDAP field used to fetch the email address to perhaps a custom attribute I extend the Active Directory schema with?<br><br></div><div>Or maybe it would be best to fetch the email address from the standard ldap:mail attribute and replace the domain part with that of the site being used?<br>

<br></div><div>Has anybody else needed to do something like this?  What approach would you go for?<br><br>Many thanks,<br>Alex<br></div><div><br></div></div></blockquote><div><br></div><div>Hi again<br><br></div><div>I&#39;ve managed to get the second approach working.  Does the following patch look sane?<br>
<br>--- lib/NSSAuthenticator.php.bak        2014-02-06 14:14:28.124778074 +0000<br>+++ lib/NSSAuthenticator.php    2014-02-06 15:11:49.495180022 +0000<br>@@ -35,6 +35,7 @@<br>   private $_adminList = NULL;<br>   private $_statsList = NULL;<br>
   private $_defaultEmailDomain = NULL;<br>+  private $_overrideEmailDomain = NULL;<br><br>   /*!<br>     @function __construct<br>@@ -54,6 +55,9 @@<br>     if ( $prefs[&#39;authStats&#39;] ) {<br>       $this-&gt;_statsList = $prefs[&#39;authStats&#39;];<br>
     }<br>+    if ( $prefs[&#39;overrideEmailDomain&#39;] ) {<br>+      $this-&gt;_overrideEmailDomain = $prefs[&#39;overrideEmailDomain&#39;];<br>+    }<br>   }<br><br>   /*!<br>@@ -132,6 +136,11 @@<br>       if ( $response[&#39;mail&#39;] == &quot;&quot; ) {<br>
         $response[&#39;mail&#39;] = $uname . &#39;@&#39; . $this-&gt;_defaultEmailDomain;<br>       }<br>+      if ( $this-&gt;_overrideEmailDomain  ) {<br>+        $user_part = strstr( $response[&#39;mail&#39;], &quot;@&quot;, true);<br>
+        $response[&#39;mail&#39;] = $user_part . &#39;@&#39; . $this-&gt;_overrideEmailDomain;<br>+        //error_log ( &quot;ValidUsername: &quot; . $response[&#39;mail&#39;] );<br>+      }<br>     }<br>     return TRUE;<br>
   }<br>@@ -173,6 +182,11 @@<br>       if ( $response[&#39;mail&#39;] == &quot;&quot; ) {<br>         $response[&#39;mail&#39;] = $uname . &#39;@&#39; . $this-&gt;_defaultEmailDomain;<br>       }<br>+      if ( $this-&gt;_overrideEmailDomain  ) {<br>
+        $user_part = strstr( $response[&#39;mail&#39;], &quot;@&quot;, true);<br>+        $response[&#39;mail&#39;] = $user_part . &#39;@&#39; . $this-&gt;_overrideEmailDomain;<br>+        //error_log ( &quot;authenticate: &quot; . $response[&#39;mail&#39;] );<br>
+      }<br>     }<br>     return TRUE;<br>   }<br><br><br></div><div>If a new overrideEmailDomain variable is defined in preferences.php, that domain name is used to replace whatever domain name part existed in the email address fetched from LDAP/ActiveDirectory.<br>
</div><div><br></div><div>Any chance of getting this patch or something similar included in the next version of <a href="http://zend.to">zend.to</a>?<br><br>Kind Regards,<br></div><div>Alex<br></div><div> <br></div></div>
<br></div></div>