added getRDNAttributes()
This commit is contained in:
parent
5aaab188d9
commit
921a0e1639
|
@ -120,7 +120,34 @@ The resulting LDAP filter will look like this:
|
||||||
is only used for base modules. Standard modules do not need to
|
is only used for base modules. Standard modules do not need to
|
||||||
implement it.</span><br>
|
implement it.</span><br>
|
||||||
<br>
|
<br>
|
||||||
<h3>2.1.5. get_dependencies*</h3>
|
<h3>2.1.5. get_RDNAttributes*</h3>
|
||||||
|
<br>
|
||||||
|
<table style="text-align: left; width: 300px; height: 30px;" border="0"
|
||||||
|
cellspacing="2" cellpadding="2">
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td
|
||||||
|
style="vertical-align: top; background-color: rgb(204, 204, 204); text-align: center;"><span
|
||||||
|
style="font-weight: bold;">function get_RDNAttributes()</span><br>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<br>
|
||||||
|
Returns a hash array containing a list of possible LDAP attributes that
|
||||||
|
can be used to form the RDN (Relative Distinguished Name).<br>
|
||||||
|
<span style="font-weight: bold;"></span><br>
|
||||||
|
The keys of the array are the LDAP attributes, the values are the
|
||||||
|
priority <span style="font-style: italic;">("low"/"normal"/"high")</span>.<br>
|
||||||
|
Attributes with higher priority are placed higher in the drop down box
|
||||||
|
for the RDN selection.<br>
|
||||||
|
<br>
|
||||||
|
<span style="font-weight: bold;">Example: <span
|
||||||
|
style="font-style: italic;">return "('uid' =>
|
||||||
|
'normal', 'cn' => 'low')"</span></span><br>
|
||||||
|
<br>
|
||||||
|
<span style="font-weight: bold; color: rgb(255, 0, 0);"></span><br>
|
||||||
|
<h3>2.1.6. get_dependencies*</h3>
|
||||||
<br>
|
<br>
|
||||||
<table cellpadding="2" cellspacing="2" border="0"
|
<table cellpadding="2" cellspacing="2" border="0"
|
||||||
style="text-align: left; width: 300px; font-weight: bold;">
|
style="text-align: left; width: 300px; font-weight: bold;">
|
||||||
|
@ -151,7 +178,7 @@ your module depends on one of these modules.<br>
|
||||||
=> array("exim"));</span><br
|
=> array("exim"));</span><br
|
||||||
style="font-weight: bold; font-style: italic;">
|
style="font-weight: bold; font-style: italic;">
|
||||||
<br>
|
<br>
|
||||||
<h3>2.1.6. get_metaData()</h3>
|
<h3>2.1.7. get_metaData()</h3>
|
||||||
<br>
|
<br>
|
||||||
<table cellpadding="2" cellspacing="2" border="0"
|
<table cellpadding="2" cellspacing="2" border="0"
|
||||||
style="text-align: left; width: 300px;">
|
style="text-align: left; width: 300px;">
|
||||||
|
@ -170,7 +197,7 @@ Returns an hash array including meta data for the baseModule.<br>
|
||||||
<span style="font-weight: bold;">Example: return array("is_base" =>
|
<span style="font-weight: bold;">Example: return array("is_base" =>
|
||||||
true);</span><br style="font-weight: bold;">
|
true);</span><br style="font-weight: bold;">
|
||||||
<br>
|
<br>
|
||||||
<h3>2.1.7. get_configOptions()*</h3>
|
<h3>2.1.8. get_configOptions()*</h3>
|
||||||
<br>
|
<br>
|
||||||
<table cellpadding="2" cellspacing="2" border="0"
|
<table cellpadding="2" cellspacing="2" border="0"
|
||||||
style="text-align: left; width: 300px;">
|
style="text-align: left; width: 300px;">
|
||||||
|
@ -198,7 +225,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.8. get_configDescriptions()*</h3>
|
<h3>2.1.9. get_configDescriptions()*</h3>
|
||||||
<br>
|
<br>
|
||||||
<table cellpadding="2" cellspacing="2" border="0"
|
<table cellpadding="2" cellspacing="2" border="0"
|
||||||
style="text-align: left; width: 300px;">
|
style="text-align: left; width: 300px;">
|
||||||
|
@ -225,7 +252,7 @@ array with this format:<br>
|
||||||
'descriptions' => array('option1'
|
'descriptions' => array('option1'
|
||||||
=> 'description1', ...))</span><br>
|
=> 'description1', ...))</span><br>
|
||||||
<br>
|
<br>
|
||||||
<h3>2.1.9. check_configOptions*</h3>
|
<h3>2.1.10. check_configOptions*</h3>
|
||||||
<br>
|
<br>
|
||||||
<table style="text-align: left; width: 400px; height: 30px;" border="0"
|
<table style="text-align: left; width: 400px; height: 30px;" border="0"
|
||||||
cellspacing="2" cellpadding="2">
|
cellspacing="2" cellpadding="2">
|
||||||
|
@ -255,7 +282,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.10. get_scope()</h3>
|
<h3>2.1.11. get_scope()</h3>
|
||||||
<br>
|
<br>
|
||||||
<table cellpadding="2" cellspacing="2" border="0"
|
<table cellpadding="2" cellspacing="2" border="0"
|
||||||
style="text-align: left; width: 300px;">
|
style="text-align: left; width: 300px;">
|
||||||
|
@ -276,7 +303,8 @@ baseModule and should not be overwritten.</span><br>
|
||||||
<br>
|
<br>
|
||||||
<br>
|
<br>
|
||||||
<br>
|
<br>
|
||||||
<h3>2.2. Class functions</h3>
|
<h3>2.2. Functions which are called inside of an account container<br>
|
||||||
|
</h3>
|
||||||
<h3>2.2.1. init</h3>
|
<h3>2.2.1. init</h3>
|
||||||
<br>
|
<br>
|
||||||
<table cellpadding="2" cellspacing="2" border="0"
|
<table cellpadding="2" cellspacing="2" border="0"
|
||||||
|
@ -685,7 +713,16 @@ array("user", "host")</span><br style="font-weight: bold;">
|
||||||
'objectClass=posixAccount', 'and' => '(!(uid=*$))')<br>
|
'objectClass=posixAccount', 'and' => '(!(uid=*$))')<br>
|
||||||
<br>
|
<br>
|
||||||
</span>
|
</span>
|
||||||
<h3>6.4 get_dependencies()<br>
|
<h3>6.4 get_RDNAttributes()</h3>
|
||||||
|
"RDN" => array<br>
|
||||||
|
<br>
|
||||||
|
<span style="font-weight: bold;"> Example:</span><span
|
||||||
|
style="font-style: italic; font-weight: bold;"> array('uid' =>
|
||||||
|
'normal', 'cn' => 'low')<br>
|
||||||
|
<br>
|
||||||
|
</span>
|
||||||
|
<span style="font-style: italic; font-weight: bold;"></span>
|
||||||
|
<h3>6.5 get_dependencies()<br>
|
||||||
</h3>
|
</h3>
|
||||||
"dependencies" => array<br>
|
"dependencies" => array<br>
|
||||||
<br>
|
<br>
|
||||||
|
@ -697,7 +734,7 @@ array("user", "host")</span><br style="font-weight: bold;">
|
||||||
=> array("exim")</span></span><span
|
=> 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.5 get_profileOptions()<br>
|
<h3>6.6 get_profileOptions()<br>
|
||||||
</h3>
|
</h3>
|
||||||
"profile_options" => array<br>
|
"profile_options" => array<br>
|
||||||
<br>
|
<br>
|
||||||
|
@ -706,7 +743,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.6 check_profileOptions()<br>
|
<h3>6.7 check_profileOptions()<br>
|
||||||
</h3>
|
</h3>
|
||||||
"profile_checks" => array<br>
|
"profile_checks" => array<br>
|
||||||
<br>
|
<br>
|
||||||
|
@ -781,7 +818,7 @@ head, 2 => message text, 3 => additional variables)</li>
|
||||||
</ul>
|
</ul>
|
||||||
</ul>
|
</ul>
|
||||||
<br>
|
<br>
|
||||||
<h3>6.7 get_configOptions()<br>
|
<h3>6.8 get_configOptions()<br>
|
||||||
</h3>
|
</h3>
|
||||||
"config_options" => array('user' => array,
|
"config_options" => array('user' => array,
|
||||||
'host' => array, 'all' => array)<br>
|
'host' => array, 'all' => array)<br>
|
||||||
|
@ -797,7 +834,7 @@ the
|
||||||
return value of get_configOptions().<br>
|
return value of get_configOptions().<br>
|
||||||
<br>
|
<br>
|
||||||
</span></span>
|
</span></span>
|
||||||
<h3>6.8 get_configDescriptions()<br>
|
<h3>6.9 get_configDescriptions()<br>
|
||||||
</h3>
|
</h3>
|
||||||
"config_descriptions" => array<br>
|
"config_descriptions" => array<br>
|
||||||
<br>
|
<br>
|
||||||
|
@ -806,7 +843,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.9 check_configOptions()<br>
|
<h3>6.10 check_configOptions()<br>
|
||||||
</h3>
|
</h3>
|
||||||
"config_checks" => array('user' => array,
|
"config_checks" => array('user' => array,
|
||||||
'host' => 'array', 'all' => array)<br>
|
'host' => 'array', 'all' => array)<br>
|
||||||
|
|
|
@ -189,6 +189,20 @@ class baseModule {
|
||||||
else return get_class($this);
|
else return get_class($this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a list of possible LDAP attributes which can be used to form the RDN.
|
||||||
|
*
|
||||||
|
* The returned elements have this form: <attribute> => <priority>
|
||||||
|
* <br> <attribute> is the name of the LDAP attribute
|
||||||
|
* <br> <priority> defines the priority of the attribute (can be "low", "normal", "high")
|
||||||
|
*
|
||||||
|
* @return array list of attributes
|
||||||
|
*/
|
||||||
|
function get_RDNAttributes() {
|
||||||
|
if (isset($this->meta['RDN'])) return $this->meta['RDN'];
|
||||||
|
else return array();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function returns a list with all depending and conflicting modules.
|
* This function returns a list with all depending and conflicting modules.
|
||||||
*
|
*
|
||||||
|
@ -489,7 +503,6 @@ class baseModule {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO implement missing interface
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -115,6 +115,51 @@ function get_ldap_filter($scope) {
|
||||||
else return "(&" . implode("", $filters['and']) . ")";
|
else return "(&" . implode("", $filters['and']) . ")";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a list of LDAP attributes which can be used to form the RDN.
|
||||||
|
*
|
||||||
|
* The list is already sorted by the priority given by the nodules.
|
||||||
|
*
|
||||||
|
* @param string $scope account type (user, group, host)
|
||||||
|
* @return array list of LDAP attributes
|
||||||
|
*/
|
||||||
|
function getRDNAttributes($scope) {
|
||||||
|
$mods = getAvailableModules($scope);
|
||||||
|
$return = array();
|
||||||
|
$attrs_low = array();
|
||||||
|
$attrs_normal = array();
|
||||||
|
$attrs_high = array();
|
||||||
|
for ($i = 0; $i < sizeof($mods); $i++) {
|
||||||
|
// get list of attributes
|
||||||
|
$module = new $mods[$i]($scope);
|
||||||
|
$attrs = $module->get_RDNAttributes();
|
||||||
|
$keys = array_keys($attrs);
|
||||||
|
// sort attributes
|
||||||
|
for ($k = 0; $k < sizeof($keys); $k++) {
|
||||||
|
switch ($attrs[$keys[$k]]) {
|
||||||
|
case "low":
|
||||||
|
$attrs_low[] = $keys[$k];
|
||||||
|
break;
|
||||||
|
case "normal":
|
||||||
|
$attrs_normal[] = $keys[$k];
|
||||||
|
break;
|
||||||
|
case "high":
|
||||||
|
$attrs_high[] = $keys[$k];
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
$attrs_low[] = $keys[$k];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// merge arrays
|
||||||
|
$return = $attrs_high;
|
||||||
|
for ($i = 0; $i < sizeof($attrs_normal); $i++) $return[] = $attrs_normal[$i];
|
||||||
|
for ($i = 0; $i < sizeof($attrs_low); $i++) $return[] = $attrs_low[$i];
|
||||||
|
$return = array_values(array_unique($return));
|
||||||
|
return $return;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a hash array (module name => dependencies) of all user module dependencies
|
* Returns a hash array (module name => dependencies) of all user module dependencies
|
||||||
*
|
*
|
||||||
|
|
|
@ -73,6 +73,8 @@ class inetOrgPerson extends baseModule {
|
||||||
$return["account_types"] = array("user");
|
$return["account_types"] = array("user");
|
||||||
// alias name
|
// alias name
|
||||||
$return["alias"] = _('Personal');
|
$return["alias"] = _('Personal');
|
||||||
|
// RDN attribute
|
||||||
|
$return["RDN"] = array("cn" => "low");
|
||||||
// module dependencies
|
// module dependencies
|
||||||
$return['dependencies'] = array('depends' => array('posixAccount'), 'conflicts' => array('account'));
|
$return['dependencies'] = array('depends' => array('posixAccount'), 'conflicts' => array('account'));
|
||||||
// profile elements
|
// profile elements
|
||||||
|
|
|
@ -101,6 +101,8 @@ class posixAccount extends baseModule {
|
||||||
}
|
}
|
||||||
// alias name
|
// alias name
|
||||||
$return["alias"] = _("Unix");
|
$return["alias"] = _("Unix");
|
||||||
|
// RDN attributes
|
||||||
|
$return["RDN"] = array("uid" => "normal", "cn" => "low");
|
||||||
// profile checks
|
// profile checks
|
||||||
$return['profile_checks']['posixAccount_homeDirectory'] = array('type' => 'regex_i', 'regex' => 'homeDirectory',
|
$return['profile_checks']['posixAccount_homeDirectory'] = array('type' => 'regex_i', 'regex' => 'homeDirectory',
|
||||||
'error_message' => $this->messages['homeDirectory'][0]);
|
'error_message' => $this->messages['homeDirectory'][0]);
|
||||||
|
|
|
@ -230,6 +230,8 @@ class posixGroup extends baseModule {
|
||||||
}
|
}
|
||||||
// alias name
|
// alias name
|
||||||
$return["alias"] = _('Unix');
|
$return["alias"] = _('Unix');
|
||||||
|
// RDN attribute
|
||||||
|
$return["RDN"] = array("cn" => "normal");
|
||||||
// module dependencies
|
// module dependencies
|
||||||
$return['dependencies'] = array('depends' => array(), 'conflicts' => array('inetOrgPerson', 'account', 'sambaDomain'));
|
$return['dependencies'] = array('depends' => array(), 'conflicts' => array('inetOrgPerson', 'account', 'sambaDomain'));
|
||||||
// configuration options
|
// configuration options
|
||||||
|
|
Loading…
Reference in New Issue