fixed homedir creation on file upload

This commit is contained in:
Roland Gruber 2010-12-16 17:59:04 +00:00
parent cb4f1308e3
commit cea3fdd67b
6 changed files with 26 additions and 9 deletions

View File

@ -1,10 +1,11 @@
December 2010 3.3.0 January 2011 3.3.0
- additional usability enhancements - additional usability enhancements
- new IMAP module ("Mailbox (imapAccess)") allows to create/delete user mailboxes - new IMAP module ("Mailbox (imapAccess)") allows to create/delete user mailboxes
- PDF export: higher resolution for logos - PDF export: higher resolution for logos
- reduced number of LDAP queries - reduced number of LDAP queries
- fixed bugs: - fixed bugs:
-> ignore comment lines in shells file (3107124) -> ignore comment lines in shells file (3107124)
-> home directory creation on file upload
28.10.2010 3.2.0 28.10.2010 3.2.0

View File

@ -989,6 +989,7 @@ abstract class baseModule {
* @param array $ids maps the column names to keys for the sub arrays (array(<column_name> => <column number>)) * @param array $ids maps the column names to keys for the sub arrays (array(<column_name> => <column number>))
* @param array $failed list of account numbers which could not be successfully uploaded to LDAP * @param array $failed list of account numbers which could not be successfully uploaded to LDAP
* @param array $temp variable to store temporary data between two post actions * @param array $temp variable to store temporary data between two post actions
* @param array $accounts list of LDAP entries
* @return array current status * @return array current status
* <br> array ( * <br> array (
* <br> 'status' => 'finished' | 'inProgress' // defines if all operations are complete * <br> 'status' => 'finished' | 'inProgress' // defines if all operations are complete
@ -996,7 +997,7 @@ abstract class baseModule {
* <br> 'errors' => array // list of arrays which are used to generate StatusMessages * <br> 'errors' => array // list of arrays which are used to generate StatusMessages
* <br> ) * <br> )
*/ */
public function doUploadPostActions($data, $ids, $failed, &$temp) { public function doUploadPostActions(&$data, $ids, $failed, &$temp, &$accounts) {
return array( return array(
'status' => 'finished', 'status' => 'finished',
'progress' => 100, 'progress' => 100,

View File

@ -492,6 +492,7 @@ function buildUploadAccounts($scope, $data, $ids, $selectedModules) {
* @param array $ids array(<column_name> => <column number>) * @param array $ids array(<column_name> => <column number>)
* @param array $failed list of accounts which were not created successfully * @param array $failed list of accounts which were not created successfully
* @param array $selectedModules list of selected account modules * @param array $selectedModules list of selected account modules
* @param array $accounts list of LDAP entries
* @return array current status * @return array current status
* <br> array ( * <br> array (
* <br> 'status' => 'finished' | 'inProgress' * <br> 'status' => 'finished' | 'inProgress'
@ -500,7 +501,7 @@ function buildUploadAccounts($scope, $data, $ids, $selectedModules) {
* <br> 'errors' => array (<array of parameters for StatusMessage>) * <br> 'errors' => array (<array of parameters for StatusMessage>)
* <br> ) * <br> )
*/ */
function doUploadPostActions($scope, $data, $ids, $failed, $selectedModules) { function doUploadPostActions($scope, &$data, $ids, $failed, $selectedModules, &$accounts) {
// check if function is called the first time // check if function is called the first time
if (! isset($_SESSION['mass_postActions']['remainingModules'])) { if (! isset($_SESSION['mass_postActions']['remainingModules'])) {
// make list of remaining modules // make list of remaining modules
@ -514,7 +515,7 @@ function doUploadPostActions($scope, $data, $ids, $failed, $selectedModules) {
} }
// let first module do one post action // let first module do one post action
$module = new $activeModule($scope); $module = new $activeModule($scope);
$return = $module->doUploadPostActions($data, $ids, $failed, $_SESSION['mass_postActions'][$activeModule]); $return = $module->doUploadPostActions($data, $ids, $failed, $_SESSION['mass_postActions'][$activeModule], $accounts);
// remove active module from list if already finished // remove active module from list if already finished
if ($return['status'] == 'finished') { if ($return['status'] == 'finished') {
unset($_SESSION['mass_postActions']['remainingModules'][0]); unset($_SESSION['mass_postActions']['remainingModules'][0]);

View File

@ -1468,6 +1468,7 @@ class posixAccount extends baseModule implements passwordService {
* @param array $ids array(<column_name> => <column number>) * @param array $ids array(<column_name> => <column number>)
* @param array $failed list of accounts which were not created successfully * @param array $failed list of accounts which were not created successfully
* @param array $temp variable to store temporary data between two post actions * @param array $temp variable to store temporary data between two post actions
* @param array $accounts list of LDAP entries
* @return array current status * @return array current status
* <br> array ( * <br> array (
* <br> 'status' => 'finished' | 'inProgress' * <br> 'status' => 'finished' | 'inProgress'
@ -1475,7 +1476,7 @@ class posixAccount extends baseModule implements passwordService {
* <br> 'errors' => array (<array of parameters for StatusMessage>) * <br> 'errors' => array (<array of parameters for StatusMessage>)
* <br> ) * <br> )
*/ */
function doUploadPostActions($data, $ids, $failed, &$temp) { function doUploadPostActions(&$data, $ids, $failed, &$temp, &$accounts) {
if (!checkIfWriteAccessIsAllowed()) { if (!checkIfWriteAccessIsAllowed()) {
die(); die();
} }
@ -1569,7 +1570,19 @@ class posixAccount extends baseModule implements passwordService {
// create home directories // create home directories
elseif ($temp['counter'] < (sizeof($temp['groups']) + sizeof($temp['createHomes']))) { elseif ($temp['counter'] < (sizeof($temp['groups']) + sizeof($temp['createHomes']))) {
$pos = $temp['createHomes'][$temp['counter'] - sizeof($temp['groups'])]; $pos = $temp['createHomes'][$temp['counter'] - sizeof($temp['groups'])];
$result = lamdaemon(implode(posixAccount::$SPLIT_DELIMITER, array($data[$pos][$ids['posixAccount_userName']], "home", "add", "0".$_SESSION['config']->get_scriptRights())), $result = lamdaemon(
implode(
posixAccount::$SPLIT_DELIMITER,
array(
$data[$pos][$ids['posixAccount_userName']],
"home",
"add",
$accounts[$pos]['homeDirectory'],
"0".$_SESSION['config']->get_scriptRights(),
$accounts[$pos]['uidNumber'],
$accounts[$pos]['gidNumber'],
)
),
$data[$pos][$ids['posixAccount_createHomeDir']]); $data[$pos][$ids['posixAccount_createHomeDir']]);
$errors = array(); $errors = array();
if (($result != false) && (sizeof($result) == 1)) { if (($result != false) && (sizeof($result) == 1)) {

View File

@ -688,6 +688,7 @@ class quota extends baseModule {
* @param array $ids array(<column_name> => <column number>) * @param array $ids array(<column_name> => <column number>)
* @param array $failed list of accounts which were not created successfully * @param array $failed list of accounts which were not created successfully
* @param array $temp variable to store temporary data between two post actions * @param array $temp variable to store temporary data between two post actions
* @param array $accounts list of LDAP entries
* @return array current status * @return array current status
* <br> array ( * <br> array (
* <br> 'status' => 'finished' | 'inProgress' * <br> 'status' => 'finished' | 'inProgress'
@ -695,7 +696,7 @@ class quota extends baseModule {
* <br> 'errors' => array (<array of parameters for StatusMessage>) * <br> 'errors' => array (<array of parameters for StatusMessage>)
* <br> ) * <br> )
*/ */
function doUploadPostActions($data, $ids, $failed, &$temp) { function doUploadPostActions(&$data, $ids, $failed, &$temp, &$accounts) {
$errors = array(); $errors = array();
// first call, get list of user names and quota values // first call, get list of user names and quota values
if (!isset($temp['counter'])) { if (!isset($temp['counter'])) {

View File

@ -95,7 +95,7 @@ if (($_SESSION['mass_counter'] < sizeof($accounts)) || !isset($_SESSION['mass_po
// do post upload actions // do post upload actions
if ($_SESSION['mass_counter'] >= sizeof($accounts)) { if ($_SESSION['mass_counter'] >= sizeof($accounts)) {
$data = unserialize($_SESSION['ldap']->decrypt($_SESSION['mass_data'])); $data = unserialize($_SESSION['ldap']->decrypt($_SESSION['mass_data']));
$return = doUploadPostActions($_SESSION['mass_scope'], $data, $_SESSION['mass_ids'], $_SESSION['mass_failed'], $_SESSION['mass_selectedModules']); $return = doUploadPostActions($_SESSION['mass_scope'], $data, $_SESSION['mass_ids'], $_SESSION['mass_failed'], $_SESSION['mass_selectedModules'], $accounts);
if ($return['status'] == 'finished') { if ($return['status'] == 'finished') {
$_SESSION['mass_postActions']['finished'] = true; $_SESSION['mass_postActions']['finished'] = true;
} }
@ -107,7 +107,7 @@ if (($_SESSION['mass_counter'] < sizeof($accounts)) || !isset($_SESSION['mass_po
echo "</table>"; echo "</table>";
flush(); flush();
while (!isset($_SESSION['mass_postActions']['finished']) && (($startTime + $maxTime) > time())) { while (!isset($_SESSION['mass_postActions']['finished']) && (($startTime + $maxTime) > time())) {
$return = doUploadPostActions($_SESSION['mass_scope'], $data, $_SESSION['mass_ids'], $_SESSION['mass_failed'], $_SESSION['mass_selectedModules']); $return = doUploadPostActions($_SESSION['mass_scope'], $data, $_SESSION['mass_ids'], $_SESSION['mass_failed'], $_SESSION['mass_selectedModules'], $accounts);
if ($return['status'] == 'finished') { if ($return['status'] == 'finished') {
$_SESSION['mass_postActions']['finished'] = true; $_SESSION['mass_postActions']['finished'] = true;
} }