changed function in accountContainer -> need to change all modules
This commit is contained in:
		
							parent
							
								
									dbb605816a
								
							
						
					
					
						commit
						a95afff139
					
				|  | @ -582,9 +582,9 @@ class accountContainer { | ||||||
| 		$this->dn = substr($dn, strpos($dn, ',')+1); | 		$this->dn = substr($dn, strpos($dn, ',')+1); | ||||||
| 		$this->dn_orig = $dn; | 		$this->dn_orig = $dn; | ||||||
| 		$attr = ldap_get_attributes($_SESSION[$this->ldap]->server(), $entry); | 		$attr = ldap_get_attributes($_SESSION[$this->ldap]->server(), $entry); | ||||||
| 		 | 				 | ||||||
| 		foreach ($modules as $module) { | 		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); | 			$this->module[$module]->load_attributes($attr); | ||||||
| 			} | 			} | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -44,7 +44,7 @@ class account { | ||||||
| 		$this->base = $base; | 		$this->base = $base; | ||||||
| 		// Do some error checks
 | 		// Do some error checks
 | ||||||
| 		if (!$base) trigger_error(_('Please create a base object with $var = new accountContainer();'), E_USER_ERROR); | 		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); | 		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
 | 		// load attribtues which are used in account objectClass
 | ||||||
| 		$this->orig = $_SESSION[$this->base]->get_module_attributes('account'); | 		$this->orig = $_SESSION[$this->base]->get_module_attributes('account'); | ||||||
|  |  | ||||||
|  | @ -43,14 +43,15 @@ class inetOrgPerson { | ||||||
| 		$this->base = $base; | 		$this->base = $base; | ||||||
| 		// Do some error checks
 | 		// Do some error checks
 | ||||||
| 		if (!$base) trigger_error(_('Please create a base object with $var = new accountContainer();'), E_USER_ERROR); | 		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); | 		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
 | 		// load attribtues which are used in inetOrgPerson objectClass
 | ||||||
| 		// unset attributes which are "must" but not in this module
 | 		// unset attributes which are "must" but not in this module
 | ||||||
| 		// cn will be set to uid in module posixAccount
 | 		// 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
 | 		// Therefore module posixAccount is required an cn will be removed from main index in account_container
 | ||||||
| 		// Create copy of attributes
 | 		// 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
 | 		// Add objectClass to attributes
 | ||||||
| 		$this->attributes['objectClass'][0] = 'inetOrgPerson'; | 		$this->attributes['objectClass'][0] = 'inetOrgPerson'; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
|  | @ -59,15 +59,15 @@ class posixAccount { | ||||||
| 		* base container | 		* base container | ||||||
| 		*/ | 		*/ | ||||||
| 		if (!$base) trigger_error(_('Please create a base object with $var = new accountContainer();'), E_USER_ERROR); | 		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; | 		$this->base = $base; | ||||||
| 		// posixAccount is only a valid objectClass for user and host
 | 		// 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); | 		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 | 		/* Check if ldap conatiner is in array and set type | ||||||
| 		* users are using inetOrgPerson-, hosts account-container | 		* 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['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]->add_objectClass('account'); | 		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
 | 		// Add Array with all attributes and type
 | ||||||
| 		$this->orig = $_SESSION[$this->base]->get_module_attributes('posixAccount'); | 		$this->orig = $_SESSION[$this->base]->get_module_attributes('posixAccount'); | ||||||
| 		$this->attributes = $_SESSION[$this->base]->get_module_attributes('posixAccount'); | 		$this->attributes = $_SESSION[$this->base]->get_module_attributes('posixAccount'); | ||||||
|  |  | ||||||
|  | @ -59,7 +59,7 @@ class posixGroup { | ||||||
| 		* base container | 		* base container | ||||||
| 		*/ | 		*/ | ||||||
| 		if (!$base) trigger_error(_('Please create a base object with $var = new accountContainer();'), E_USER_ERROR); | 		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; | 		$this->base = $base; | ||||||
| 		// posixGroup is only a valid objectClass for user and host
 | 		// 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); | 		if ($_SESSION[$this->base]->get_type() != 'group') trigger_error(_('posixGroup can only be used for groups.'), E_USER_WARNING); | ||||||
|  |  | ||||||
|  | @ -26,14 +26,14 @@ class quota { | ||||||
| 	function quota($base) { | 	function quota($base) { | ||||||
| 		$this->base = $base; | 		$this->base = $base; | ||||||
| 		if (!$base) trigger_error(_('Please create a base object with $var = new accountContainer();'), E_USER_ERROR); | 		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
 | 		// 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); | 		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 | 		/* Check if ldap conatiner is in array and set type | ||||||
| 		* users are using inetOrgPerson-, hosts account-container | 		* 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['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]->add_objectClass('posixGroup'); | 		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
 | 		// Get basic quotas for new account
 | ||||||
| 		$output_array = $_SESSION[$this->base]->lamdaemon(array("+ quota get " . $_SESSION[$this->base]->type)); | 		$output_array = $_SESSION[$this->base]->lamdaemon(array("+ quota get " . $_SESSION[$this->base]->type)); | ||||||
| 		// process quotas
 | 		// process quotas
 | ||||||
|  |  | ||||||
|  | @ -59,14 +59,14 @@ class sambaAccount { | ||||||
| 		* base container | 		* base container | ||||||
| 		*/ | 		*/ | ||||||
| 		if (!$base) trigger_error(_('Please create a base object with $var = new accountContainer();'), E_USER_ERROR); | 		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; | 		$this->base = $base; | ||||||
| 		// sambaAccount is only a valid objectClass for user and host
 | 		// 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); | 		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 | 		/* Check if ldap conatiner is in array and set type | ||||||
| 		* users are using inetOrgPerson-, hosts account-container | 		* 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
 | 		// Add Array with all attributes and type
 | ||||||
| 		$this->attributes = $_SESSION[$this->base]->get_module_attributes('sambaAccount'); | 		$this->attributes = $_SESSION[$this->base]->get_module_attributes('sambaAccount'); | ||||||
| 		$_SESSION[$this->base]->add_attributes ('sambaAccount'); | 		$_SESSION[$this->base]->add_attributes ('sambaAccount'); | ||||||
|  |  | ||||||
|  | @ -59,7 +59,7 @@ class sambaGroupMapping { | ||||||
| 		* base container | 		* base container | ||||||
| 		*/ | 		*/ | ||||||
| 		if (!$base) trigger_error(_('Please create a base object with $var = new accountContainer();'), E_USER_ERROR); | 		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; | 		$this->base = $base; | ||||||
| 		// sambaGroupMapping is only a valid objectClass for user and host
 | 		// 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); | 		if ($_SESSION[$this->base]->get_type() != 'group') trigger_error(_('sambaGroupMapping can only be used for groups.'), E_USER_WARNING); | ||||||
|  |  | ||||||
|  | @ -59,14 +59,14 @@ class sambaSamAccount { | ||||||
| 		* base container | 		* base container | ||||||
| 		*/ | 		*/ | ||||||
| 		if (!$base) trigger_error(_('Please create a base object with $var = new accountContainer();'), E_USER_ERROR); | 		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; | 		$this->base = $base; | ||||||
| 		// sambaSamAccount is only a valid objectClass for user and host
 | 		// 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); | 		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 | 		/* Check if ldap conatiner is in array and set type | ||||||
| 		* users are using inetOrgPerson-, hosts account-container | 		* 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
 | 		// Add Array with all attributes and type
 | ||||||
| 		$this->attributes = $_SESSION[$this->base]->get_module_attributes('sambaSamAccount'); | 		$this->attributes = $_SESSION[$this->base]->get_module_attributes('sambaSamAccount'); | ||||||
| 		$_SESSION[$this->base]->add_attributes ('sambaSamAccount'); | 		$_SESSION[$this->base]->add_attributes ('sambaSamAccount'); | ||||||
|  |  | ||||||
|  | @ -59,7 +59,7 @@ class shadowAccount { | ||||||
| 		* base container | 		* base container | ||||||
| 		*/ | 		*/ | ||||||
| 		if (!$base) trigger_error(_('Please create a base object with $var = new accountContainer();'), E_USER_ERROR); | 		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; | 		$this->base = $base; | ||||||
| 		// shadowAccount is only a valid objectClass for user and host
 | 		// 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); | 		if (!($_SESSION[$this->base]->get_type() == 'user')) trigger_error(_('shadowAccount can only be used for users.'), E_USER_WARNING); | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue