From ede8c042a0fb27bb81d3c11403ee832e98fafcf5 Mon Sep 17 00:00:00 2001 From: Roland Gruber Date: Wed, 1 Feb 2006 19:10:51 +0000 Subject: [PATCH] added save_attributes() to baseModule, removed obsolete module_ready() and module_complete() functions --- lam/lib/baseModule.inc | 15 +++++++++ lam/lib/modules/ieee802device.inc | 36 +--------------------- lam/lib/modules/inetLocalMailRecipient.inc | 28 +---------------- lam/lib/modules/kolabUser.inc | 2 +- lam/lib/modules/ldapPublicKey.inc | 15 --------- lam/lib/modules/nisMailAlias.inc | 22 ++----------- lam/lib/modules/sambaDomain.inc | 15 --------- lam/lib/modules/sambaSamAccount.inc | 12 ++++++-- 8 files changed, 30 insertions(+), 115 deletions(-) diff --git a/lam/lib/baseModule.inc b/lam/lib/baseModule.inc index ccceca6b..0ea262c5 100644 --- a/lam/lib/baseModule.inc +++ b/lam/lib/baseModule.inc @@ -629,6 +629,21 @@ class baseModule { ); } + /** + * Returns a list of modifications which have to be made to the LDAP account. + * + * @return array list of modifications + *
This function returns an array with 3 entries: + *
array( DN1 ('add' => array($attr), 'remove' => array($attr), 'modify' => array($attr)), DN2 .... ) + *
DN is the DN to change. It may be possible to change several DNs (e.g. create a new user and add him to some groups via attribute memberUid) + *
"add" are attributes which have to be added to LDAP entry + *
"remove" are attributes which have to be removed from LDAP entry + *
"modify" are attributes which have to been modified in LDAP entry + */ + function save_attributes() { + return $_SESSION[$this->base]->save_module_attributes($this->attributes, $this->orig); + } + /** * Dummy function for modules which use no special options on account deletion. * diff --git a/lam/lib/modules/ieee802device.inc b/lam/lib/modules/ieee802device.inc index b2da057e..87dca3de 100644 --- a/lam/lib/modules/ieee802device.inc +++ b/lam/lib/modules/ieee802device.inc @@ -34,9 +34,6 @@ $Id$ */ class ieee802Device extends baseModule { - /** used for account pages, true if input data is correct */ - var $inputCorrect = true; - /** * Returns meta data that is interpreted by parent class * @@ -109,21 +106,6 @@ class ieee802Device extends baseModule { return 0; } - /** - * Returns a list of modifications which have to be made to the LDAP account. - * - * @return array list of modifications - *
This function returns an array with 3 entries: - *
array( DN1 ('add' => array($attr), 'remove' => array($attr), 'modify' => array($attr)), DN2 .... ) - *
DN is the DN to change. It may be possible to change several DNs (e.g. create a new user and add him to some groups via attribute memberUid) - *
"add" are attributes which have to be added to LDAP entry - *
"remove" are attributes which have to be removed from LDAP entry - *
"modify" are attributes which have to been modified in LDAP entry - */ - function save_attributes() { - return $_SESSION[$this->base]->save_module_attributes($this->attributes, $this->orig); - } - /** * This function will create the meta HTML code to show a page with all attributes. * @@ -188,29 +170,13 @@ class ieee802Device extends baseModule { } $this->attributes['macAddress'] = array_unique($this->attributes['macAddress']); if (sizeof($this->triggered_messages) > 0) { - $this->inputCorrect = false; return $this->triggered_messages; } else { - $this->inputCorrect = true; - return 0; + return array(); } } - /** - * This function returns true if all needed settings are done. - */ - function module_complete() { - return $this->inputCorrect; - } - - /** - * Returns true if all settings on module page are correct. - */ - function module_ready() { - return $this->inputCorrect; - } - /** * In this function the LDAP account is built up. * diff --git a/lam/lib/modules/inetLocalMailRecipient.inc b/lam/lib/modules/inetLocalMailRecipient.inc index baafb393..bd573d0f 100644 --- a/lam/lib/modules/inetLocalMailRecipient.inc +++ b/lam/lib/modules/inetLocalMailRecipient.inc @@ -34,9 +34,6 @@ $Id$ */ class inetLocalMailRecipient extends baseModule { - /** used for account pages, true if input data is correct */ - var $inputCorrect = true; - /** * Returns meta data that is interpreted by parent class * @@ -161,21 +158,6 @@ class inetLocalMailRecipient extends baseModule { return 0; } - /** - * Returns a list of modifications which have to be made to the LDAP account. - * - * @return array list of modifications - *
This function returns an array with 3 entries: - *
array( DN1 ('add' => array($attr), 'remove' => array($attr), 'modify' => array($attr)), DN2 .... ) - *
DN is the DN to change. It may be possible to change several DNs (e.g. create a new user and add him to some groups via attribute memberUid) - *
"add" are attributes which have to be added to LDAP entry - *
"remove" are attributes which have to be removed from LDAP entry - *
"modify" are attributes which have to been modified in LDAP entry - */ - function save_attributes() { - return $_SESSION[$this->base]->save_module_attributes($this->attributes, $this->orig); - } - /** * This function will create the meta HTML code to show a page with all attributes. * @@ -276,21 +258,13 @@ class inetLocalMailRecipient extends baseModule { } $this->attributes['mailLocalAddress'] = array_unique($this->attributes['mailLocalAddress']); if (sizeof($this->triggered_messages) > 0) { - $this->inputCorrect = false; return $this->triggered_messages; } else { - $this->inputCorrect = true; + return array(); } } - /** - * This function returns true if all needed settings are done. - */ - function module_complete() { - return $this->inputCorrect; - } - /** * In this function the LDAP account is built up. * diff --git a/lam/lib/modules/kolabUser.inc b/lam/lib/modules/kolabUser.inc index 564526eb..1266491d 100644 --- a/lam/lib/modules/kolabUser.inc +++ b/lam/lib/modules/kolabUser.inc @@ -277,7 +277,7 @@ class kolabUser extends baseModule { if (!isset($this->attributes['objectClass']) || !in_array('kolabInetOrgPerson', $this->attributes['objectClass'])) { $this->attributes['objectClass'][] = 'kolabInetOrgPerson'; } - return $_SESSION[$this->base]->save_module_attributes($this->attributes, $this->orig); + return parent::save_attributes(); } /** diff --git a/lam/lib/modules/ldapPublicKey.inc b/lam/lib/modules/ldapPublicKey.inc index 98c72ed7..3e79245a 100644 --- a/lam/lib/modules/ldapPublicKey.inc +++ b/lam/lib/modules/ldapPublicKey.inc @@ -100,21 +100,6 @@ class ldapPublicKey extends baseModule { return 0; } - /** - * Returns a list of modifications which have to be made to the LDAP account. - * - * @return array list of modifications - *
This function returns an array with 3 entries: - *
array( DN1 ('add' => array($attr), 'remove' => array($attr), 'modify' => array($attr)), DN2 .... ) - *
DN is the DN to change. It may be possible to change several DNs (e.g. create a new user and add him to some groups via attribute memberUid) - *
"add" are attributes which have to be added to LDAP entry - *
"remove" are attributes which have to be removed from LDAP entry - *
"modify" are attributes which have to been modified in LDAP entry - */ - function save_attributes() { - return $_SESSION[$this->base]->save_module_attributes($this->attributes, $this->orig); - } - /** * This function will create the meta HTML code to show a page with all attributes. * diff --git a/lam/lib/modules/nisMailAlias.inc b/lam/lib/modules/nisMailAlias.inc index b8cd18b2..5fd0fde4 100644 --- a/lam/lib/modules/nisMailAlias.inc +++ b/lam/lib/modules/nisMailAlias.inc @@ -34,9 +34,6 @@ $Id$ */ class nisMailAlias extends baseModule { - /** used for account pages, true if input data is correct */ - var $inputCorrect = true; - /** * Returns meta data that is interpreted by parent class * @@ -150,7 +147,7 @@ class nisMailAlias extends baseModule { if (!$_SESSION[$this->base]->isNewAccount && !in_array('nisMailAlias', $_SESSION[$this->base]->attributes_orig['objectClass'])) { return array(); } - return $_SESSION[$this->base]->save_module_attributes($this->attributes, $this->orig); + return parent::save_attributes(); } /** @@ -232,28 +229,13 @@ class nisMailAlias extends baseModule { } $this->attributes['rfc822MailMember'] = array_unique($this->attributes['rfc822MailMember']); if (sizeof($this->triggered_messages) > 0) { - $this->inputCorrect = false; return $this->triggered_messages; } else { - $this->inputCorrect = true; + return array(); } } - /** - * This function returns true if all needed settings are done. - */ - function module_complete() { - if (!$_SESSION[$this->base]->isNewAccount) { - // check if account is based on our object class - $objectClasses = $_SESSION[$this->base]->attributes_orig['objectClass']; - if (is_array($objectClasses) && !in_array('nisMailAlias', $objectClasses)) { - return true; - } - } - return $this->inputCorrect; - } - /** * Controls if the module button the account page is visible and activated. * diff --git a/lam/lib/modules/sambaDomain.inc b/lam/lib/modules/sambaDomain.inc index adbf8108..dcf83b87 100644 --- a/lam/lib/modules/sambaDomain.inc +++ b/lam/lib/modules/sambaDomain.inc @@ -176,21 +176,6 @@ class sambaDomain extends baseModule { return 0; } - /** - * Returns a list of modifications which have to be made to the LDAP account. - * - * @return array list of modifications - *
This function returns an array with 3 entries: - *
array( DN1 ('add' => array($attr), 'remove' => array($attr), 'modify' => array($attr)), DN2 .... ) - *
DN is the DN to change. It may be possible to change several DNs (e.g. create a new user and add him to some groups via attribute memberUid) - *
"add" are attributes which have to be added to LDAP entry - *
"remove" are attributes which have to be removed from LDAP entry - *
"modify" are attributes which have to been modified in LDAP entry - */ - function save_attributes() { - return $_SESSION[$this->base]->save_module_attributes($this->attributes, $this->orig); - } - /** * This function will create the meta HTML code to show a page with all attributes. * diff --git a/lam/lib/modules/sambaSamAccount.inc b/lam/lib/modules/sambaSamAccount.inc index ed9f72b4..ecfd0858 100644 --- a/lam/lib/modules/sambaSamAccount.inc +++ b/lam/lib/modules/sambaSamAccount.inc @@ -423,6 +423,12 @@ class sambaSamAccount extends baseModule { } } + /** + * This function is used to check if this module page can be displayed. + * It returns false if a module depends on data from other modules which was not yet entered. + * + * @return boolean true, if page can be displayed + */ function module_ready() { if ($_SESSION[$this->base]->module['posixAccount']->attributes['gidNumber'][0]=='') return false; if ($_SESSION[$this->base]->module['posixAccount']->attributes['uidNumber'][0]=='') return false; @@ -430,8 +436,10 @@ class sambaSamAccount extends baseModule { return true; } - /* This functions return true - * if all needed settings are done + /** + * This functions is used to check if all settings for this module have been made. + * + * @return boolean true, if settings are complete */ function module_complete() { if (!$this->module_ready()) return false;