added meta data for get_ldap_filter()

This commit is contained in:
Roland Gruber 2004-06-11 15:44:49 +00:00
parent f1722aaee8
commit 44e3cfce7c
7 changed files with 87 additions and 40 deletions

View File

@ -17,10 +17,11 @@ E.g. if you create a new module and its class name is "qmail" then the
filename would be "qmail.inc".<br>
<br>
The class name of a module must contain only a-z, A-Z, 0-9, -, and _.<br>
<br>
All module classes should extend the baseModule class.<br>
<br>
<h2>2. Class functions</h2>
<h3>2.1. Static functions</h3>
<h3>2.1. Functions that have to work without superior accountContainer<br>
</h3>
These functions are called without instanciating an object of the
module class. They must not depend on class variables and are only
allowed to call other static functions.<br>
@ -69,7 +70,7 @@ a-z, A-Z, 0-9, -, _ and spaces.<br>
The <span style="font-weight: bold;">$scope</span> parameter defines
the account type ("user", "group", "host" at this time).<br>
<br>
<h3>2.1.3. is_base_module</h3>
<h3>2.1.3. is_base_module*</h3>
<br>
<table style="text-align: left; width: 300px; height: 30px;" border="0"
cellspacing="2" cellpadding="2">
@ -77,7 +78,7 @@ the account type ("user", "group", "host" at this time).<br>
<tr>
<td
style="vertical-align: top; background-color: rgb(204, 204, 204); text-align: center;"><span
style="font-weight: bold;">function is_base_module($scope)</span><br>
style="font-weight: bold;">function is_base_module()</span><br>
</td>
</tr>
</tbody>
@ -85,16 +86,14 @@ the account type ("user", "group", "host" at this time).<br>
<br>
Returns <span style="font-weight: bold;">true</span> if your module is
a base module and otherwise <span style="font-weight: bold;">false</span>.<br>
<span style="font-weight: bold;">$scope</span> is the account type
("user", "group", "host" at this time).<br>
<br>
<span style="font-weight: bold;"></span><br>
Every account type needs at least one base module. A base module
defines a full qualified account.<br>
E.g. modules that use the object class posixAccount may be base modules
as it makes sense to manage these Unix accounts. On the other hand the
quota module is no base module as it needs posixAccount.<br>
<br>
<h3>2.1.4. get_ldap_filter</h3>
<h3>2.1.4. get_ldap_filter*</h3>
<br>
<table style="text-align: left; width: 300px; height: 30px;" border="0"
cellspacing="2" cellpadding="2">
@ -160,6 +159,43 @@ your module depends on one of these modules.<br>
=&gt; array("exim"));</span><br
style="font-weight: bold; font-style: italic;">
<br>
<h3>2.1.6. get_metaData()</h3>
<br>
<table cellpadding="2" cellspacing="2" border="0"
style="text-align: left; width: 300px;">
<tbody>
<tr>
<td
style="vertical-align: top; background-color: rgb(204, 204, 204); text-align: center;"><span
style="font-weight: bold;">function get_metaData()</span><br>
</td>
</tr>
</tbody>
</table>
<br>
Returns an hash array including meta data for the baseModule.<br>
<br>
<span style="font-weight: bold;">Example: return array("is_base" =&gt;
true);</span><br style="font-weight: bold;">
<br>
<h3>2.1.7. get_scope()</h3>
<br>
<table cellpadding="2" cellspacing="2" border="0"
style="text-align: left; width: 300px;">
<tbody>
<tr>
<td
style="vertical-align: top; background-color: rgb(204, 204, 204); text-align: center;"><span
style="font-weight: bold;">function get_scope()</span><br>
</td>
</tr>
</tbody>
</table>
<br>
Returns the account type (user/group/host) of this module object.<br>
<span style="font-weight: bold;"></span><br>
<span style="font-weight: bold;">This function is provided by the
baseModule and should not be overwritten.</span><br>
<br>
<h3>2.2. Class functions</h3>
<h3>2.2.1. Constructor</h3>
@ -245,7 +281,7 @@ It must return the help entry as array for the submitted help
identifier. The format of the array to be returned is described in
section 4. "Help entry syntax".<br>
<br>
<h3>2.1.5. get_profileOptions</h3>
<h3>2.2.5. get_profileOptions</h3>
<br>
<table cellpadding="2" cellspacing="2" border="0"
style="text-align: left; width: 300px; height: 30px;">
@ -273,7 +309,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
naming confilcts.<br>
<br>
<h3>2.1.6. check_profileOptions</h3>
<h3>2.2.6. check_profileOptions</h3>
<br>
<table style="text-align: left; width: 400px; height: 30px;" border="0"
cellspacing="2" cellpadding="2">
@ -326,6 +362,10 @@ user to decide which fields are to be displayed on the PDF file. The
format of the array to be returned is described in section 5. "PDF
syntax".<br>
<br>
<br>
<span style="font-weight: bold;">*: These functions do not need to be
implemented if meta data is supplied. See 6 for a list of meta data
formats.</span><br>
<h3><br>
</h3>
<h2>3. Meta HTML code</h2>
@ -515,5 +555,17 @@ which should be displayed when this help entry is called.
<h3><br>
</h3>
<h2>5. PDF syntax</h2>
<br>
<br>
<h2>6. Module meta data</h2>
<h3>6.1 is_base_module()</h3>
&nbsp;&nbsp;&nbsp; "is_base" =&gt; boolean<br>
<br>
<h3>6.2 get_ldap_filter()</h3>
&nbsp;&nbsp;&nbsp; "ldap_filter" =&gt; array<br>
<br>
<span style="font-weight: bold;">&nbsp;&nbsp; Example:</span><span
style="font-style: italic; font-weight: bold;"> array('or' =&gt;
'objectClass=posixAccount', 'and' =&gt; '(!(uid=*$))')</span>
</body>
</html>

