diff --git a/lam/lib/modules.inc b/lam/lib/modules.inc
index 7a372d58..78d0a29d 100644
--- a/lam/lib/modules.inc
+++ b/lam/lib/modules.inc
@@ -286,7 +286,11 @@ class accountContainer {
echo "" . _('Help') . "\n";
break;
case 'message':
+ echo "
\n";
StatusMessage($input[$i][$j]['type'], $input[$i][$j]['headline'], $input[$i][$j]['text']);
+ echo " | \n";
break;
default:
echo "Unrecognized type: " . $input[$i][$j]['kind'] . " | \n";
@@ -395,6 +399,7 @@ class accountContainer {
return 0;
}
+
/* This function return ldap attributes which are uses by $objectClass
* Syntax is get_attributes($objectClass)
* Return is an array with all allowed attributes
@@ -537,8 +542,9 @@ class accountContainer {
// found attribute which must be set
if ($this->attributes[$attributes[$i]][$singleattribute[$j]]=='MUST') {
// Check if attribute is set
- if ($this->module[$singleattribute[$j]]->attributes[$attributes[$i]]=='')
+ if ($this->module[$singleattribute[$j]]->attributes[$attributes[$i]]=='') {
if (!in_array($singleattribute[$j], $return)) $return[] = $singleattribute[$j];
+ }
}
}
}
diff --git a/lam/lib/modules/account.inc b/lam/lib/modules/account.inc
index e9f9124e..f40337ed 100644
--- a/lam/lib/modules/account.inc
+++ b/lam/lib/modules/account.inc
@@ -81,6 +81,14 @@ class account {
return true;
}
+ /* This functions return true
+ * if all needed settings are done
+ */
+ function module_complete() {
+ if (!$this->module_ready()) return false;
+ return true;
+ }
+
/* This function returns a list of all html-pages in module
* This is usefull for mass upload and pdf-files
* because lam can walk trough all pages itself and do some
diff --git a/lam/lib/modules/inetOrgPerson.inc b/lam/lib/modules/inetOrgPerson.inc
index c5315c90..206ef1d8 100644
--- a/lam/lib/modules/inetOrgPerson.inc
+++ b/lam/lib/modules/inetOrgPerson.inc
@@ -46,7 +46,9 @@ class inetOrgPerson {
if (!is_string($base)) trigger_error(_('Please create a new module object with $accountContainer->add_objectClass(\'inetOrgPerson\');'), E_USER_ERROR);
if ($_SESSION[$this->base]->type != 'user') trigger_error(_('inetOrgPerson can only be used for users.'), E_USER_WARNING);
// load attribtues which are used in inetOrgPerson objectClass
- $this->attributes = $_SESSION[$this->base]->get_module_attributes('inetOrgPerson');
+ // unset attributes which are "must" but not in this module
+ // cn will be set to uid in module posixAccount
+ // Therefore module posixAccount is required an cn will be removed from main index in account_container
// Create copy of attributes
$this->orig = $this->attributes ;
// Add objectClass to attributes
@@ -70,7 +72,7 @@ class inetOrgPerson {
/* This function returns a list with all required modules
*/
function get_dependencies($scope) {
- if ($scope=='user') return array('require' => array('main'), 'conflict' => array('account', 'posixGroup', 'sambaDomain') );
+ if ($scope=='user') return array('require' => array('main', 'posixAccount'), 'conflict' => array('account', 'posixGroup', 'sambaDomain') );
return -1;
}
@@ -81,6 +83,16 @@ class inetOrgPerson {
return true;
}
+ /* This functions return true
+ * if all needed settings are done
+ */
+ function module_complete() {
+ if (!$this->module_ready()) return false;
+ if ($this->attributes['sn'][0] == '') return false;
+ if ($this->attributes['givenName'][0] == '') return false;
+ return true;
+ }
+
/* This function returns a list of all html-pages in module
* This is usefull for mass upload and pdf-files
* because lam can walk trough all pages itself and do some
diff --git a/lam/lib/modules/main.inc b/lam/lib/modules/main.inc
index b9912246..9b6fd552 100644
--- a/lam/lib/modules/main.inc
+++ b/lam/lib/modules/main.inc
@@ -77,6 +77,14 @@ class main {
return true;
}
+ /* This functions return true
+ * if all needed settings are done
+ */
+ function module_complete() {
+ if (!$this->module_ready()) return false;
+ return true;
+ }
+
/* This function returns a list of all html-pages in module
* This is usefull for mass upload and pdf-files
* because lam can walk trough all pages itself and do some
@@ -188,16 +196,19 @@ class main {
}
function display_html_attributes($post, $profile=false) {
- $modules = $_SESSION[$this->base]->check_attributes();
- if (count($modules)!=0 && !$profile) {
+ $modules = array_keys($_SESSION[$this->base]->module);
+ if (!$profile) {
$disabled = false;
- // Show reason why module is disabled
- for ($i=0; $i array ( 'kind' => 'message', 'type' => 'ERROR', 'headline' => _('Check module'),
- 'text' => sprintf(_('Please set up all required attributes on %s page.'), $_SESSION[$this->base]->module[$modules[$i]]->get_alias()) ));
+ foreach ($modules as $module) {
+ if (!$_SESSION[$this->base]->module[$module]->module_complete()) {
+ $disabled = true;
+ $table[] = array ( 0 => array ( 'kind' => 'message', 'type' => 'ERROR', 'headline' => _('Check module'),
+ 'text' => sprintf(_('Please set up all required attributes on %s page.'), $_SESSION[$this->base]->module[$module]->get_alias()) ));
+ }
+ }
}
- else $disabled = true;
-
+
+ if (count($table)!=0) $return[] = array ( 0 => array ( 'kind' => 'table', 'value' => $table ) );
// loop through all suffixes
$function = '$suffix = $_SESSION[$_SESSION[$this->base]->config]->get_'.ucfirst($_SESSION[$this->base]->type).'Suffix();';
eval($function);
diff --git a/lam/lib/modules/posixAccount.inc b/lam/lib/modules/posixAccount.inc
index 81cf4065..0588952b 100644
--- a/lam/lib/modules/posixAccount.inc
+++ b/lam/lib/modules/posixAccount.inc
@@ -145,6 +145,19 @@ class posixAccount {
return true;
}
+ /* This functions return true
+ * if all needed settings are done
+ */
+ function module_complete() {
+ if (!$this->module_ready()) return false;
+ if ($this->attributes['uid'][0] == '') return false;
+ if ($this->attributes['uidNumber'][0] == '') return false;
+ if ($this->attributes['gidNumber'][0] == '') return false;
+ if ($this->attributes['homeDirectory'][0] == '') return false;
+ if ($this->attributes['loginShell'][0] == '') return false;
+ return true;
+ }
+
/* This function returns a list of all html-pages in module
* This is usefull for mass upload and pdf-files
* because lam can walk trough all pages itself and do some
@@ -362,14 +375,15 @@ class posixAccount {
if ($post['userPassword_lock']) $this->userPassword_lock=true;
else $this->userPassword_lock=false;
if (!$profile) {
- if (isset($post['userPassword'])) {
- if ($post['userPassword'] != $post['userPassword2']) {
- $errors['userPassword'][] = array('ERROR', _('Password'), _('Please enter the same password in both password-fields.'));
- unset ($post['userPassword2']);
- }
- else $this->userPassword($post['userPassword']);
- }
if ($post['genpass']) $this->userPassword(genpasswd());
+ else if (isset($post['userPassword'])) {
+ if ($post['userPassword'] != $post['userPassword2']) {
+ $errors['userPassword'][] = array('ERROR', _('Password'), _('Please enter the same password in both password-fields.'));
+ unset ($post['userPassword2']);
+ }
+ else $this->userPassword($post['userPassword']);
+ }
+
// Check if UID is valid. If none value was entered, the next useable value will be inserted
// load min and may uidNumber
if ($_SESSION[$this->base]->type=='user') {
@@ -581,6 +595,7 @@ class posixAccount {
1 => array ( 'kind' => 'input', 'name' => 'userPassword', 'type' => 'password', 'size' => '20', 'maxlength' => '255', 'value' => $password),
2 => array ( 'kind' => 'input', 'name' => 'genpass', 'type' => 'submit', 'value' => _('Generate password')));
if ($post['userPassword2']!='') $password2 = $post['userPassword2'];
+ else $password2 = $password;
$return[] = array ( 0 => array ( 'kind' => 'text', 'text' => _('Repeat password') ),
1 => array ( 'kind' => 'input', 'name' => 'userPassword2', 'type' => 'password', 'size' => '20', 'maxlength' => '255', 'value' => $password2),
2 => array ('kind' => 'help', 'value' => 'userPassword'));
diff --git a/lam/lib/modules/posixGroup.inc b/lam/lib/modules/posixGroup.inc
index 337a8c5c..2e006353 100644
--- a/lam/lib/modules/posixGroup.inc
+++ b/lam/lib/modules/posixGroup.inc
@@ -134,6 +134,16 @@ class posixGroup {
return true;
}
+ /* This functions return true
+ * if all needed settings are done
+ */
+ function module_complete() {
+ if (!$this->module_ready()) return false;
+ if ($this->attributes['cn'][0] == '') return false;
+ if ($this->attributes['gidNumber'][0] == '') return false;
+ return true;
+ }
+
/* This function returns a list of all html-pages in module
* This is usefull for mass upload and pdf-files
* because lam can walk trough all pages itself and do some
diff --git a/lam/lib/modules/quota.inc b/lam/lib/modules/quota.inc
index 2149b1b3..38386146 100644
--- a/lam/lib/modules/quota.inc
+++ b/lam/lib/modules/quota.inc
@@ -86,6 +86,14 @@ class quota {
return true;
}
+ /* This functions return true
+ * if all needed settings are done
+ */
+ function module_complete() {
+ if (!$this->module_ready()) return false;
+ return true;
+ }
+
/* This function returns a list of all html-pages in module
* This is usefull for mass upload and pdf-files
* because lam can walk trough all pages itself and do some
diff --git a/lam/lib/modules/sambaAccount.inc b/lam/lib/modules/sambaAccount.inc
index 71188ee6..0e85d084 100644
--- a/lam/lib/modules/sambaAccount.inc
+++ b/lam/lib/modules/sambaAccount.inc
@@ -141,6 +141,15 @@ class sambaAccount {
return true;
}
+ /* This functions return true
+ * if all needed settings are done
+ */
+ function module_complete() {
+ if (!$this->module_ready()) return false;
+ if ($this->attributes['rid'][0] == '') return false;
+ return true;
+ }
+
/* This function returns a list of all html-pages in module
* This is usefull for mass upload and pdf-files
* because lam can walk trough all pages itself and do some
diff --git a/lam/lib/modules/sambaGroupMapping.inc b/lam/lib/modules/sambaGroupMapping.inc
index 9d48f514..2f7169e9 100644
--- a/lam/lib/modules/sambaGroupMapping.inc
+++ b/lam/lib/modules/sambaGroupMapping.inc
@@ -109,6 +109,16 @@ class sambaGroupMapping {
return true;
}
+ /* This functions return true
+ * if all needed settings are done
+ */
+ function module_complete() {
+ if (!$this->module_ready()) return false;
+ if ($this->attributes['sambaSID'][0] == '') return false;
+ if ($this->attributes['sambaGroupType'][0] == '') return false;
+ return true;
+ }
+
/* This function returns a list of all html-pages in module
* This is usefull for mass upload and pdf-files
* because lam can walk trough all pages itself and do some
diff --git a/lam/lib/modules/sambaSamAccount.inc b/lam/lib/modules/sambaSamAccount.inc
index 74243fa7..573933ac 100644
--- a/lam/lib/modules/sambaSamAccount.inc
+++ b/lam/lib/modules/sambaSamAccount.inc
@@ -141,6 +141,15 @@ class sambaSamAccount {
return true;
}
+ /* This functions return true
+ * if all needed settings are done
+ */
+ function module_complete() {
+ if (!$this->module_ready()) return false;
+ if ($this->attributes['sambaSID'][0] == '') return false;
+ return true;
+ }
+
/* This function returns a list of all html-pages in module
* This is usefull for mass upload and pdf-files
* because lam can walk trough all pages itself and do some
diff --git a/lam/lib/modules/shadowAccount.inc b/lam/lib/modules/shadowAccount.inc
index 0c1be0e0..51b354df 100644
--- a/lam/lib/modules/shadowAccount.inc
+++ b/lam/lib/modules/shadowAccount.inc
@@ -102,6 +102,14 @@ class shadowAccount {
return true;
}
+ /* This functions return true
+ * if all needed settings are done
+ */
+ function module_complete() {
+ if (!$this->module_ready()) return false;
+ return true;
+ }
+
/* This function returns a list of all html-pages in module
* This is usefull for mass upload and pdf-files
* because lam can walk trough all pages itself and do some