diff --git a/lam/lib/modules.inc b/lam/lib/modules.inc index 7fa576a6..c8b8bfd3 100644 --- a/lam/lib/modules.inc +++ b/lam/lib/modules.inc @@ -582,9 +582,9 @@ class accountContainer { $this->dn = substr($dn, strpos($dn, ',')+1); $this->dn_orig = $dn; $attr = ldap_get_attributes($_SESSION[$this->ldap]->server(), $entry); - + foreach ($modules as $module) { - $this->module[$module] = new $module($this->base); + if (!isset($this->module[$module])) $this->module[$module] = new $module($this->base); $this->module[$module]->load_attributes($attr); } diff --git a/lam/lib/modules/account.inc b/lam/lib/modules/account.inc index f40337ed..297e3766 100644 --- a/lam/lib/modules/account.inc +++ b/lam/lib/modules/account.inc @@ -44,7 +44,7 @@ class account { $this->base = $base; // Do some error checks if (!$base) trigger_error(_('Please create a base object with $var = new accountContainer();'), E_USER_ERROR); - if (!is_string($base)) trigger_error(_('Please create a new module object with $accountContainer->add_objectClass(\'account\');'), E_USER_ERROR); + if (!is_string($base)) trigger_error(_('Please create a new module object in an accountContainer object first.'), E_USER_ERROR); if ($_SESSION[$this->base]->get_type() != 'host') trigger_error(_('account can only be used for hosts.'), E_USER_WARNING); // load attribtues which are used in account objectClass $this->orig = $_SESSION[$this->base]->get_module_attributes('account'); diff --git a/lam/lib/modules/inetOrgPerson.inc b/lam/lib/modules/inetOrgPerson.inc index 206ef1d8..7b638367 100644 --- a/lam/lib/modules/inetOrgPerson.inc +++ b/lam/lib/modules/inetOrgPerson.inc @@ -43,14 +43,15 @@ class inetOrgPerson { $this->base = $base; // Do some error checks if (!$base) trigger_error(_('Please create a base object with $var = new accountContainer();'), E_USER_ERROR); - if (!is_string($base)) trigger_error(_('Please create a new module object with $accountContainer->add_objectClass(\'inetOrgPerson\');'), E_USER_ERROR); + if (!is_string($base)) trigger_error(_('Please create a new module in an accountContainer object first.'), 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 // 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 ; + $this->orig = $_SESSION[$this->base]->get_module_attributes('inetOrgPerson'); + $this->attributes = $_SESSION[$this->base]->get_module_attributes('inetOrgPerson'); // Add objectClass to attributes $this->attributes['objectClass'][0] = 'inetOrgPerson'; } diff --git a/lam/lib/modules/posixAccount.inc b/lam/lib/modules/posixAccount.inc index 847d9fa0..6c036685 100644 --- a/lam/lib/modules/posixAccount.inc +++ b/lam/lib/modules/posixAccount.inc @@ -59,15 +59,15 @@ class posixAccount { * base container */ if (!$base) trigger_error(_('Please create a base object with $var = new accountContainer();'), E_USER_ERROR); - if (!is_string($base)) trigger_error(_('Please create a new module object with $accountContainer->add_objectClass(\'posixAccount\');'), E_USER_ERROR); + if (!is_string($base)) trigger_error(_('Please create a new module object in an accountContainer object first.'), E_USER_ERROR); $this->base = $base; // posixAccount is only a valid objectClass for user and host if (!($_SESSION[$this->base]->get_type() == 'user') && !($_SESSION[$this->base]->get_type() == 'host')) trigger_error(_('posixAccount can only be used for users or hosts.'), E_USER_WARNING); /* Check if ldap conatiner is in array and set type * users are using inetOrgPerson-, hosts account-container */ - if (!isset($_SESSION[$this->base]->module['inetOrgPerson']) && $_SESSION[$this->base]->type=='user') $_SESSION[$this->base]->add_objectClass('inetOrgPerson'); - if (!isset($_SESSION[$this->base]->module['account']) && $_SESSION[$this->base]->type=='host') $_SESSION[$this->base]->add_objectClass('account'); + if (!isset($_SESSION[$this->base]->module['inetOrgPerson']) && $_SESSION[$this->base]->type=='user') $_SESSION[$this->base]->modules['inetOrgPerson'] = new inetOrgPerson($this->base); + if (!isset($_SESSION[$this->base]->module['account']) && $_SESSION[$this->base]->type=='host') $_SESSION[$this->base]->modules['account'] = new account($this->base); // Add Array with all attributes and type $this->orig = $_SESSION[$this->base]->get_module_attributes('posixAccount'); $this->attributes = $_SESSION[$this->base]->get_module_attributes('posixAccount'); diff --git a/lam/lib/modules/posixGroup.inc b/lam/lib/modules/posixGroup.inc index 2e006353..b5ff52be 100644 --- a/lam/lib/modules/posixGroup.inc +++ b/lam/lib/modules/posixGroup.inc @@ -59,7 +59,7 @@ class posixGroup { * base container */ if (!$base) trigger_error(_('Please create a base object with $var = new accountContainer();'), E_USER_ERROR); - if (!is_string($base)) trigger_error(_('Please create a new module object with $accountContainer->add_objectClass(\'posixGroup\');'), E_USER_ERROR); + if (!is_string($base)) trigger_error(_('Please create a new module object in an accountContainer object first.'), E_USER_ERROR); $this->base = $base; // posixGroup is only a valid objectClass for user and host if ($_SESSION[$this->base]->get_type() != 'group') trigger_error(_('posixGroup can only be used for groups.'), E_USER_WARNING); diff --git a/lam/lib/modules/quota.inc b/lam/lib/modules/quota.inc index 38386146..bf0bc138 100644 --- a/lam/lib/modules/quota.inc +++ b/lam/lib/modules/quota.inc @@ -26,14 +26,14 @@ class quota { function quota($base) { $this->base = $base; if (!$base) trigger_error(_('Please create a base object with $var = new accountContainer();'), E_USER_ERROR); - if (!is_string($base)) trigger_error(_('Please create a new module object with $accountContainer->add_objectClass(\'quota\');'), E_USER_ERROR); + if (!is_string($base)) trigger_error(_('Please create a new module in an accountContainer object first.'), E_USER_ERROR); // quota is only a valid objectClass for user and host if (!($_SESSION[$this->base]->get_type() == 'user') && !($_SESSION[$this->base]->get_type() == 'group')) trigger_error(_('quota can only be used for users or groups.'), E_USER_WARNING); /* Check if ldap conatiner is in array and set type * users are using inetOrgPerson-, hosts account-container */ - if (!isset($_SESSION[$this->base]->module['posixAccount']) && $_SESSION[$this->base]->type=='user') $_SESSION[$this->base]->add_objectClass('posixAccount'); - if (!isset($_SESSION[$this->base]->module['posixGroup']) && $_SESSION[$this->base]->type=='group') $_SESSION[$this->base]->add_objectClass('posixGroup'); + if (!isset($_SESSION[$this->base]->module['posixAccount']) && $_SESSION[$this->base]->type=='user') $_SESSION[$this->base]->modules['posixAccount'] = new posixGroup($this->base); + if (!isset($_SESSION[$this->base]->module['posixGroup']) && $_SESSION[$this->base]->type=='group') $_SESSION[$this->base]->modules['posixGroup'] = new posixGroup($this->base); // Get basic quotas for new account $output_array = $_SESSION[$this->base]->lamdaemon(array("+ quota get " . $_SESSION[$this->base]->type)); // process quotas diff --git a/lam/lib/modules/sambaAccount.inc b/lam/lib/modules/sambaAccount.inc index 0e85d084..56755345 100644 --- a/lam/lib/modules/sambaAccount.inc +++ b/lam/lib/modules/sambaAccount.inc @@ -59,14 +59,14 @@ class sambaAccount { * base container */ if (!$base) trigger_error(_('Please create a base object with $var = new accountContainer();'), E_USER_ERROR); - if (!is_string($base)) trigger_error(_('Please create a new module object with $accountContainer->add_objectClass(\'sambaAccount\');'), E_USER_ERROR); + if (!is_string($base)) trigger_error(_('Please create a new module object in an accountContainer object first.'), E_USER_ERROR); $this->base = $base; // sambaAccount is only a valid objectClass for user and host if (!($_SESSION[$this->base]->get_type() == 'user') && !($_SESSION[$this->base]->get_type() == 'host')) trigger_error(_('sambaAccount can only be used for users or hosts.'), E_USER_WARNING); /* Check if ldap conatiner is in array and set type * users are using inetOrgPerson-, hosts account-container */ - if (!isset($_SESSION[$this->base]->module['posixAccount'])) $_SESSION[$this->base]->add_objectClass('posixAccount'); + if (!isset($_SESSION[$this->base]->module['posixAccount'])) $_SESSION[$this->base]->modules['posixAccount'] = new posixAccount($this->base); // Add Array with all attributes and type $this->attributes = $_SESSION[$this->base]->get_module_attributes('sambaAccount'); $_SESSION[$this->base]->add_attributes ('sambaAccount'); diff --git a/lam/lib/modules/sambaGroupMapping.inc b/lam/lib/modules/sambaGroupMapping.inc index 2f7169e9..c65b7c74 100644 --- a/lam/lib/modules/sambaGroupMapping.inc +++ b/lam/lib/modules/sambaGroupMapping.inc @@ -59,7 +59,7 @@ class sambaGroupMapping { * base container */ if (!$base) trigger_error(_('Please create a base object with $var = new accountContainer();'), E_USER_ERROR); - if (!is_string($base)) trigger_error(_('Please create a new module object with $accountContainer->add_objectClass(\'sambaGroupMapping\');'), E_USER_ERROR); + if (!is_string($base)) trigger_error(_('Please create a new module object in an accountContainer object first.'), E_USER_ERROR); $this->base = $base; // sambaGroupMapping is only a valid objectClass for user and host if ($_SESSION[$this->base]->get_type() != 'group') trigger_error(_('sambaGroupMapping can only be used for groups.'), E_USER_WARNING); diff --git a/lam/lib/modules/sambaSamAccount.inc b/lam/lib/modules/sambaSamAccount.inc index 573933ac..2307522d 100644 --- a/lam/lib/modules/sambaSamAccount.inc +++ b/lam/lib/modules/sambaSamAccount.inc @@ -59,14 +59,14 @@ class sambaSamAccount { * base container */ if (!$base) trigger_error(_('Please create a base object with $var = new accountContainer();'), E_USER_ERROR); - if (!is_string($base)) trigger_error(_('Please create a new module object with $accountContainer->add_objectClass(\'sambaSamAccount\');'), E_USER_ERROR); + if (!is_string($base)) trigger_error(_('Please create a new module object in an accountContainer object first.'), E_USER_ERROR); $this->base = $base; // sambaSamAccount is only a valid objectClass for user and host if (!($_SESSION[$this->base]->get_type() == 'user') && !($_SESSION[$this->base]->get_type() == 'host')) trigger_error(_('sambaSamAccount can only be used for users or hosts.'), E_USER_WARNING); /* Check if ldap conatiner is in array and set type * users are using inetOrgPerson-, hosts account-container */ - if (!isset($_SESSION[$this->base]->module['posixAccount'])) $_SESSION[$this->base]->add_objectClass('posixAccount'); + if (!isset($_SESSION[$this->base]->module['posixAccount'])) $_SESSION[$this->base]->modules['posixAccount'] = new posixAccount($this->base); // Add Array with all attributes and type $this->attributes = $_SESSION[$this->base]->get_module_attributes('sambaSamAccount'); $_SESSION[$this->base]->add_attributes ('sambaSamAccount'); diff --git a/lam/lib/modules/shadowAccount.inc b/lam/lib/modules/shadowAccount.inc index 51b354df..1761e344 100644 --- a/lam/lib/modules/shadowAccount.inc +++ b/lam/lib/modules/shadowAccount.inc @@ -59,7 +59,7 @@ class shadowAccount { * base container */ if (!$base) trigger_error(_('Please create a base object with $var = new accountContainer();'), E_USER_ERROR); - if (!is_string($base)) trigger_error(_('Please create a new module object with $accountContainer->add_objectClass(\'shadowAccount\');'), E_USER_ERROR); + if (!is_string($base)) trigger_error(_('Please create a new module object in an accountContainer object first.'), E_USER_ERROR); $this->base = $base; // shadowAccount is only a valid objectClass for user and host if (!($_SESSION[$this->base]->get_type() == 'user')) trigger_error(_('shadowAccount can only be used for users.'), E_USER_WARNING);