moved dependencies to meta data
This commit is contained in:
parent
6ce5f9d1d3
commit
1da244e2b3
|
@ -95,7 +95,7 @@ quota module is no base module as it needs posixAccount.<br>
|
||||||
<tr>
|
<tr>
|
||||||
<td
|
<td
|
||||||
style="vertical-align: top; background-color: rgb(204, 204, 204); text-align: center;"><span
|
style="vertical-align: top; background-color: rgb(204, 204, 204); text-align: center;"><span
|
||||||
style="font-weight: bold;">function get_ldap_filter($scope)</span><br>
|
style="font-weight: bold;">function get_ldap_filter()</span><br>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
|
@ -104,9 +104,7 @@ quota module is no base module as it needs posixAccount.<br>
|
||||||
Returns an array('or' => '...', 'and' => '...') that is used to
|
Returns an array('or' => '...', 'and' => '...') that is used to
|
||||||
build the LDAP filter. Usually
|
build the LDAP filter. Usually
|
||||||
used to filter object classes.<br>
|
used to filter object classes.<br>
|
||||||
<span style="font-weight: bold;">$scope</span> is the account type
|
<span style="font-weight: bold;"></span><br>
|
||||||
("user", "group", "host" at this time).<br>
|
|
||||||
<br>
|
|
||||||
All "or" filter parts of the base modules are combined with OR and then
|
All "or" filter parts of the base modules are combined with OR and then
|
||||||
combined with the "and" parts.<br>
|
combined with the "and" parts.<br>
|
||||||
The resulting LDAP filter will look like this:
|
The resulting LDAP filter will look like this:
|
||||||
|
@ -114,7 +112,7 @@ The resulting LDAP filter will look like this:
|
||||||
<br>
|
<br>
|
||||||
<span style="font-weight: bold;">Example: <span
|
<span style="font-weight: bold;">Example: <span
|
||||||
style="font-style: italic;">return "('or' =>
|
style="font-style: italic;">return "('or' =>
|
||||||
'objectClass=posixAccount', 'and' => '(!(uid=*$))')"</span></span><br>
|
'(objectClass=posixAccount)', 'and' => '(!(uid=*$))')"</span></span><br>
|
||||||
<br>
|
<br>
|
||||||
<span style="font-weight: bold; color: rgb(255, 0, 0);">This function
|
<span style="font-weight: bold; color: rgb(255, 0, 0);">This function
|
||||||
is only used for base modules. Standard modules do not need to
|
is only used for base modules. Standard modules do not need to
|
||||||
|
@ -128,15 +126,13 @@ implement it.</span><br>
|
||||||
<tr>
|
<tr>
|
||||||
<td
|
<td
|
||||||
style="vertical-align: top; background-color: rgb(204, 204, 204); text-align: center;">function
|
style="vertical-align: top; background-color: rgb(204, 204, 204); text-align: center;">function
|
||||||
get_dependencies($scope)<br>
|
get_dependencies()<br>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
<br>
|
<br>
|
||||||
This function returns a list of modules it depends on.<br>
|
This function returns a list of modules it depends on.<br>
|
||||||
The <span style="font-weight: bold;">$scope</span> parameter defines
|
|
||||||
the account type ("user", "group", "host" at this time).<br>
|
|
||||||
<br>
|
<br>
|
||||||
The return value is an array with two sub arrays, <span
|
The return value is an array with two sub arrays, <span
|
||||||
style="font-weight: bold;">"depends"</span> and <span
|
style="font-weight: bold;">"depends"</span> and <span
|
||||||
|
@ -567,6 +563,21 @@ array("user", "host")</span><br style="font-weight: bold;">
|
||||||
<br>
|
<br>
|
||||||
<span style="font-weight: bold;"> Example:</span><span
|
<span style="font-weight: bold;"> Example:</span><span
|
||||||
style="font-style: italic; font-weight: bold;"> array('or' =>
|
style="font-style: italic; font-weight: bold;"> array('or' =>
|
||||||
'objectClass=posixAccount', 'and' => '(!(uid=*$))')</span>
|
'objectClass=posixAccount', 'and' => '(!(uid=*$))')<br>
|
||||||
|
<br>
|
||||||
|
</span>
|
||||||
|
<h3>6.4 get_dependencies()<br>
|
||||||
|
</h3>
|
||||||
|
"dependencies" => array<br>
|
||||||
|
<br>
|
||||||
|
<span style="font-weight: bold;"> Example:</span><span
|
||||||
|
style="font-style: italic; font-weight: bold;"> array(</span><span
|
||||||
|
style="font-style: italic; font-weight: bold;"><span
|
||||||
|
style="font-weight: bold; font-style: italic;">"depends"
|
||||||
|
=> array("posixAccount", array("qmail", "sendmail")), "conflicts"
|
||||||
|
=> array("exim")</span></span><span
|
||||||
|
style="font-style: italic; font-weight: bold;">)</span><span
|
||||||
|
style="font-style: italic; font-weight: bold;"><br>
|
||||||
|
</span>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -118,6 +118,16 @@ class baseModule {
|
||||||
else return get_class($this);
|
else return get_class($this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This function returns a list with all depending and conflicting modules.
|
||||||
|
*
|
||||||
|
* @return array list of dependencies and conflicts
|
||||||
|
*/
|
||||||
|
function get_dependencies() {
|
||||||
|
if (isset($this->meta['dependencies'])) return $this->meta['dependencies'];
|
||||||
|
else return array('depends' => array(), 'conflicts' => array());
|
||||||
|
}
|
||||||
|
|
||||||
// TODO implement missing interface
|
// TODO implement missing interface
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -106,8 +106,8 @@ function getModulesDependencies($scope) {
|
||||||
$mods = getAvailableModules($scope);
|
$mods = getAvailableModules($scope);
|
||||||
$deps = array();
|
$deps = array();
|
||||||
for ($i = 0; $i < sizeof($mods); $i++) {
|
for ($i = 0; $i < sizeof($mods); $i++) {
|
||||||
$deps = call_user_func(array($mods[$i], "get_dependencies"), $scope);
|
$module = new $mods[$i]($scope);
|
||||||
if ($deps != -1) $return[$mods[$i]] = $deps;
|
$return[$mods[$i]] = $module->get_dependencies();
|
||||||
}
|
}
|
||||||
return $return;
|
return $return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,6 +50,8 @@ class account extends baseModule {
|
||||||
$return["account_types"] = array("host");
|
$return["account_types"] = array("host");
|
||||||
// alias name
|
// alias name
|
||||||
$return["alias"] = _('Account');
|
$return["alias"] = _('Account');
|
||||||
|
// module dependencies
|
||||||
|
$return['dependencies'] = array('depends' => array(), 'conflicts' => array('inetOrgPerson'));
|
||||||
return $return;
|
return $return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -79,13 +81,6 @@ class account extends baseModule {
|
||||||
var $orig;
|
var $orig;
|
||||||
|
|
||||||
|
|
||||||
/* This function returns a list with all required modules
|
|
||||||
*/
|
|
||||||
function get_dependencies($scope) {
|
|
||||||
if ($scope=='host') return array('depends' => array(), 'conflicts' => array('inetOrgPerson', 'posixGroup', 'sambaDomain') );
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* This function returns true if all required attributes from other
|
/* This function returns true if all required attributes from other
|
||||||
* modules are set. This is required to prevent undefined states
|
* modules are set. This is required to prevent undefined states
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -49,6 +49,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');
|
||||||
|
// module dependencies
|
||||||
|
$return['dependencies'] = array('depends' => array('posixAccount'), 'conflicts' => array('account'));
|
||||||
return $return;
|
return $return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -82,13 +84,6 @@ class inetOrgPerson extends baseModule {
|
||||||
var $orig;
|
var $orig;
|
||||||
|
|
||||||
|
|
||||||
/* This function returns a list with all required modules
|
|
||||||
*/
|
|
||||||
function get_dependencies($scope) {
|
|
||||||
if ($scope=='user') return array('depends' => array('posixAccount'), 'conflicts' => array('account', 'posixGroup', 'sambaDomain') );
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* This function returns true if all required attributes from other
|
/* This function returns true if all required attributes from other
|
||||||
* modules are set. This is required to prevent undefined states
|
* modules are set. This is required to prevent undefined states
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -79,12 +79,6 @@ class main extends baseModule {
|
||||||
var $base;
|
var $base;
|
||||||
|
|
||||||
|
|
||||||
/* This function returns a list with all required modules
|
|
||||||
*/
|
|
||||||
function get_dependencies($scope) {
|
|
||||||
return array('depends' => array(), 'conflicts' => array() );
|
|
||||||
}
|
|
||||||
|
|
||||||
function module_ready() {
|
function module_ready() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -69,6 +69,12 @@ class posixAccount extends baseModule {
|
||||||
$return["is_base"] = true;
|
$return["is_base"] = true;
|
||||||
// LDAP filter
|
// LDAP filter
|
||||||
$return["ldap_filter"] = array('or' => "(objectClass=posixAccount)", 'and' => "(!(uid=*$))");
|
$return["ldap_filter"] = array('or' => "(objectClass=posixAccount)", 'and' => "(!(uid=*$))");
|
||||||
|
// module dependencies
|
||||||
|
$return['dependencies'] = array('depends' => array('inetOrgPerson'), 'conflicts' => array());
|
||||||
|
}
|
||||||
|
elseif ($this->get_scope() == "host") {
|
||||||
|
// module dependencies
|
||||||
|
$return['dependencies'] = array('depends' => array('account'), 'conflicts' => array());
|
||||||
}
|
}
|
||||||
// alias name
|
// alias name
|
||||||
$return["alias"] = _("Unix");
|
$return["alias"] = _("Unix");
|
||||||
|
@ -152,14 +158,6 @@ class posixAccount extends baseModule {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This function returns a list with all required modules
|
|
||||||
*/
|
|
||||||
function get_dependencies($scope) {
|
|
||||||
if ($scope=='host') return array('depends' => array('account'), 'conflicts' => array() );
|
|
||||||
if ($scope=='user') return array('depends' => array('inetOrgPerson'), 'conflicts' => array() );
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
function module_ready() {
|
function module_ready() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -71,6 +71,8 @@ class posixGroup extends baseModule {
|
||||||
}
|
}
|
||||||
// alias name
|
// alias name
|
||||||
$return["alias"] = _('Unix');
|
$return["alias"] = _('Unix');
|
||||||
|
// module dependencies
|
||||||
|
$return['dependencies'] = array('depends' => array(), 'conflicts' => array('inetOrgPerson', 'account', 'sambaDomain'));
|
||||||
return $return;
|
return $return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -141,13 +143,6 @@ class posixGroup extends baseModule {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This function returns a list with all required modules
|
|
||||||
*/
|
|
||||||
function get_dependencies($scope) {
|
|
||||||
if ($scope=='group') return array('depends' => array(), 'conflicts' => array('inetOrgPerson', 'account', 'sambaDomain') );
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
function module_ready() {
|
function module_ready() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,6 +34,14 @@ class quota extends baseModule {
|
||||||
$return["account_types"] = array("user", "group");
|
$return["account_types"] = array("user", "group");
|
||||||
// alias name
|
// alias name
|
||||||
$return["alias"] = _('Quota');
|
$return["alias"] = _('Quota');
|
||||||
|
if ($this->get_scope() == 'group') {
|
||||||
|
// module dependencies
|
||||||
|
$return['dependencies'] = array('depends' => array('posixGroup'), 'conflicts' => array());
|
||||||
|
}
|
||||||
|
if ($this->get_scope() == 'user') {
|
||||||
|
// module dependencies
|
||||||
|
$return['dependencies'] = array('depends' => array('posixAccount'), 'conflicts' => array());
|
||||||
|
}
|
||||||
return $return;
|
return $return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -83,14 +91,6 @@ class quota extends baseModule {
|
||||||
var $quota;
|
var $quota;
|
||||||
|
|
||||||
|
|
||||||
/* This function returns a list with all required modules
|
|
||||||
*/
|
|
||||||
function get_dependencies($scope) {
|
|
||||||
if ($scope=='group') return array('depends' => array('posixGroup'), 'conflicts' => array() );
|
|
||||||
if ($scope=='user') return array('depends' => array('posixAccount'), 'conflicts' => array() );
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
function module_ready() {
|
function module_ready() {
|
||||||
if (!isset($_SESSION[$_SESSION[$this->base]->config]->scriptPath)) return $false;
|
if (!isset($_SESSION[$_SESSION[$this->base]->config]->scriptPath)) return $false;
|
||||||
if ($_SESSION[$this->base]->type=='user' && $_SESSION[$this->base]->module['posixAccount']->attributes['uid'][0]=='') return false;
|
if ($_SESSION[$this->base]->type=='user' && $_SESSION[$this->base]->module['posixAccount']->attributes['uid'][0]=='') return false;
|
||||||
|
|
|
@ -71,6 +71,8 @@ class sambaAccount extends baseModule {
|
||||||
}
|
}
|
||||||
// alias name
|
// alias name
|
||||||
$return["alias"] = _('Samba 2');
|
$return["alias"] = _('Samba 2');
|
||||||
|
// module dependencies
|
||||||
|
$return['dependencies'] = array('depends' => array('posixAccount'), 'conflicts' => array());
|
||||||
return $return;
|
return $return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -143,14 +145,6 @@ class sambaAccount extends baseModule {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This function returns a list with all required modules
|
|
||||||
*/
|
|
||||||
function get_dependencies($scope) {
|
|
||||||
if ($scope=='host') return array('depends' => array('account'), 'conflicts' => array() );
|
|
||||||
if ($scope=='user') return array('depends' => array('inetOrgPerson'), 'conflicts' => array() );
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
function module_ready() {
|
function module_ready() {
|
||||||
if ($_SESSION[$this->base]->module['posixAccount']->attributes['gidNumber'][0]=='') return false;
|
if ($_SESSION[$this->base]->module['posixAccount']->attributes['gidNumber'][0]=='') return false;
|
||||||
if ($_SESSION[$this->base]->module['posixAccount']->attributes['uidNumber'][0]=='') return false;
|
if ($_SESSION[$this->base]->module['posixAccount']->attributes['uidNumber'][0]=='') return false;
|
||||||
|
|
|
@ -65,6 +65,8 @@ class sambaGroupMapping extends baseModule {
|
||||||
$return["account_types"] = array("group");
|
$return["account_types"] = array("group");
|
||||||
// alias name
|
// alias name
|
||||||
$return["alias"] = _('Samba 3');
|
$return["alias"] = _('Samba 3');
|
||||||
|
// module dependencies
|
||||||
|
$return['dependencies'] = array('depends' => array('posixGroup'), 'conflicts' => array());
|
||||||
return $return;
|
return $return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -109,13 +111,6 @@ class sambaGroupMapping extends baseModule {
|
||||||
var $rids;
|
var $rids;
|
||||||
|
|
||||||
|
|
||||||
/* This function returns a list with all required modules
|
|
||||||
*/
|
|
||||||
function get_dependencies($scope) {
|
|
||||||
if ($scope=='group') return array('depends' => array('posixGroup'), 'conflicts' => array() );
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
function module_ready() {
|
function module_ready() {
|
||||||
if ($_SESSION[$this->base]->module['posixGroup']->attributes['gidNumber'][0]=='') return false;
|
if ($_SESSION[$this->base]->module['posixGroup']->attributes['gidNumber'][0]=='') return false;
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -71,6 +71,8 @@ class sambaSamAccount extends baseModule {
|
||||||
}
|
}
|
||||||
// alias name
|
// alias name
|
||||||
$return["alias"] = _('Samba 3');
|
$return["alias"] = _('Samba 3');
|
||||||
|
// module dependencies
|
||||||
|
$return['dependencies'] = array('depends' => array('posixAccount'), 'conflicts' => array());
|
||||||
return $return;
|
return $return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -144,14 +146,6 @@ class sambaSamAccount extends baseModule {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This function returns a list with all required modules
|
|
||||||
*/
|
|
||||||
function get_dependencies($scope) {
|
|
||||||
if ($scope=='host') return array('depends' => array('posixAccount'), 'conflicts' => array() );
|
|
||||||
if ($scope=='user') return array('depends' => array('posixAccount'), 'conflicts' => array() );
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
function module_ready() {
|
function module_ready() {
|
||||||
if ($_SESSION[$this->base]->module['posixAccount']->attributes['gidNumber'][0]=='') return false;
|
if ($_SESSION[$this->base]->module['posixAccount']->attributes['gidNumber'][0]=='') return false;
|
||||||
if ($_SESSION[$this->base]->module['posixAccount']->attributes['uidNumber'][0]=='') return false;
|
if ($_SESSION[$this->base]->module['posixAccount']->attributes['uidNumber'][0]=='') return false;
|
||||||
|
|
|
@ -65,6 +65,8 @@ class shadowAccount extends baseModule {
|
||||||
$return["account_types"] = array("user");
|
$return["account_types"] = array("user");
|
||||||
// alias name
|
// alias name
|
||||||
$return["alias"] = _('Shadow');
|
$return["alias"] = _('Shadow');
|
||||||
|
// module dependencies
|
||||||
|
$return['dependencies'] = array('depends' => array('posixAccount'), 'conflicts' => array());
|
||||||
return $return;
|
return $return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -103,13 +105,6 @@ class shadowAccount extends baseModule {
|
||||||
var $orig;
|
var $orig;
|
||||||
|
|
||||||
|
|
||||||
/* This function returns a list with all required modules
|
|
||||||
*/
|
|
||||||
function get_dependencies($scope) {
|
|
||||||
if ($scope=='user') return array('depends' => array('inetOrgPerson'), 'conflicts' => array() );
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
function module_ready() {
|
function module_ready() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue