use extended upload function
This commit is contained in:
parent
b8f7d87864
commit
1f8d1445e8
|
@ -670,21 +670,7 @@ class kolabUser extends baseModule {
|
|||
}
|
||||
}
|
||||
// add mail aliases
|
||||
if ($rawAccounts[$i][$ids['kolabUser_aliases']] != "") {
|
||||
$aliases = explode(',', $rawAccounts[$i][$ids['kolabUser_aliases']]);
|
||||
// check format
|
||||
for ($a = 0; $a < sizeof($aliases); $a++) {
|
||||
if (get_preg($aliases[$a], 'email')) {
|
||||
$partialAccounts[$i]['alias'][] = $aliases[$a];
|
||||
}
|
||||
// invalid format
|
||||
else {
|
||||
$errMsg = $this->messages['alias'][1];
|
||||
array_push($errMsg, array($i));
|
||||
$messages[] = $errMsg;
|
||||
}
|
||||
}
|
||||
}
|
||||
$this->mapSimpleUploadField($rawAccounts, $ids, $partialAccounts, $i, 'kolabUser_aliases', 'alias', 'email', $this->messages['alias'][1], $messages, '/,[ ]*/');
|
||||
// add delegates
|
||||
if ($rawAccounts[$i][$ids['kolabUser_delegates']] != "") {
|
||||
$newDelegates = explode(',', $rawAccounts[$i][$ids['kolabUser_delegates']]);
|
||||
|
@ -702,35 +688,9 @@ class kolabUser extends baseModule {
|
|||
}
|
||||
}
|
||||
// allowed recipients
|
||||
if (!empty($rawAccounts[$i][$ids['kolabUser_kolabAllowSMTPRecipient']])) {
|
||||
$mails = preg_split('/;[ ]*/', $rawAccounts[$i][$ids['kolabUser_kolabAllowSMTPRecipient']]);
|
||||
for ($m = 0; $m < sizeof($mails); $m++) {
|
||||
if (get_preg($mails[$m], 'kolabEmailPrefix')) {
|
||||
$partialAccounts[$i]['kolabAllowSMTPRecipient'][] = $mails[$m];
|
||||
}
|
||||
else {
|
||||
$errMsg = $this->messages['kolabAllowSMTPRecipient'][1];
|
||||
array_push($errMsg, array($i));
|
||||
$messages[] = $errMsg;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
$this->mapSimpleUploadField($rawAccounts, $ids, $partialAccounts, $i, 'kolabUser_kolabAllowSMTPRecipient', 'kolabAllowSMTPRecipient', 'kolabEmailPrefix', $this->messages['kolabAllowSMTPRecipient'][1], $messages, '/;[ ]*/');
|
||||
// allowed senders
|
||||
if (!empty($rawAccounts[$i][$ids['kolabUser_kolabAllowSMTPSender']])) {
|
||||
$mails = preg_split('/;[ ]*/', $rawAccounts[$i][$ids['kolabUser_kolabAllowSMTPSender']]);
|
||||
for ($m = 0; $m < sizeof($mails); $m++) {
|
||||
if (get_preg($mails[$m], 'kolabEmailPrefix')) {
|
||||
$partialAccounts[$i]['kolabAllowSMTPSender'][] = $mails[$m];
|
||||
}
|
||||
else {
|
||||
$errMsg = $this->messages['kolabAllowSMTPSender'][1];
|
||||
array_push($errMsg, array($i));
|
||||
$messages[] = $errMsg;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
$this->mapSimpleUploadField($rawAccounts, $ids, $partialAccounts, $i, 'kolabUser_kolabAllowSMTPSender', 'kolabAllowSMTPSender', 'kolabEmailPrefix', $this->messages['kolabAllowSMTPSender'][1], $messages, '/;[ ]*/');
|
||||
}
|
||||
return $messages;
|
||||
}
|
||||
|
|
|
@ -190,13 +190,7 @@ class ldapPublicKey extends baseModule {
|
|||
// add object class
|
||||
if (!in_array("ldapPublicKey", $partialAccounts[$i]['objectClass'])) $partialAccounts[$i]['objectClass'][] = "ldapPublicKey";
|
||||
// add keys
|
||||
if ($rawAccounts[$i][$ids['ldapPublicKey_sshPublicKey']] != "") {
|
||||
$keys = explode(',', $rawAccounts[$i][$ids['ldapPublicKey_sshPublicKey']]);
|
||||
// check format
|
||||
for ($m = 0; $m < sizeof($keys); $m++) {
|
||||
$partialAccounts[$i]['sshPublicKey'][] = $keys[$m];
|
||||
}
|
||||
}
|
||||
$this->mapSimpleUploadField($rawAccounts, $ids, $partialAccounts, $i, 'ldapPublicKey_sshPublicKey', 'sshPublicKey', null, null, $messages, '/,[ ]*/');
|
||||
}
|
||||
return $messages;
|
||||
}
|
||||
|
|
|
@ -443,7 +443,6 @@ class nisMailAlias extends baseModule {
|
|||
// add object class
|
||||
if (!in_array("nisMailAlias", $partialAccounts[$i]['objectClass'])) $partialAccounts[$i]['objectClass'][] = "nisMailAlias";
|
||||
// add alias name
|
||||
// check format
|
||||
$this->mapSimpleUploadField($rawAccounts, $ids, $partialAccounts, $i, 'nisMailAlias_alias', 'cn',
|
||||
'nis_alias', $this->messages['alias'][1], $messages);
|
||||
// add recipients
|
||||
|
|
|
@ -549,10 +549,7 @@ class nisnetgroup extends baseModule {
|
|||
}
|
||||
}
|
||||
// members
|
||||
if ($rawAccounts[$i][$ids['nisnetgroup_members']] != "") {
|
||||
$members = explode(';', $rawAccounts[$i][$ids['nisnetgroup_members']]);
|
||||
$partialAccounts[$i]['nisNetgroupTriple'] = $members;
|
||||
}
|
||||
$this->mapSimpleUploadField($rawAccounts, $ids, $partialAccounts, $i, 'nisnetgroup_members', 'nisNetgroupTriple', null, null, $messages, '/;[ ]*/');
|
||||
}
|
||||
return $messages;
|
||||
}
|
||||
|
|
|
@ -70,14 +70,7 @@ class posixGroup extends baseModule implements passwordService {
|
|||
if (!in_array("posixGroup", $partialAccounts[$i]['objectClass'])) $partialAccounts[$i]['objectClass'][] = "posixGroup";
|
||||
if ($this->manageCnAttribute) {
|
||||
// group name
|
||||
if (get_preg($rawAccounts[$i][$ids['posixGroup_cn']], 'groupname')) {
|
||||
$partialAccounts[$i]['cn'] = $rawAccounts[$i][$ids['posixGroup_cn']];
|
||||
}
|
||||
else {
|
||||
$errMsg = $this->messages['cn'][3];
|
||||
array_push($errMsg, array($i));
|
||||
$error_messages[] = $errMsg;
|
||||
}
|
||||
$this->mapSimpleUploadField($rawAccounts, $ids, $partialAccounts, $i, 'posixGroup_cn', 'cn', 'groupname', $this->messages['cn'][3], $error_messages);
|
||||
}
|
||||
// GID
|
||||
if ($rawAccounts[$i][$ids['posixGroup_gid']] == "") {
|
||||
|
|
|
@ -381,38 +381,11 @@ class puppetClient extends baseModule {
|
|||
}
|
||||
}
|
||||
// environment
|
||||
if ($rawAccounts[$i][$ids['puppetClient_environment']] != "") {
|
||||
if (get_preg($rawAccounts[$i][$ids['puppetClient_environment']], 'ascii')) {
|
||||
$partialAccounts[$i]['environment'] = explode(';', $rawAccounts[$i][$ids['puppetClient_environment']]);
|
||||
}
|
||||
else {
|
||||
$errMsg = $this->messages['environment'][1];
|
||||
array_push($errMsg, array($i));
|
||||
$messages[] = $errMsg;
|
||||
}
|
||||
}
|
||||
$this->mapSimpleUploadField($rawAccounts, $ids, $partialAccounts, $i, 'puppetClient_environment', 'environment', 'ascii', $this->messages['environment'][1], $messages, '/;[ ]*/');
|
||||
// classes
|
||||
if ($rawAccounts[$i][$ids['puppetClient_puppetclass']] != "") {
|
||||
if (get_preg($rawAccounts[$i][$ids['puppetClient_puppetclass']], 'ascii')) {
|
||||
$partialAccounts[$i]['puppetclass'] = explode(';', $rawAccounts[$i][$ids['puppetClient_puppetclass']]);
|
||||
}
|
||||
else {
|
||||
$errMsg = $this->messages['puppetclass'][1];
|
||||
array_push($errMsg, array($i));
|
||||
$messages[] = $errMsg;
|
||||
}
|
||||
}
|
||||
$this->mapSimpleUploadField($rawAccounts, $ids, $partialAccounts, $i, 'puppetClient_puppetclass', 'puppetclass', 'ascii', $this->messages['puppetclass'][1], $messages, '/;[ ]*/');
|
||||
// variables
|
||||
if ($rawAccounts[$i][$ids['puppetClient_puppetvar']] != "") {
|
||||
if (get_preg($rawAccounts[$i][$ids['puppetClient_puppetvar']], 'ascii')) {
|
||||
$partialAccounts[$i]['puppetvar'] = explode(';', $rawAccounts[$i][$ids['puppetClient_puppetvar']]);
|
||||
}
|
||||
else {
|
||||
$errMsg = $this->messages['puppetvar'][1];
|
||||
array_push($errMsg, array($i));
|
||||
$messages[] = $errMsg;
|
||||
}
|
||||
}
|
||||
$this->mapSimpleUploadField($rawAccounts, $ids, $partialAccounts, $i, 'puppetClient_puppetvar', 'puppetvar', 'ascii', $this->messages['puppetvar'][1], $messages, '/;[ ]*/');
|
||||
}
|
||||
return $messages;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue