allow to create homedirs in upload
This commit is contained in:
parent
cd09a86d64
commit
7b96445cfd
|
@ -5,6 +5,7 @@
|
||||||
- group list can show primary members (RFE 1517679 and patch 1722460)
|
- group list can show primary members (RFE 1517679 and patch 1722460)
|
||||||
- more translated example texts (RFE 1702140)
|
- more translated example texts (RFE 1702140)
|
||||||
- inetOrgPerson: now manages homePhone, roomNumber, businessCategory
|
- inetOrgPerson: now manages homePhone, roomNumber, businessCategory
|
||||||
|
- posixAccount: allow to create home directories in file upload (RFE 1665034)
|
||||||
- account lists: display buttons on top and bottom (RFE 1702136)
|
- account lists: display buttons on top and bottom (RFE 1702136)
|
||||||
- fixed bugs:
|
- fixed bugs:
|
||||||
-> OU editor: help images (1702132)
|
-> OU editor: help images (1702132)
|
||||||
|
|
|
@ -182,7 +182,7 @@ class posixAccount extends baseModule {
|
||||||
// upload
|
// upload
|
||||||
$return['upload_preDepends'] = array('inetOrgPerson');
|
$return['upload_preDepends'] = array('inetOrgPerson');
|
||||||
// user specific upload options
|
// user specific upload options
|
||||||
if ($this->scope == 'user') {
|
if (($this->scope == 'user') && $_SESSION['loggedIn']) {
|
||||||
$return['upload_columns'] = array(
|
$return['upload_columns'] = array(
|
||||||
array(
|
array(
|
||||||
'name' => 'posixAccount_userName',
|
'name' => 'posixAccount_userName',
|
||||||
|
@ -224,6 +224,13 @@ class posixAccount extends baseModule {
|
||||||
'example' => _('/home/smiller'),
|
'example' => _('/home/smiller'),
|
||||||
'default' => '/home/<i><posixAccount_userName></i>'
|
'default' => '/home/<i><posixAccount_userName></i>'
|
||||||
),
|
),
|
||||||
|
array(
|
||||||
|
'name' => 'posixAccount_createHomeDir',
|
||||||
|
'description' => _('Create home directory'),
|
||||||
|
'help' => 'createhomedir',
|
||||||
|
'example' => 'localhost',
|
||||||
|
'values' => $_SESSION['config']->get_scriptServers()
|
||||||
|
),
|
||||||
array(
|
array(
|
||||||
'name' => 'posixAccount_shell',
|
'name' => 'posixAccount_shell',
|
||||||
'description' => _('Login shell'),
|
'description' => _('Login shell'),
|
||||||
|
@ -344,6 +351,10 @@ class posixAccount extends baseModule {
|
||||||
"Headline" => _("Home directory"),
|
"Headline" => _("Home directory"),
|
||||||
"Text" => _("Activating this checkbox will remove the user's home directory.")
|
"Text" => _("Activating this checkbox will remove the user's home directory.")
|
||||||
),
|
),
|
||||||
|
'createhomedir' => array(
|
||||||
|
"Headline" => _("Home directory"),
|
||||||
|
"Text" => _("This will create the user's home directory on the specified server.")
|
||||||
|
),
|
||||||
'user' => array(
|
'user' => array(
|
||||||
'uid' => array(
|
'uid' => array(
|
||||||
"Headline" => _("User name"),
|
"Headline" => _("User name"),
|
||||||
|
@ -587,10 +598,7 @@ class posixAccount extends baseModule {
|
||||||
foreach ($result as $singleresult) {
|
foreach ($result as $singleresult) {
|
||||||
$singleresult = explode(",", $singleresult);
|
$singleresult = explode(",", $singleresult);
|
||||||
if (is_array($singleresult)) {
|
if (is_array($singleresult)) {
|
||||||
if (($singleresult[0] == 'ERROR') || ($singleresult[0] == 'WARN')) {
|
if (($singleresult[0] == 'ERROR') || ($singleresult[0] == 'WARN') || ($singleresult[0] == 'INFO')) {
|
||||||
call_user_func_array('StatusMessage', $singleresult);
|
|
||||||
}
|
|
||||||
elseif ($singleresult[0] == 'INFO'){
|
|
||||||
call_user_func_array('StatusMessage', $singleresult);
|
call_user_func_array('StatusMessage', $singleresult);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1467,8 +1475,10 @@ class posixAccount extends baseModule {
|
||||||
// on first call generate list of ldap operations
|
// on first call generate list of ldap operations
|
||||||
if (!isset($temp['counter'])) {
|
if (!isset($temp['counter'])) {
|
||||||
$temp['groups'] = array();
|
$temp['groups'] = array();
|
||||||
|
$temp['createHomes'] = array();
|
||||||
$temp['counter'] = 0;
|
$temp['counter'] = 0;
|
||||||
$col = $ids['posixAccount_additionalGroups'];
|
$col = $ids['posixAccount_additionalGroups'];
|
||||||
|
$col_home = $ids['posixAccount_createHomeDir'];
|
||||||
for ($i = 0; $i < sizeof($data); $i++) {
|
for ($i = 0; $i < sizeof($data); $i++) {
|
||||||
if (in_array($i, $failed)) continue; // ignore failed accounts
|
if (in_array($i, $failed)) continue; // ignore failed accounts
|
||||||
if ($data[$i][$col] != "") {
|
if ($data[$i][$col] != "") {
|
||||||
|
@ -1478,6 +1488,9 @@ class posixAccount extends baseModule {
|
||||||
$temp['members'][$groups[$g]][] = $data[$i][$ids['posixAccount_userName']];
|
$temp['members'][$groups[$g]][] = $data[$i][$ids['posixAccount_userName']];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if ($data[$i][$col_home] != "") {
|
||||||
|
$temp['createHomes'][] = $i;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return array(
|
return array(
|
||||||
'status' => 'inProgress',
|
'status' => 'inProgress',
|
||||||
|
@ -1515,7 +1528,7 @@ class posixAccount extends baseModule {
|
||||||
$temp['counter']++;
|
$temp['counter']++;
|
||||||
return array (
|
return array (
|
||||||
'status' => 'inProgress',
|
'status' => 'inProgress',
|
||||||
'progress' => ($temp['counter'] * 100) / sizeof($temp['groups']),
|
'progress' => ($temp['counter'] * 100) / (sizeof($temp['groups']) + sizeof($temp['createHomes'])),
|
||||||
'errors' => $errors
|
'errors' => $errors
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -1523,11 +1536,30 @@ class posixAccount extends baseModule {
|
||||||
$temp['counter']++;
|
$temp['counter']++;
|
||||||
return array (
|
return array (
|
||||||
'status' => 'inProgress',
|
'status' => 'inProgress',
|
||||||
'progress' => ($temp['counter'] * 100) / sizeof($temp['groups']),
|
'progress' => ($temp['counter'] * 100) / (sizeof($temp['groups'] + sizeof($temp['createHomes']))),
|
||||||
'errors' => array(array('ERROR', _('Unable to find group in LDAP.'), $temp['groups'][$temp['counter']]))
|
'errors' => array(array('ERROR', _('Unable to find group in LDAP.'), $temp['groups'][$temp['counter']]))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// create home directories
|
||||||
|
elseif ($temp['counter'] < (sizeof($temp['groups']) + sizeof($temp['createHomes']))) {
|
||||||
|
$pos = $temp['createHomes'][$temp['counter'] - sizeof($temp['groups'])];
|
||||||
|
$result = lamdaemon(array($data[$pos][$ids['posixAccount_userName']] . " home add 0".$_SESSION['config']->scriptRights),
|
||||||
|
$data[$pos][$ids['posixAccount_createHomeDir']]);
|
||||||
|
$errors = array();
|
||||||
|
if (($result != false) && (sizeof($result) == 1)) {
|
||||||
|
$parts = explode(",", $result[0]);
|
||||||
|
if (in_array($parts[0], array('ERROR', 'WARN'))) {
|
||||||
|
$errors[] = $parts;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$temp['counter']++;
|
||||||
|
return array (
|
||||||
|
'status' => 'inProgress',
|
||||||
|
'progress' => ($temp['counter'] * 100) / (sizeof($temp['groups']) + sizeof($temp['createHomes'])),
|
||||||
|
'errors' => $errors
|
||||||
|
);
|
||||||
|
}
|
||||||
// all groups are modified
|
// all groups are modified
|
||||||
else {
|
else {
|
||||||
return array (
|
return array (
|
||||||
|
|
Loading…
Reference in New Issue