added alias handling

This commit is contained in:
Roland Gruber 2006-05-01 16:13:10 +00:00
parent 8176cdccac
commit 93339150d7
7 changed files with 192 additions and 74 deletions

View File

@ -128,11 +128,7 @@ class<br>
&nbsp;&nbsp;&nbsp; <span style="font-weight: bold;">function</span> &nbsp;&nbsp;&nbsp; <span style="font-weight: bold;">function</span>
get_metaData() {<br> get_metaData() {<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; $return = array();<br> &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; $return = array();<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; // manages host accounts<br> &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; // alias name<br>
<span style="color: rgb(255, 0, 0);">&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp; </span>$return["account_types"] = array("host");<br
style="color: rgb(255, 0, 0);">
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; // alias name<br>
<span style="color: rgb(255, 0, 0);">&nbsp;&nbsp;&nbsp; <span style="color: rgb(255, 0, 0);">&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp; &nbsp;$return["alias"] = _("MAC address");</span><br &nbsp;&nbsp; &nbsp;$return["alias"] = _("MAC address");</span><br
style="color: rgb(255, 0, 0);"> style="color: rgb(255, 0, 0);">
@ -172,14 +168,7 @@ class<br>
&nbsp;&nbsp;&nbsp; <span style="font-weight: bold;">function</span> &nbsp;&nbsp;&nbsp; <span style="font-weight: bold;">function</span>
get_metaData() {<br> get_metaData() {<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; $return = array();<br> &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; $return = array();<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; // manages host accounts<br> &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; // module dependencies<br>
<span style="color: rgb(255, 0, 0);">&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp; </span>$return["account_types"] = array("host");<br
style="color: rgb(255, 0, 0);">
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; // alias name<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;$return["alias"] = _("MAC
address");<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; // module dependencies<br>
<span style="color: rgb(255, 0, 0);">&nbsp;&nbsp;&nbsp; <span style="color: rgb(255, 0, 0);">&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp; &nbsp;$return['dependencies'] = array('depends' =&gt; &nbsp;&nbsp; &nbsp;$return['dependencies'] = array('depends' =&gt;
array('account'), 'conflicts' =&gt; array());</span><br array('account'), 'conflicts' =&gt; array());</span><br
@ -255,18 +244,7 @@ class<br>
&nbsp;&nbsp;&nbsp; <span style="font-weight: bold;">function</span> &nbsp;&nbsp;&nbsp; <span style="font-weight: bold;">function</span>
get_metaData() {<br> get_metaData() {<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; $return = array();<br> &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; $return = array();<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; // manages host accounts<br> &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; // managed object classes<br>
<span style="color: rgb(255, 0, 0);">&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp; </span>$return["account_types"] = array("host");<br
style="color: rgb(255, 0, 0);">
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; // alias name<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;$return["alias"] = _("MAC
address");<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; // module dependencies<br>
&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp; &nbsp;$return['dependencies'] = array('depends' =&gt;
array('account'), 'conflicts' =&gt; array());<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; // managed object classes<br>
<span style="color: rgb(255, 0, 0);">&nbsp;&nbsp;&nbsp; <span style="color: rgb(255, 0, 0);">&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp; &nbsp;$return['objectClasses'] = array('ieee802Device');</span><br> &nbsp;&nbsp; &nbsp;$return['objectClasses'] = array('ieee802Device');</span><br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; return $return;<br> &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; return $return;<br>
@ -277,6 +255,47 @@ array('account'), 'conflicts' =&gt; array());<br>
</table> </table>
<br> <br>
<br> <br>
<h2>7. Known LDAP aliases<br>
</h2>
LDAP attributes can have several names (e.g. "cn" and "commonName" are
the same). If you manage such attributes then tell LAM about the alias
names.<br>
LAM will then convert all alias names to the given attribute names
automatically.<br>
<br>
<span style="font-weight: bold; text-decoration: underline;">Example:</span><br>
<br>
The <span style="font-style: italic;">posixGroup</span> module manages
the "cn" attribute. This attribute is also known under the alias
"commonName".<br>
This way the module will never see attributes called "commonName"
because LAM renames them as soon as the LDAP entry is loaded.<br>
<br>
<table style="width: 100%; text-align: left;" class="mod-code"
border="0" cellpadding="2" cellspacing="2">
<tbody>
<tr>
<td style="vertical-align: top;">&nbsp;&nbsp;&nbsp; /**<br>
&nbsp;&nbsp;&nbsp; * Returns meta data that is interpreted by parent
class<br>
&nbsp;&nbsp;&nbsp; *<br>
&nbsp;&nbsp;&nbsp; * @return array array with meta data<br>
&nbsp;&nbsp;&nbsp; */<br>
&nbsp;&nbsp;&nbsp; <span style="font-weight: bold;">function</span>
get_metaData() {<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; $return = array();<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; // LDAP aliases<br>
<span style="color: rgb(255, 0, 0);">&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp; &nbsp;$return['LDAPaliases'] = array('commonName' =&gt;
'cn');</span><br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; return $return;<br>
&nbsp;&nbsp;&nbsp; }<br>
</td>
</tr>
</tbody>
</table>
<br>
<br>
<span style="font-weight: bold;"></span> <span style="font-weight: bold;"></span>
<h2><span style="font-weight: bold;"></span></h2> <h2><span style="font-weight: bold;"></span></h2>
</div> </div>

View File

@ -143,7 +143,24 @@ This is used to fix spelling errors in LDAP-Entries (e.g. if
<span style="font-weight: bold;">Example: <span <span style="font-weight: bold;">Example: <span
style="font-style: italic;">return "('posixAccount')"</span></span><br> style="font-style: italic;">return "('posixAccount')"</span></span><br>
<span style="font-weight: bold; color: rgb(255, 0, 0);"></span><br> <span style="font-weight: bold; color: rgb(255, 0, 0);"></span><br>
<h3>2.1.6. get_RDNAttributes*</h3> <h3>2.1.6. getLDAPAliases*</h3>
<br>
<table border="0" cellpadding="2" cellspacing="2">
<tbody>
<tr>
<td style="vertical-align: top; text-align: center;"><span
style="font-weight: bold;">function getLDAPAliases()</span><br>
</td>
</tr>
</tbody>
</table>
<br>
This function returns a list of LDAP attribute alias names.<br>
<br>
<span style="font-weight: bold;">return array(&lt;alias name&gt; =&gt;
&lt;attribute name&gt;)</span><br>
<br>
<h3>2.1.7. get_RDNAttributes*</h3>
<br> <br>
<table border="0" cellpadding="2" cellspacing="2"> <table border="0" cellpadding="2" cellspacing="2">
<tbody> <tbody>
@ -168,7 +185,7 @@ for the RDN selection.<br>
'normal', 'cn' =&gt; 'low')"</span></span><br> 'normal', 'cn' =&gt; 'low')"</span></span><br>
<br> <br>
<span style="font-weight: bold; color: rgb(255, 0, 0);"></span> <span style="font-weight: bold; color: rgb(255, 0, 0);"></span>
<h3>2.1.7. get_dependencies*</h3> <h3>2.1.8. get_dependencies*</h3>
<br> <br>
<table border="0" cellpadding="2" cellspacing="2"> <table border="0" cellpadding="2" cellspacing="2">
<tbody> <tbody>
@ -198,7 +215,7 @@ your module depends on one of these modules.<br>
=&gt; array("exim"));</span><br =&gt; array("exim"));</span><br
style="font-weight: bold; font-style: italic;"> style="font-weight: bold; font-style: italic;">
<br> <br>
<h3>2.1.8. get_metaData()</h3> <h3>2.1.9. get_metaData()</h3>
<br> <br>
<table border="0" cellpadding="2" cellspacing="2"> <table border="0" cellpadding="2" cellspacing="2">
<tbody> <tbody>
@ -215,7 +232,7 @@ Returns an hash array including meta data for the baseModule.<br>
<span style="font-weight: bold;">Example: return array("is_base" =&gt; <span style="font-weight: bold;">Example: return array("is_base" =&gt;
true);</span><br style="font-weight: bold;"> true);</span><br style="font-weight: bold;">
<br> <br>
<h3>2.1.9. get_configOptions()*</h3> <h3>2.1.10. get_configOptions()*</h3>
<br> <br>
<table border="0" cellpadding="2" cellspacing="2"> <table border="0" cellpadding="2" cellspacing="2">
<tbody> <tbody>
@ -244,7 +261,7 @@ as keywords to load and save settings. We recommend to use the module
name as prefix for them (e.g. posixAccount_homeDirectory) to avoid name as prefix for them (e.g. posixAccount_homeDirectory) to avoid
naming confilcts.<br> naming confilcts.<br>
<br> <br>
<h3>2.1.10. get_configDescriptions()*</h3> <h3>2.1.11. get_configDescriptions()*</h3>
<br> <br>
<table border="0" cellpadding="2" cellspacing="2"> <table border="0" cellpadding="2" cellspacing="2">
<tbody> <tbody>
@ -269,7 +286,7 @@ array with this format:<br>
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 'descriptions' =&gt; array('option1' &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 'descriptions' =&gt; array('option1'
=&gt; 'description1', ...))</span><br> =&gt; 'description1', ...))</span><br>
<br> <br>
<h3>2.1.11. check_configOptions*</h3> <h3>2.1.12. check_configOptions*</h3>
<br> <br>
<table border="0" cellpadding="2" cellspacing="2"> <table border="0" cellpadding="2" cellspacing="2">
<tbody> <tbody>
@ -297,7 +314,7 @@ If no errors occured the function returns an empty array.<span
style="font-weight: bold;"></span><br> style="font-weight: bold;"></span><br>
<br style="font-weight: bold;"> <br style="font-weight: bold;">
<span style="font-weight: bold;"></span> <span style="font-weight: bold;"></span>
<h3>2.1.12. get_scope()</h3> <h3>2.1.13. get_scope()</h3>
<br> <br>
<table border="0" cellpadding="2" cellspacing="2"> <table border="0" cellpadding="2" cellspacing="2">
<tbody> <tbody>
@ -314,7 +331,7 @@ Returns the account type (user/group/host) of this module object.<br>
<span style="font-weight: bold;">This function is provided by the <span style="font-weight: bold;">This function is provided by the
baseModule and should not be overwritten.</span><br> baseModule and should not be overwritten.</span><br>
<br> <br>
<h3>2.1.13. get_uploadColumns*</h3> <h3>2.1.14. get_uploadColumns*</h3>
<br> <br>
<table border="0" cellpadding="2" cellspacing="2"> <table border="0" cellpadding="2" cellspacing="2">
<tbody> <tbody>
@ -359,7 +376,7 @@ all values of this column must be different values <span
</li> </li>
</ul> </ul>
<br> <br>
<h3>2.1.14. get_uploadPreDepends*</h3> <h3>2.1.15. get_uploadPreDepends*</h3>
<br> <br>
<table border="0" cellpadding="2" cellspacing="2"> <table border="0" cellpadding="2" cellspacing="2">
<tbody> <tbody>
@ -375,7 +392,7 @@ Returns a list of module names which must be processed before this
module at builing accounts.<br> module at builing accounts.<br>
The named modules may not be active, LAM will check this automatically.<br> The named modules may not be active, LAM will check this automatically.<br>
<br> <br>
<h3>2.1.15. build_uploadAccounts</h3> <h3>2.1.16. build_uploadAccounts</h3>
<br> <br>
<table border="0" cellpadding="2" cellspacing="2"> <table border="0" cellpadding="2" cellspacing="2">
<tbody> <tbody>
@ -402,7 +419,7 @@ format is the same as used for ldap_add().<br>
Returns an array which contains sub arrays to generate StatusMessages Returns an array which contains sub arrays to generate StatusMessages
if any errors occured.<br> if any errors occured.<br>
<br> <br>
<h3>2.1.16. do_uploadPostActions</h3> <h3>2.1.17. do_uploadPostActions</h3>
<br> <br>
<table border="0" cellpadding="2" cellspacing="2"> <table border="0" cellpadding="2" cellspacing="2">
<tbody> <tbody>
@ -448,7 +465,7 @@ array()</span>&nbsp;&nbsp; // List of arrays which are used to generate
StatusMessages<br> StatusMessages<br>
&nbsp;&nbsp;&nbsp; <span style="font-weight: bold;">)</span><br> &nbsp;&nbsp;&nbsp; <span style="font-weight: bold;">)</span><br>
<br> <br>
<h3>2.1.17. get_profileOptions*</h3> <h3>2.1.18. get_profileOptions*</h3>
<br> <br>
<table border="0" cellpadding="2" cellspacing="2"> <table border="0" cellpadding="2" cellspacing="2">
<tbody> <tbody>
@ -472,7 +489,7 @@ as keywords to load and save profiles. We recommend to use the module
name as prefix for them (e.g. posixAccount_homeDirectory) to avoid name as prefix for them (e.g. posixAccount_homeDirectory) to avoid
naming confilcts.<br> naming confilcts.<br>
<br> <br>
<h3>2.1.18. check_profileOptions*</h3> <h3>2.1.19. check_profileOptions*</h3>
<br> <br>
<table border="0" cellpadding="2" cellspacing="2"> <table border="0" cellpadding="2" cellspacing="2">
<tbody> <tbody>
@ -496,7 +513,7 @@ head, 2 =&gt; message text, 3 =&gt; additional variables).<br>
If no errors occured the function returns an empty array.<span If no errors occured the function returns an empty array.<span
style="font-weight: bold;"></span><br> style="font-weight: bold;"></span><br>
<br> <br>
<h3>2.1.19. load_profile*</h3> <h3>2.1.20. load_profile*</h3>
<br> <br>
<table border="0" cellpadding="2" cellspacing="2"> <table border="0" cellpadding="2" cellspacing="2">
<tbody> <tbody>
@ -515,7 +532,7 @@ internal data structures.<br>
is an hash array (identifier =&gt; array(values))&nbsp; with all values is an hash array (identifier =&gt; array(values))&nbsp; with all values
of an account profile.<br> of an account profile.<br>
<br> <br>
<h3>2.1.20. getRequiredExtensions*</h3> <h3>2.1.21. getRequiredExtensions*</h3>
<br> <br>
<table border="0" cellpadding="2" cellspacing="2"> <table border="0" cellpadding="2" cellspacing="2">
<tbody> <tbody>
@ -530,9 +547,9 @@ of an account profile.<br>
This function returns a list of PHP extensions (e.g. mhash) which are This function returns a list of PHP extensions (e.g. mhash) which are
needed by this module.<br> needed by this module.<br>
<br> <br>
<span style="font-weight: bold;"><br>
<br> <br>
<br> </span>
<br>
<h3>2.2. Functions which are called inside of an account container<br> <h3>2.2. Functions which are called inside of an account container<br>
</h3> </h3>
<h3>2.2.1. init</h3> <h3>2.2.1. init</h3>
@ -1288,8 +1305,19 @@ array("user", "host")</span><br style="font-weight: bold;">
style="font-style: italic; font-weight: bold;"> array('posixAccount')<br> style="font-style: italic; font-weight: bold;"> array('posixAccount')<br>
<br> <br>
</span> </span>
<h3>6.5 getLDAPaliases()<br>
</h3>
"LDAPaliases" =&gt; array()<br>
<span style="font-weight: bold;"><br>
<span style="font-style: italic;"></span></span><span
style="font-weight: bold;">Example:</span><span
style="font-style: italic; font-weight: bold;"> array('commonName'
=&gt; 'cn')</span><br>
<br>
<span style="font-style: italic; font-weight: bold;"><br>
</span>
<span style="font-style: italic; font-weight: bold;"></span> <span style="font-style: italic; font-weight: bold;"></span>
<h3>6.5 get_RDNAttributes()</h3> <h3>6.6 get_RDNAttributes()</h3>
&nbsp;&nbsp;&nbsp; "RDN" =&gt; array<br> &nbsp;&nbsp;&nbsp; "RDN" =&gt; array<br>
<br> <br>
<span style="font-weight: bold;">&nbsp;&nbsp; Example:</span><span <span style="font-weight: bold;">&nbsp;&nbsp; Example:</span><span
@ -1298,7 +1326,7 @@ array("user", "host")</span><br style="font-weight: bold;">
<br> <br>
</span> </span>
<span style="font-style: italic; font-weight: bold;"></span> <span style="font-style: italic; font-weight: bold;"></span>
<h3>6.6 get_dependencies()<br> <h3>6.7 get_dependencies()<br>
</h3> </h3>
&nbsp;&nbsp;&nbsp; "dependencies" =&gt; array<br> &nbsp;&nbsp;&nbsp; "dependencies" =&gt; array<br>
<br> <br>
@ -1310,7 +1338,7 @@ array("user", "host")</span><br style="font-weight: bold;">
=&gt; array("exim")</span></span><span =&gt; array("exim")</span></span><span
style="font-style: italic; font-weight: bold;">)<br> style="font-style: italic; font-weight: bold;">)<br>
</span><br> </span><br>
<h3>6.7 get_profileOptions()<br> <h3>6.8 get_profileOptions()<br>
</h3> </h3>
&nbsp;&nbsp;&nbsp; "profile_options" =&gt; array<br> &nbsp;&nbsp;&nbsp; "profile_options" =&gt; array<br>
<br> <br>
@ -1319,7 +1347,7 @@ array("user", "host")</span><br style="font-weight: bold;">
return value of get_profileOptions().<br> return value of get_profileOptions().<br>
<br> <br>
</span></span> </span></span>
<h3>6.8 check_profileOptions()<br> <h3>6.9 check_profileOptions()<br>
</h3> </h3>
&nbsp;&nbsp;&nbsp; "profile_checks" =&gt; array<br> &nbsp;&nbsp;&nbsp; "profile_checks" =&gt; array<br>
<br> <br>
@ -1394,7 +1422,7 @@ head, 2 =&gt; message text, 3 =&gt; additional variables)</li>
</ul> </ul>
</ul> </ul>
<br> <br>
<h3>6.9 load_profile()<br> <h3>6.10 load_profile()<br>
</h3> </h3>
&nbsp;&nbsp;&nbsp; "profile_mappings" =&gt; array('profile_identifier1' &nbsp;&nbsp;&nbsp; "profile_mappings" =&gt; array('profile_identifier1'
=&gt; 'LDAP_attribute1', 'profile_identifier2' =&gt; 'LDAP_attribute2')<br> =&gt; 'LDAP_attribute1', 'profile_identifier2' =&gt; 'LDAP_attribute2')<br>
@ -1403,7 +1431,7 @@ head, 2 =&gt; message text, 3 =&gt; additional variables)</li>
$this-&gt;attributes.<br> $this-&gt;attributes.<br>
<span style="font-weight: bold;"><span style="font-style: italic;"><br> <span style="font-weight: bold;"><span style="font-style: italic;"><br>
</span></span> </span></span>
<h3>6.10 get_configOptions()<br> <h3>6.11 get_configOptions()<br>
</h3> </h3>
&nbsp;&nbsp;&nbsp; "config_options" =&gt; array('user' =&gt; array, &nbsp;&nbsp;&nbsp; "config_options" =&gt; array('user' =&gt; array,
'host' =&gt; array, 'all' =&gt; array)<br> 'host' =&gt; array, 'all' =&gt; array)<br>
@ -1419,7 +1447,7 @@ the
return value of get_configOptions().<br> return value of get_configOptions().<br>
<br> <br>
</span></span> </span></span>
<h3>6.11 get_configDescriptions()<br> <h3>6.12 get_configDescriptions()<br>
</h3> </h3>
&nbsp;&nbsp;&nbsp; "config_descriptions" =&gt; array<br> &nbsp;&nbsp;&nbsp; "config_descriptions" =&gt; array<br>
<br> <br>
@ -1428,7 +1456,7 @@ return value of get_configOptions().<br>
return value of get_configDescriptions().<br> return value of get_configDescriptions().<br>
<br> <br>
</span></span> </span></span>
<h3>6.12 check_configOptions()<br> <h3>6.13 check_configOptions()<br>
</h3> </h3>
&nbsp;&nbsp;&nbsp; "config_checks" =&gt; array('user' =&gt; array, &nbsp;&nbsp;&nbsp; "config_checks" =&gt; array('user' =&gt; array,
'host' =&gt; 'array', 'all' =&gt; array)<br> 'host' =&gt; 'array', 'all' =&gt; array)<br>
@ -1442,21 +1470,21 @@ the other values only if they are inside the <span
check_profileOptions().<br> check_profileOptions().<br>
<br> <br>
</span></span> </span></span>
<h3>6.13 get_uploadColumns()</h3> <h3>6.14 get_uploadColumns()</h3>
"upload_columns" =&gt; array()<br> "upload_columns" =&gt; array()<br>
<span style="font-weight: bold;"><br> <span style="font-weight: bold;"><br>
<span style="font-style: italic;">Syntax for array is the same as for <span style="font-style: italic;">Syntax for array is the same as for
the the
return value of get_uploadColumns().<br> return value of get_uploadColumns().<br>
</span></span><br> </span></span><br>
<h3>6.14 get_uploadPreDepends()</h3> <h3>6.15 get_uploadPreDepends()</h3>
"upload_preDepends" =&gt; array()<br> "upload_preDepends" =&gt; array()<br>
<span style="font-weight: bold;"><br> <span style="font-weight: bold;"><br>
<span style="font-style: italic;">Syntax for array is the same as for <span style="font-style: italic;">Syntax for array is the same as for
the the
return value of get_uploadPreDepends().<br> return value of get_uploadPreDepends().<br>
</span></span><br> </span></span><br>
<h3>6.15 getRequiredExtensions()<br> <h3>6.16 getRequiredExtensions()<br>
</h3> </h3>
"extensions" =&gt; array()<br> "extensions" =&gt; array()<br>
<span style="font-weight: bold;"><br> <span style="font-weight: bold;"><br>

View File

@ -679,6 +679,17 @@ class baseModule {
else return array(); else return array();
} }
/**
* Returns a list of aliases for LDAP attributes.
* All alias attributes will be renamed to the given attribute names.
*
* @return array list of aliases (alias name => attribute name)
*/
function getLDAPAliases() {
if (isset($this->meta['LDAPaliases']) && is_array($this->meta['LDAPaliases'])) return $this->meta['LDAPaliases'];
else return array();
}
/** /**
* Returns a list of required PHP extensions. * Returns a list of required PHP extensions.
* *

View File

@ -1323,6 +1323,10 @@ class accountContainer {
* @return array an array which can be passed to $this->saveAccount() * @return array an array which can be passed to $this->saveAccount()
*/ */
function save_module_attributes($attributes, $orig) { function save_module_attributes($attributes, $orig) {
$toadd = array();
$tomodify = array();
$torem = array();
$notchanged = array();
// Get list of all "easy" attributes // Get list of all "easy" attributes
$attr_names = array_keys($attributes); $attr_names = array_keys($attributes);
// Get attributes which should be added // Get attributes which should be added
@ -1436,14 +1440,26 @@ class accountContainer {
function fixLDAPAttributes($attributes, $modules) { function fixLDAPAttributes($attributes, $modules) {
if (!is_array($attributes)) return $attributes; if (!is_array($attributes)) return $attributes;
$keys = array_keys($attributes); $keys = array_keys($attributes);
// get correct object class names // get correct object class names, aliases and attributes
$objectClasses = array(); $objectClasses = array();
$aliases = array();
foreach ($modules as $module) { foreach ($modules as $module) {
$moduleObj = new $module($this->type); $moduleObj = new $module($this->type);
$objectClasses = array_merge($objectClasses, $moduleObj->getManagedObjectClasses()); $objectClasses = array_merge($objectClasses, $moduleObj->getManagedObjectClasses());
$aliases = array_merge($aliases, $moduleObj->getLDAPAliases());
} }
// check object classes // convert alias names to lower case (for easier comparison)
$aliasKeys = array_keys($aliases);
for ($i = 0; $i < sizeof($aliasKeys); $i++) {
if ($aliasKeys[$i] != strtolower($aliasKeys[$i])) {
$aliases[strtolower($aliasKeys[$i])] = $aliases[$aliasKeys[$i]];
unset($aliases[$aliasKeys[$i]]);
$aliasKeys[$i] = strtolower($aliasKeys[$i]);
}
}
// fix object classes and attributes
for ($i = 0; $i < sizeof($keys); $i++) { for ($i = 0; $i < sizeof($keys); $i++) {
// check object classes
if (strtolower($keys[$i]) == 'objectclass') { if (strtolower($keys[$i]) == 'objectclass') {
// fix object class attribute // fix object class attribute
if ($keys[$i] != 'objectClass') { if ($keys[$i] != 'objectClass') {
@ -1463,7 +1479,13 @@ class accountContainer {
} }
} }
} }
break; }
else {
// fix aliases
if (in_array(strtolower($keys[$i]), $aliasKeys)) {
$attributes[$aliases[strtolower($keys[$i])]] = $attributes[$keys[$i]];
unset($attributes[$keys[$i]]);
}
} }
} }
return $attributes; return $attributes;

View File

@ -98,6 +98,10 @@ class inetOrgPerson extends baseModule {
$return['dependencies'] = array('depends' => array(), 'conflicts' => array()); $return['dependencies'] = array('depends' => array(), 'conflicts' => array());
// managed object classes // managed object classes
$return['objectClasses'] = array('inetOrgPerson'); $return['objectClasses'] = array('inetOrgPerson');
// LDAP aliases
$return['LDAPaliases'] = array('commonName' => 'cn', 'surname' => 'sn', 'streetAddress' => 'street',
'fax' => 'facsimileTelephoneNumber', 'gn' => 'givenName', 'userid' => 'uid', 'rfc822Mailbox' => 'mail',
'mobileTelephoneNumber' => 'mobile');
// profile elements // profile elements
$return['profile_options'] = array( $return['profile_options'] = array(
array( array(
@ -364,7 +368,7 @@ class inetOrgPerson extends baseModule {
return true; return true;
} }
} }
if ($this->attributes['sn'][0] == '') return false; if (!isset($this->attributes['sn'][0]) || ($this->attributes['sn'][0] == '')) return false;
return true; return true;
} }
@ -499,7 +503,7 @@ class inetOrgPerson extends baseModule {
if (($this->attributes['mail'][0] != '') && !get_preg($this->attributes['mail'][0], 'email')) $triggered_messages['mail'][] = $this->messages['email'][0]; if (($this->attributes['mail'][0] != '') && !get_preg($this->attributes['mail'][0], 'email')) $triggered_messages['mail'][] = $this->messages['email'][0];
if ( !get_preg($this->attributes['street'][0], 'street')) $triggered_messages['street'][] = $this->messages['street'][0]; if ( !get_preg($this->attributes['street'][0], 'street')) $triggered_messages['street'][] = $this->messages['street'][0];
if ( !get_preg($this->attributes['postalAddress'][0], 'postalAddress')) $triggered_messages['postalAdress'][] = $this->messages['postalAddress'][0]; if ( !get_preg($this->attributes['postalAddress'][0], 'postalAddress')) $triggered_messages['postalAdress'][] = $this->messages['postalAddress'][0];
if ( !get_preg($this->attributes['personal_postalCode'][0], 'postalCode')) $triggered_messages['personal_postalCode'][] = $this->messages['postalCode'][0]; if ( !get_preg($this->attributes['postalCode'][0], 'postalCode')) $triggered_messages['personal_postalCode'][] = $this->messages['postalCode'][0];
if ( !get_preg($this->attributes['title'][0], 'title')) $triggered_messages['title'][] = $this->messages['title'][0]; if ( !get_preg($this->attributes['title'][0], 'title')) $triggered_messages['title'][] = $this->messages['title'][0];
if ( !get_preg($this->attributes['employeeType'][0], 'employeeType')) $triggered_messages['employeeType'][] = $this->messages['employeeType'][0]; if ( !get_preg($this->attributes['employeeType'][0], 'employeeType')) $triggered_messages['employeeType'][] = $this->messages['employeeType'][0];
if ($post['userPassword']) { if ($post['userPassword']) {
@ -527,28 +531,38 @@ class inetOrgPerson extends baseModule {
function display_html_attributes(&$post) { function display_html_attributes(&$post) {
$modules = $_SESSION['config']->get_AccountModules($this->get_scope()); $modules = $_SESSION['config']->get_AccountModules($this->get_scope());
if (!in_array('posixAccount', $modules)) { if (!in_array('posixAccount', $modules)) {
$uid = '';
if (isset($this->attributes['uid'][0])) $uid = $this->attributes['uid'][0];
$return[] = array ( 0 => array ( 'kind' => 'text', 'text' => _('User name') . '*' ), $return[] = array ( 0 => array ( 'kind' => 'text', 'text' => _('User name') . '*' ),
1 => array ( 'kind' => 'input', 'name' => 'userName', 'type' => 'text', 'size' => '30', 1 => array ( 'kind' => 'input', 'name' => 'userName', 'type' => 'text', 'size' => '30',
'maxlength' => '255', 'value' => $this->attributes['uid'][0] ), 'maxlength' => '255', 'value' => $uid),
2 => array ('kind' => 'help', 'value' => 'uid')); 2 => array ('kind' => 'help', 'value' => 'uid'));
} }
$firstName = '';
if (isset($this->attributes['givenName'][0])) $firstName = $this->attributes['givenName'][0];
$return[] = array ( 0 => array ( 'kind' => 'text', 'text' => _('First name') ), $return[] = array ( 0 => array ( 'kind' => 'text', 'text' => _('First name') ),
1 => array ( 'kind' => 'input', 'name' => 'givenName', 'type' => 'text', 'size' => '30', 1 => array ( 'kind' => 'input', 'name' => 'givenName', 'type' => 'text', 'size' => '30',
'maxlength' => '255', 'value' => $this->attributes['givenName'][0] ), 'maxlength' => '255', 'value' => $firstName),
2 => array ('kind' => 'help', 'value' => 'givenName')); 2 => array ('kind' => 'help', 'value' => 'givenName'));
$lastName = '';
if (isset($this->attributes['sn'][0])) $lastName = $this->attributes['sn'][0];
$return[] = array ( 0 => array ( 'kind' => 'text', 'text' => _('Last name').'*' ), $return[] = array ( 0 => array ( 'kind' => 'text', 'text' => _('Last name').'*' ),
1 => array ( 'kind' => 'input', 'name' => 'sn', 'type' => 'text', 'size' => '30', 1 => array ( 'kind' => 'input', 'name' => 'sn', 'type' => 'text', 'size' => '30',
'maxlength' => '255', 'value' => $this->attributes['sn'][0] ), 'maxlength' => '255', 'value' => $lastName),
2 => array ('kind' => 'help', 'value' => 'sn')); 2 => array ('kind' => 'help', 'value' => 'sn'));
if (!in_array('posixAccount', $modules)) { if (!in_array('posixAccount', $modules)) {
$cn = '';
if (isset($this->attributes['cn'][0])) $cn = $this->attributes['cn'][0];
$return[] = array ( 0 => array ( 'kind' => 'text', 'text' => _('Common name') . '*' ), $return[] = array ( 0 => array ( 'kind' => 'text', 'text' => _('Common name') . '*' ),
1 => array ( 'kind' => 'input', 'name' => 'cn', 'type' => 'text', 'size' => '30', 1 => array ( 'kind' => 'input', 'name' => 'cn', 'type' => 'text', 'size' => '30',
'maxlength' => '255', 'value' => $this->attributes['cn'][0] ), 'maxlength' => '255', 'value' => $cn),
2 => array ('kind' => 'help', 'value' => 'cn')); 2 => array ('kind' => 'help', 'value' => 'cn'));
} }
$description = '';
if (isset($this->attributes['description'][0])) $description = $this->attributes['description'][0];
$return[] = array ( 0 => array ( 'kind' => 'text', 'text' => _('Description') ), $return[] = array ( 0 => array ( 'kind' => 'text', 'text' => _('Description') ),
1 => array ( 'kind' => 'input', 'name' => 'description', 'type' => 'text', 'size' => '30', 1 => array ( 'kind' => 'input', 'name' => 'description', 'type' => 'text', 'size' => '30',
'maxlength' => '255', 'value' => $this->attributes['description'][0] ), 'maxlength' => '255', 'value' => $description),
2 => array ('kind' => 'help', 'value' => 'description')); 2 => array ('kind' => 'help', 'value' => 'description'));
$return[] = array(0 => array('kind' => 'text', 'td' => array('colspan' => 3))); $return[] = array(0 => array('kind' => 'text', 'td' => array('colspan' => 3)));
@ -576,48 +590,68 @@ class inetOrgPerson extends baseModule {
$return[] = array(0 => array('kind' => 'text', 'td' => array('colspan' => 3))); $return[] = array(0 => array('kind' => 'text', 'td' => array('colspan' => 3)));
} }
$street = '';
if (isset($this->attributes['street'][0])) $street = $this->attributes['street'][0];
$return[] = array ( 0 => array ( 'kind' => 'text', 'text' => _('Street') ), $return[] = array ( 0 => array ( 'kind' => 'text', 'text' => _('Street') ),
1 => array ( 'kind' => 'input', 'name' => 'street', 'type' => 'text', 'size' => '30', 1 => array ( 'kind' => 'input', 'name' => 'street', 'type' => 'text', 'size' => '30',
'maxlength' => '255', 'value' => $this->attributes['street'][0] ), 'maxlength' => '255', 'value' => $street),
2 => array ('kind' => 'help', 'value' => 'street')); 2 => array ('kind' => 'help', 'value' => 'street'));
$postOffice = '';
if (isset($this->attributes['postOfficeBox'][0])) $postOffice = $this->attributes['postOfficeBox'][0];
$return[] = array ( 0 => array ( 'kind' => 'text', 'text' => _('Post office box') ), $return[] = array ( 0 => array ( 'kind' => 'text', 'text' => _('Post office box') ),
1 => array ( 'kind' => 'input', 'name' => 'postOfficeBox', 'type' => 'text', 'size' => '30', 1 => array ( 'kind' => 'input', 'name' => 'postOfficeBox', 'type' => 'text', 'size' => '30',
'maxlength' => '255', 'value' => $this->attributes['postOfficeBox'][0] ), 'maxlength' => '255', 'value' => $postOffice),
2 => array ('kind' => 'help', 'value' => 'postOfficeBox')); 2 => array ('kind' => 'help', 'value' => 'postOfficeBox'));
$postalCode = '';
if (isset($this->attributes['postalCode'][0])) $postalCode = $this->attributes['postalCode'][0];
$return[] = array ( 0 => array ( 'kind' => 'text', 'text' => _('Postal code') ), $return[] = array ( 0 => array ( 'kind' => 'text', 'text' => _('Postal code') ),
1 => array ( 'kind' => 'input', 'name' => 'postalCode', 'type' => 'text', 'size' => '30', 1 => array ( 'kind' => 'input', 'name' => 'postalCode', 'type' => 'text', 'size' => '30',
'maxlength' => '255', 'value' => $this->attributes['postalCode'][0] ), 'maxlength' => '255', 'value' => $postalCode),
2 => array ('kind' => 'help', 'value' => 'postalCode')); 2 => array ('kind' => 'help', 'value' => 'postalCode'));
$postalAddress = '';
if (isset($this->attributes['postalAddress'][0])) $postalAddress = $this->attributes['postalAddress'][0];
$return[] = array ( 0 => array ( 'kind' => 'text', 'text' => _('Postal address') ), $return[] = array ( 0 => array ( 'kind' => 'text', 'text' => _('Postal address') ),
1 => array ( 'kind' => 'input', 'name' => 'postalAddress', 'type' => 'text', 'size' => '30', 1 => array ( 'kind' => 'input', 'name' => 'postalAddress', 'type' => 'text', 'size' => '30',
'maxlength' => '255', 'value' => $this->attributes['postalAddress'][0] ), 'maxlength' => '255', 'value' => $postalAddress),
2 => array ('kind' => 'help', 'value' => 'postalAddress')); 2 => array ('kind' => 'help', 'value' => 'postalAddress'));
$telephone = '';
if (isset($this->attributes['telephoneNumber'][0])) $telephone = $this->attributes['telephoneNumber'][0];
$return[] = array ( 0 => array ( 'kind' => 'text', 'text' => _('Telephone number') ), $return[] = array ( 0 => array ( 'kind' => 'text', 'text' => _('Telephone number') ),
1 => array ( 'kind' => 'input', 'name' => 'telephoneNumber', 'type' => 'text', 'size' => '30', 1 => array ( 'kind' => 'input', 'name' => 'telephoneNumber', 'type' => 'text', 'size' => '30',
'maxlength' => '255', 'value' => $this->attributes['telephoneNumber'][0] ), 'maxlength' => '255', 'value' => $telephone),
2 => array ('kind' => 'help', 'value' => 'telephoneNumber')); 2 => array ('kind' => 'help', 'value' => 'telephoneNumber'));
$mobile = '';
if (isset($this->attributes['mobile'][0])) $mobile = $this->attributes['mobile'][0];
$return[] = array ( 0 => array ( 'kind' => 'text', 'text' => _('Mobile number') ), $return[] = array ( 0 => array ( 'kind' => 'text', 'text' => _('Mobile number') ),
1 => array ( 'kind' => 'input', 'name' => 'mobileTelephoneNumber', 'type' => 'text', 'size' => '30', 1 => array ( 'kind' => 'input', 'name' => 'mobileTelephoneNumber', 'type' => 'text', 'size' => '30',
'maxlength' => '255', 'value' => $this->attributes['mobile'][0] ), 'maxlength' => '255', 'value' => $mobile),
2 => array ('kind' => 'help', 'value' => 'mobileTelephoneNumber')); 2 => array ('kind' => 'help', 'value' => 'mobileTelephoneNumber'));
$fax = '';
if (isset($this->attributes['facsimileTelephoneNumber'][0])) $fax = $this->attributes['facsimileTelephoneNumber'][0];
$return[] = array ( 0 => array ( 'kind' => 'text', 'text' => _('Fax number') ), $return[] = array ( 0 => array ( 'kind' => 'text', 'text' => _('Fax number') ),
1 => array ( 'kind' => 'input', 'name' => 'facsimileTelephoneNumber', 'type' => 'text', 'size' => '30', 1 => array ( 'kind' => 'input', 'name' => 'facsimileTelephoneNumber', 'type' => 'text', 'size' => '30',
'maxlength' => '255', 'value' => $this->attributes['facsimileTelephoneNumber'][0] ), 'maxlength' => '255', 'value' => $fax),
2 => array ('kind' => 'help', 'value' => 'facsimileTelephoneNumber')); 2 => array ('kind' => 'help', 'value' => 'facsimileTelephoneNumber'));
$email = '';
if (isset($this->attributes['mail'][0])) $email = $this->attributes['mail'][0];
$return[] = array ( 0 => array ( 'kind' => 'text', 'text' => _('eMail address') ), $return[] = array ( 0 => array ( 'kind' => 'text', 'text' => _('eMail address') ),
1 => array ( 'kind' => 'input', 'name' => 'mail', 'type' => 'text', 'size' => '30', 1 => array ( 'kind' => 'input', 'name' => 'mail', 'type' => 'text', 'size' => '30',
'maxlength' => '255', 'value' => $this->attributes['mail'][0] ), 'maxlength' => '255', 'value' => $email),
2 => array ('kind' => 'help', 'value' => 'mail')); 2 => array ('kind' => 'help', 'value' => 'mail'));
$return[] = array(0 => array('kind' => 'text', 'td' => array('colspan' => 3))); $return[] = array(0 => array('kind' => 'text', 'td' => array('colspan' => 3)));
$title = '';
if (isset($this->attributes['title'][0])) $title = $this->attributes['title'][0];
$return[] = array ( 0 => array ( 'kind' => 'text', 'text' => _('Job title') ), $return[] = array ( 0 => array ( 'kind' => 'text', 'text' => _('Job title') ),
1 => array ( 'kind' => 'input', 'name' => 'title', 'type' => 'text', 'size' => '30', 1 => array ( 'kind' => 'input', 'name' => 'title', 'type' => 'text', 'size' => '30',
'value' => $this->attributes['title'][0] ), 'value' => $title),
2 => array ('kind' => 'help', 'value' => 'title')); 2 => array ('kind' => 'help', 'value' => 'title'));
$employeeType = '';
if (isset($this->attributes['employeeType'][0])) $employeeType = $this->attributes['employeeType'][0];
$return[] = array ( 0 => array ( 'kind' => 'text', 'text' => _('Employee type') ), $return[] = array ( 0 => array ( 'kind' => 'text', 'text' => _('Employee type') ),
1 => array ( 'kind' => 'input', 'name' => 'employeeType', 'type' => 'text', 'size' => '30', 1 => array ( 'kind' => 'input', 'name' => 'employeeType', 'type' => 'text', 'size' => '30',
'maxlength' => '255', 'value' => $this->attributes['employeeType'][0] ), 'maxlength' => '255', 'value' => $employeeType),
2 => array ('kind' => 'help', 'value' => 'employeeType')); 2 => array ('kind' => 'help', 'value' => 'employeeType'));
if (isset($this->attributes['host'])) { if (isset($this->attributes['host'])) {
$hostvalue = ""; $hostvalue = "";
@ -636,7 +670,7 @@ class inetOrgPerson extends baseModule {
usort($dnUsers, array($_SESSION['ldap'], 'cmp_array')); usort($dnUsers, array($_SESSION['ldap'], 'cmp_array'));
array_unshift($dnUsers, '-'); array_unshift($dnUsers, '-');
$optionsSelected = array(); $optionsSelected = array();
if ($this->attributes['manager'][0]) { if (isset($this->attributes['manager'][0])) {
$optionsSelected[] = $this->attributes['manager'][0]; $optionsSelected[] = $this->attributes['manager'][0];
} }
else { else {

View File

@ -125,6 +125,8 @@ class posixAccount extends baseModule {
$return["RDN"] = array("uid" => "normal", "cn" => "low"); $return["RDN"] = array("uid" => "normal", "cn" => "low");
// managed object classes // managed object classes
$return['objectClasses'] = array('posixAccount'); $return['objectClasses'] = array('posixAccount');
// LDAP aliases
$return['LDAPaliases'] = array('commonName' => 'cn');
// PHP extensions // PHP extensions
$return['extensions'] = array('mhash'); $return['extensions'] = array('mhash');
// profile checks // profile checks

View File

@ -309,6 +309,8 @@ class posixGroup extends baseModule {
$return['dependencies'] = array('depends' => array(), 'conflicts' => array()); $return['dependencies'] = array('depends' => array(), 'conflicts' => array());
// managed object classes // managed object classes
$return['objectClasses'] = array('posixGroup'); $return['objectClasses'] = array('posixGroup');
// LDAP aliases
$return['LDAPaliases'] = array('commonName' => 'cn');
// configuration options // configuration options
$return['config_options']['group'] = array( $return['config_options']['group'] = array(
array( array(