View File

@ -85,6 +85,16 @@ class baseModule {
else return false;
}
/**
* returns an LDAP filter for the account lists
*
* @return string LDAP filter
*/
function get_ldap_filter() {
if (isset($this->meta['ldap_filter'])) return $this->meta['ldap_filter'];
else return "";
}
// TODO implement missing interface
}

View File

@ -72,7 +72,8 @@ function get_ldap_filter($scope) {
$orFilter = '';
for ($i = 0; $i < sizeof($mods); $i++) {
if (is_base_module($mods[$i], $scope)) {
$modinfo = call_user_func(array($mods[$i], "get_ldap_filter"), $scope);
$module = new $mods[$i]($scope);
$modinfo = $module->get_ldap_filter();
if (isset($modinfo['or'])) $filters['or'][] = $modinfo['or'];
if (isset($modinfo['and'])) $filters['and'][] = $modinfo['and'];
}

View File

@ -62,7 +62,10 @@ class posixAccount extends baseModule {
function get_metaData() {
$return = array();
if ($this->get_scope() == "user") {
// this is a base module
$return["is_base"] = true;
// LDAP filter
$return["ldap_filter"] = array('or' => "(objectClass=posixAccount)", 'and' => "(!(uid=*$))");
}
return $return;
}
@ -153,13 +156,6 @@ class posixAccount extends baseModule {
else return false;
}
// returns an LDAP filter for the account lists
// $scope: the account type ("user", "group", "host")
function get_ldap_filter($scope) {
if ($scope == "user") return array('or' => "(objectClass=posixAccount)", 'and' => "(!(uid=*$))");
else return false;
}
/* This function returns a list with all required modules
*/
function get_dependencies($scope) {

View File

@ -62,7 +62,10 @@ class posixGroup extends baseModule {
function get_metaData() {
$return = array();
if ($this->get_scope() == "group") {
// this is a base module
$return["is_base"] = true;
// LDAP filter
$return["ldap_filter"] = array('or' => "(objectClass=posixGroup)");
}
return $return;
}
@ -142,13 +145,6 @@ class posixGroup extends baseModule {
else return false;
}
// returns an LDAP filter for the account lists
// $scope: the account type ("user", "group", "host")
function get_ldap_filter($scope) {
if ($scope == "group") return array('or' => "(objectClass=posixGroup)");
else return false;
}
/* This function returns a list with all required modules
*/
function get_dependencies($scope) {

View File

@ -62,7 +62,10 @@ class sambaAccount extends baseModule {
function get_metaData() {
$return = array();
if ($this->get_scope() == "host") {
// this is a base module
$return["is_base"] = true;
// LDAP filter
$return["ldap_filter"] = array('and' => '(uid=*$)', 'or' => "(objectClass=posixAccount)");
}
return $return;
}
@ -146,13 +149,6 @@ class sambaAccount extends baseModule {
else return false;
}
// returns an LDAP filter for the account lists
// $scope: the account type ("user", "group", "host")
function get_ldap_filter($scope) {
if ($scope == "host") return array('and' => '(uid=*$)', 'or' => "(objectClass=posixAccount)");
else return false;
}
/* This function returns a list with all required modules
*/
function get_dependencies($scope) {

View File

@ -62,7 +62,10 @@ class sambaSamAccount extends baseModule {
function get_metaData() {
$return = array();
if ($this->get_scope() == "host") {
// this is a base module
$return["is_base"] = true;
// LDAP filter
$return["ldap_filter"] = array('and' => '(uid=*$)', 'or' => "(objectClass=posixAccount)");
}
return $return;
}
@ -146,14 +149,7 @@ class sambaSamAccount extends baseModule {
else return false;
}
// returns an LDAP filter for the account lists
// $scope: the account type ("user", "group", "host")
function get_ldap_filter($scope) {
if ($scope == "host") return array('and' => '(uid=*$)', 'or' => "(objectClass=posixAccount)");
else return false;
}
/* This function returns a list with all required modules
/* This function returns a list with all required modules
*/
function get_dependencies($scope) {
if ($scope=='host') return array('depends' => array('posixAccount'), 'conflicts' => array() );