<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
If you did it with a separate custom attribute, you would just
replace the "mail" attribute with the name of your custom attribute.
You should only have to apply a simple edit to
NSSADAuthenticator.php.<br>
<br>
Jules.<br>
<br>
<div class="moz-cite-prefix">On 06/02/2014 15:20, Alexander Fisher
wrote:<br>
</div>
<blockquote
cite="mid:CACx=s=Gsko894VqnW1Q348-QHYXjoCX3XtY9Q9c-2tCaMeEqzQ@mail.gmail.com"
type="cite">
<div dir="ltr">
<div class="gmail_extra">
<div class="gmail_quote">On 6 February 2014 11:50, Alexander
Fisher <span dir="ltr"><<a moz-do-not-send="true"
href="mailto:alex@alexfisher.me.uk" target="_blank">alex@alexfisher.me.uk</a>></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'm creating two zendto sites: <a
moz-do-not-send="true"
href="http://dropoff.companyname1.com"
target="_blank">dropoff.companyname1.com</a> and <a
moz-do-not-send="true"
href="http://dropoff.companyname2.com"
target="_blank">dropoff.companyname2.com</a><br>
<br>
</div>
<div>I'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
moz-do-not-send="true"
href="mailto:user.name@companyname1.com"
target="_blank">user.name@companyname1.com</a> and <a
moz-do-not-send="true"
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 <a class="moz-txt-link-freetext" href="ldap:mail">ldap:mail</a> 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'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['authStats'] ) {<br>
$this->_statsList = $prefs['authStats'];<br>
}<br>
+ if ( $prefs['overrideEmailDomain'] ) {<br>
+ $this->_overrideEmailDomain =
$prefs['overrideEmailDomain'];<br>
+ }<br>
}<br>
<br>
/*!<br>
@@ -132,6 +136,11 @@<br>
if ( $response['mail'] == "" ) {<br>
$response['mail'] = $uname . '@' .
$this->_defaultEmailDomain;<br>
}<br>
+ if ( $this->_overrideEmailDomain ) {<br>
+ $user_part = strstr( $response['mail'], "@",
true);<br>
+ $response['mail'] = $user_part . '@' .
$this->_overrideEmailDomain;<br>
+ //error_log ( "ValidUsername: " .
$response['mail'] );<br>
+ }<br>
}<br>
return TRUE;<br>
}<br>
@@ -173,6 +182,11 @@<br>
if ( $response['mail'] == "" ) {<br>
$response['mail'] = $uname . '@' .
$this->_defaultEmailDomain;<br>
}<br>
+ if ( $this->_overrideEmailDomain ) {<br>
+ $user_part = strstr( $response['mail'], "@",
true);<br>
+ $response['mail'] = $user_part . '@' .
$this->_overrideEmailDomain;<br>
+ //error_log ( "authenticate: " .
$response['mail'] );<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 moz-do-not-send="true"
href="http://zend.to">zend.to</a>?<br>
<br>
Kind Regards,<br>
</div>
<div>Alex<br>
</div>
<div> <br>
</div>
</div>
<br>
</div>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
ZendTo mailing list
<a class="moz-txt-link-abbreviated" href="mailto:ZendTo@zend.to">ZendTo@zend.to</a>
<a class="moz-txt-link-freetext" href="http://mailman.ecs.soton.ac.uk/mailman/listinfo/zendto">http://mailman.ecs.soton.ac.uk/mailman/listinfo/zendto</a></pre>
<br>
<pre class="moz-signature" cols="72">Jules
--
Julian Field MEng MBCS CITP CEng
'Always do sober what you said you'd do drunk. That will teach you
to keep your mouth shut.' - Ernest Hemingway
<a class="moz-txt-link-abbreviated" href="http://www.Zend.To">www.Zend.To</a>
Twitter: @JulesFM
PGP footprint: EE81 D763 3DB0 0BFD E1DC 7222 11F6 5947 1415 B654
</pre>
</blockquote>
</body>
</html>