added save_attributes() to baseModule, removed obsolete module_ready() and module_complete() functions

This commit is contained in:
Roland Gruber 2006-02-01 19:10:51 +00:00
parent 1b84f105a1
commit ede8c042a0
8 changed files with 30 additions and 115 deletions

View File

@ -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
* <br>This function returns an array with 3 entries:
* <br>array( DN1 ('add' => array($attr), 'remove' => array($attr), 'modify' => array($attr)), DN2 .... )
* <br>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)
* <br>"add" are attributes which have to be added to LDAP entry
* <br>"remove" are attributes which have to be removed from LDAP entry
* <br>"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. * Dummy function for modules which use no special options on account deletion.
* *

View File

@ -34,9 +34,6 @@ $Id$
*/ */
class ieee802Device extends baseModule { 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 * Returns meta data that is interpreted by parent class
* *
@ -109,21 +106,6 @@ class ieee802Device extends baseModule {
return 0; return 0;
} }
/**
* Returns a list of modifications which have to be made to the LDAP account.
*
* @return array list of modifications
* <br>This function returns an array with 3 entries:
* <br>array( DN1 ('add' => array($attr), 'remove' => array($attr), 'modify' => array($attr)), DN2 .... )
* <br>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)
* <br>"add" are attributes which have to be added to LDAP entry
* <br>"remove" are attributes which have to be removed from LDAP entry
* <br>"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. * 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']); $this->attributes['macAddress'] = array_unique($this->attributes['macAddress']);
if (sizeof($this->triggered_messages) > 0) { if (sizeof($this->triggered_messages) > 0) {
$this->inputCorrect = false;
return $this->triggered_messages; return $this->triggered_messages;
} }
else { else {
$this->inputCorrect = true; return array();
return 0;
} }
} }
/**
* 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. * In this function the LDAP account is built up.
* *

View File

@ -34,9 +34,6 @@ $Id$
*/ */
class inetLocalMailRecipient extends baseModule { 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 * Returns meta data that is interpreted by parent class
* *
@ -161,21 +158,6 @@ class inetLocalMailRecipient extends baseModule {
return 0; return 0;
} }
/**
* Returns a list of modifications which have to be made to the LDAP account.
*
* @return array list of modifications
* <br>This function returns an array with 3 entries:
* <br>array( DN1 ('add' => array($attr), 'remove' => array($attr), 'modify' => array($attr)), DN2 .... )
* <br>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)
* <br>"add" are attributes which have to be added to LDAP entry
* <br>"remove" are attributes which have to be removed from LDAP entry
* <br>"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. * 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']); $this->attributes['mailLocalAddress'] = array_unique($this->attributes['mailLocalAddress']);
if (sizeof($this->triggered_messages) > 0) { if (sizeof($this->triggered_messages) > 0) {
$this->inputCorrect = false;
return $this->triggered_messages; return $this->triggered_messages;
} }
else { 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. * In this function the LDAP account is built up.
* *

View File

@ -277,7 +277,7 @@ class kolabUser extends baseModule {
if (!isset($this->attributes['objectClass']) || !in_array('kolabInetOrgPerson', $this->attributes['objectClass'])) { if (!isset($this->attributes['objectClass']) || !in_array('kolabInetOrgPerson', $this->attributes['objectClass'])) {
$this->attributes['objectClass'][] = 'kolabInetOrgPerson'; $this->attributes['objectClass'][] = 'kolabInetOrgPerson';
} }
return $_SESSION[$this->base]->save_module_attributes($this->attributes, $this->orig); return parent::save_attributes();
} }
/** /**

View File

@ -100,21 +100,6 @@ class ldapPublicKey extends baseModule {
return 0; return 0;
} }
/**
* Returns a list of modifications which have to be made to the LDAP account.
*
* @return array list of modifications
* <br>This function returns an array with 3 entries:
* <br>array( DN1 ('add' => array($attr), 'remove' => array($attr), 'modify' => array($attr)), DN2 .... )
* <br>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)
* <br>"add" are attributes which have to be added to LDAP entry
* <br>"remove" are attributes which have to be removed from LDAP entry
* <br>"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. * This function will create the meta HTML code to show a page with all attributes.
* *

View File

@ -34,9 +34,6 @@ $Id$
*/ */
class nisMailAlias extends baseModule { 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 * 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'])) { if (!$_SESSION[$this->base]->isNewAccount && !in_array('nisMailAlias', $_SESSION[$this->base]->attributes_orig['objectClass'])) {
return array(); 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']); $this->attributes['rfc822MailMember'] = array_unique($this->attributes['rfc822MailMember']);
if (sizeof($this->triggered_messages) > 0) { if (sizeof($this->triggered_messages) > 0) {
$this->inputCorrect = false;
return $this->triggered_messages; return $this->triggered_messages;
} }
else { 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. * Controls if the module button the account page is visible and activated.
* *

View File

@ -176,21 +176,6 @@ class sambaDomain extends baseModule {
return 0; return 0;
} }
/**
* Returns a list of modifications which have to be made to the LDAP account.
*
* @return array list of modifications
* <br>This function returns an array with 3 entries:
* <br>array( DN1 ('add' => array($attr), 'remove' => array($attr), 'modify' => array($attr)), DN2 .... )
* <br>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)
* <br>"add" are attributes which have to be added to LDAP entry
* <br>"remove" are attributes which have to be removed from LDAP entry
* <br>"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. * This function will create the meta HTML code to show a page with all attributes.
* *

View File

@ -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() { 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;
@ -430,8 +436,10 @@ class sambaSamAccount extends baseModule {
return true; 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() { function module_complete() {
if (!$this->module_ready()) return false; if (!$this->module_ready()) return false;