added Samba group type to upload
This commit is contained in:
		
							parent
							
								
									e161023278
								
							
						
					
					
						commit
						a60e563431
					
				|  | @ -83,9 +83,23 @@ class sambaGroupMapping extends baseModule { | ||||||
| 		} | 		} | ||||||
| 		$errors = array(); | 		$errors = array(); | ||||||
| 		for ($i = 0; $i < sizeof($rawAccounts); $i++) { | 		for ($i = 0; $i < sizeof($rawAccounts); $i++) { | ||||||
| 			// group type is always 2
 | 			// group type
 | ||||||
| 			// TODO
 | 			if ($rawAccounts[$i][$ids['sambaGroupMapping_groupType']] != "") { | ||||||
| 			$partialAccounts[$i]['sambaGroupType'] = "2"; | 				if (in_array($rawAccounts[$i][$ids['sambaGroupMapping_groupType']], $this->sambaGroupTypes)) {  // number given
 | ||||||
|  | 					$partialAccounts[$i]['sambaGroupType'] = $rawAccounts[$i][$ids['sambaGroupMapping_groupType']]; | ||||||
|  | 				} | ||||||
|  | 				elseif (in_array($rawAccounts[$i][$ids['sambaGroupMapping_groupType']], array_keys($this->sambaGroupTypes))) {  // description given
 | ||||||
|  | 					$partialAccounts[$i]['sambaGroupType'] = $this->sambaGroupTypes[$rawAccounts[$i][$ids['sambaGroupMapping_groupType']]]; | ||||||
|  | 				} | ||||||
|  | 				else {  // invalid type
 | ||||||
|  | 					$errMsg = $this->messages['groupType'][0]; | ||||||
|  | 					array_push($errMsg, array($i, implode(", ", array_keys($this->sambaGroupTypes) + $this->sambaGroupTypes))); | ||||||
|  | 					$errors[] = $errMsg; | ||||||
|  | 				} | ||||||
|  | 			} | ||||||
|  | 			else { | ||||||
|  | 				$partialAccounts[$i]['sambaGroupType'] = "2";  // 2 is the default (domain group)
 | ||||||
|  | 			} | ||||||
| 			if (!in_array("sambaGroupMapping", $partialAccounts[$i]['objectClass'])) $partialAccounts[$i]['objectClass'][] = "sambaGroupMapping"; | 			if (!in_array("sambaGroupMapping", $partialAccounts[$i]['objectClass'])) $partialAccounts[$i]['objectClass'][] = "sambaGroupMapping"; | ||||||
| 			// SID
 | 			// SID
 | ||||||
| 			$domSID = $nameToSID[$rawAccounts[$i][$ids['sambaGroupMapping_domain']]]; | 			$domSID = $nameToSID[$rawAccounts[$i][$ids['sambaGroupMapping_domain']]]; | ||||||
|  | @ -218,22 +232,26 @@ class sambaGroupMapping extends baseModule { | ||||||
| 				'name' => 'sambaGroupMapping_domain', | 				'name' => 'sambaGroupMapping_domain', | ||||||
| 				'description' => _('Samba 3 domain name'), | 				'description' => _('Samba 3 domain name'), | ||||||
| 				'help' => 'sambaDomainName', | 				'help' => 'sambaDomainName', | ||||||
| 				'example' => _('domain1'), | 				'example' => _('Domain1'), | ||||||
| 				'required' => true | 				'required' => true | ||||||
| 			), | 			), | ||||||
| 			array( | 			array( | ||||||
| 				'name' => 'sambaGroupMapping_name', | 				'name' => 'sambaGroupMapping_name', | ||||||
| 				'description' => _('Samba 3 display name'), | 				'description' => _('Samba 3 display name'), | ||||||
| 				'help' => 'displayName', | 				'help' => 'displayName', | ||||||
| 				'example' => _('Domain administrators'), | 				'example' => _('Domain administrators') | ||||||
| 				'required' => false |  | ||||||
| 			), | 			), | ||||||
| 			array( | 			array( | ||||||
| 				'name' => 'sambaGroupMapping_rid', | 				'name' => 'sambaGroupMapping_rid', | ||||||
| 				'description' => _('Samba 3 RID number'), | 				'description' => _('Samba 3 RID number'), | ||||||
| 				'help' => 'rid', | 				'help' => 'rid', | ||||||
| 				'example' => 'DOMAIN_ADMINS', | 				'example' => _('DOMAIN_ADMINS') | ||||||
| 				'required' => false | 			), | ||||||
|  | 			array( | ||||||
|  | 				'name' => 'sambaGroupMapping_groupType', | ||||||
|  | 				'description' => _('Samba 3 group type'), | ||||||
|  | 				'help' => 'type', | ||||||
|  | 				'example' => '2' | ||||||
| 			) | 			) | ||||||
| 		); | 		); | ||||||
| 		$return['upload_preDepends'] = array('posixGroup'); | 		$return['upload_preDepends'] = array('posixGroup'); | ||||||
|  | @ -254,7 +272,11 @@ class sambaGroupMapping extends baseModule { | ||||||
| 			'sambaDomainName' => array( | 			'sambaDomainName' => array( | ||||||
| 				"ext" => "FALSE", | 				"ext" => "FALSE", | ||||||
| 				"Headline" => _("Domain"), | 				"Headline" => _("Domain"), | ||||||
| 				"Text" => _("Windows-Domain name of group."). ' '. _("Can be left empty."))); | 				"Text" => _("Windows-Domain name of group."). ' '. _("Can be left empty.")), | ||||||
|  | 			'type' => array( | ||||||
|  | 				"ext" => "FALSE", | ||||||
|  | 				"Headline" => _("Samba group type"), | ||||||
|  | 				"Text" => _("Windows group type.") . "<br><br><b>" . _("Possible values: ") . "</b>" . implode(", ", array_keys($this->sambaGroupTypes) + $this->sambaGroupTypes))); | ||||||
| 		 | 		 | ||||||
| 		return $return; | 		return $return; | ||||||
| 	} | 	} | ||||||
|  | @ -310,6 +332,7 @@ class sambaGroupMapping extends baseModule { | ||||||
| 	function load_Messages() { | 	function load_Messages() { | ||||||
| 		$this->messages['sambaSID'][0] = array('ERROR', _('Special Group'),sprintf( _('There can be only one group %s.'), $rids[$i]), 'sambaSID'); | 		$this->messages['sambaSID'][0] = array('ERROR', _('Special Group'),sprintf( _('There can be only one group %s.'), $rids[$i]), 'sambaSID'); | ||||||
| 		$this->messages['sambaSID'][1] = array('ERROR', _("Account %s (sambaGroupMapping_domain): LAM was unable to find a Samba 3 domain with this name!"));  // third parameter must be set dynamically
 | 		$this->messages['sambaSID'][1] = array('ERROR', _("Account %s (sambaGroupMapping_domain): LAM was unable to find a Samba 3 domain with this name!"));  // third parameter must be set dynamically
 | ||||||
|  | 		$this->messages['groupType'][0] = array('ERROR', _("Account %s (sambaGroupMapping_type): This is not a valid Samba 3 group type!"), _("Possible values:") . " %s"); | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue