diff --git a/lam/docs/modules-specification.htm b/lam/docs/modules-specification.htm
index 6bf5b710..fb7871d8 100644
--- a/lam/docs/modules-specification.htm
+++ b/lam/docs/modules-specification.htm
@@ -120,7 +120,34 @@ The resulting LDAP filter will look like this:
is only used for base modules. Standard modules do not need to
implement it.
-
2.1.5. get_dependencies*
+2.1.5. get_RDNAttributes*
+
+
+
+
+ function get_RDNAttributes()
+ |
+
+
+
+
+Returns a hash array containing a list of possible LDAP attributes that
+can be used to form the RDN (Relative Distinguished Name).
+
+The keys of the array are the LDAP attributes, the values are the
+priority ("low"/"normal"/"high").
+Attributes with higher priority are placed higher in the drop down box
+for the RDN selection.
+
+Example: return "('uid' =>
+'normal', 'cn' => 'low')"
+
+
+2.1.6. get_dependencies*
@@ -151,7 +178,7 @@ your module depends on one of these modules.
=> array("exim"));
-2.1.6. get_metaData()
+2.1.7. get_metaData()
@@ -170,7 +197,7 @@ Returns an hash array including meta data for the baseModule.
Example: return array("is_base" =>
true);
-2.1.7. get_configOptions()*
+2.1.8. get_configOptions()*
@@ -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
naming confilcts.
-2.1.8. get_configDescriptions()*
+2.1.9. get_configDescriptions()*
@@ -225,7 +252,7 @@ array with this format:
'descriptions' => array('option1'
=> 'description1', ...))
-2.1.9. check_configOptions*
+2.1.10. check_configOptions*
@@ -255,7 +282,7 @@ If no errors occured the function returns an empty array.
-2.1.10. get_scope()
+2.1.11. get_scope()
@@ -276,7 +303,8 @@ baseModule and should not be overwritten.
-2.2. Class functions
+2.2. Functions which are called inside of an account container
+
2.2.1. init
'objectClass=posixAccount', 'and' => '(!(uid=*$))')
-6.4 get_dependencies()
+6.4 get_RDNAttributes()
+ "RDN" => array
+
+ Example: array('uid' =>
+'normal', 'cn' => 'low')
+
+
+
+6.5 get_dependencies()
"dependencies" => array
@@ -697,7 +734,7 @@ array("user", "host")
=> array("exim"))
-6.5 get_profileOptions()
+6.6 get_profileOptions()
"profile_options" => array
@@ -706,7 +743,7 @@ array("user", "host")
return value of get_profileOptions().
-6.6 check_profileOptions()
+6.7 check_profileOptions()
"profile_checks" => array
@@ -781,7 +818,7 @@ head, 2 => message text, 3 => additional variables)
-6.7 get_configOptions()
+6.8 get_configOptions()
"config_options" => array('user' => array,
'host' => array, 'all' => array)
@@ -797,7 +834,7 @@ the
return value of get_configOptions().
-6.8 get_configDescriptions()
+6.9 get_configDescriptions()
"config_descriptions" => array
@@ -806,7 +843,7 @@ return value of get_configOptions().
return value of get_configDescriptions().
-6.9 check_configOptions()
+6.10 check_configOptions()
"config_checks" => array('user' => array,
'host' => 'array', 'all' => array)
diff --git a/lam/lib/baseModule.inc b/lam/lib/baseModule.inc
index 1efabc42..11ff4b9b 100644
--- a/lam/lib/baseModule.inc
+++ b/lam/lib/baseModule.inc
@@ -189,6 +189,20 @@ class baseModule {
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: =>
+ *
is the name of the LDAP attribute
+ *
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.
*
@@ -489,7 +503,6 @@ class baseModule {
}
}
-// TODO implement missing interface
}
diff --git a/lam/lib/modules.inc b/lam/lib/modules.inc
index f37feacf..4caacde6 100644
--- a/lam/lib/modules.inc
+++ b/lam/lib/modules.inc
@@ -115,6 +115,51 @@ function get_ldap_filter($scope) {
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
*
diff --git a/lam/lib/modules/inetOrgPerson.inc b/lam/lib/modules/inetOrgPerson.inc
index c15c5db4..90396ae5 100644
--- a/lam/lib/modules/inetOrgPerson.inc
+++ b/lam/lib/modules/inetOrgPerson.inc
@@ -73,6 +73,8 @@ class inetOrgPerson extends baseModule {
$return["account_types"] = array("user");
// alias name
$return["alias"] = _('Personal');
+ // RDN attribute
+ $return["RDN"] = array("cn" => "low");
// module dependencies
$return['dependencies'] = array('depends' => array('posixAccount'), 'conflicts' => array('account'));
// profile elements
diff --git a/lam/lib/modules/posixAccount.inc b/lam/lib/modules/posixAccount.inc
index dba2f63a..c52f6744 100644
--- a/lam/lib/modules/posixAccount.inc
+++ b/lam/lib/modules/posixAccount.inc
@@ -101,6 +101,8 @@ class posixAccount extends baseModule {
}
// alias name
$return["alias"] = _("Unix");
+ // RDN attributes
+ $return["RDN"] = array("uid" => "normal", "cn" => "low");
// profile checks
$return['profile_checks']['posixAccount_homeDirectory'] = array('type' => 'regex_i', 'regex' => 'homeDirectory',
'error_message' => $this->messages['homeDirectory'][0]);
diff --git a/lam/lib/modules/posixGroup.inc b/lam/lib/modules/posixGroup.inc
index 0eca62dd..2714548a 100644
--- a/lam/lib/modules/posixGroup.inc
+++ b/lam/lib/modules/posixGroup.inc
@@ -230,6 +230,8 @@ class posixGroup extends baseModule {
}
// alias name
$return["alias"] = _('Unix');
+ // RDN attribute
+ $return["RDN"] = array("cn" => "normal");
// module dependencies
$return['dependencies'] = array('depends' => array(), 'conflicts' => array('inetOrgPerson', 'account', 'sambaDomain'));
// configuration options