fix for file upload

This commit is contained in:
Roland Gruber 2018-03-04 09:37:32 +01:00
parent f9e6247158
commit 1a37568520
2 changed files with 30 additions and 26 deletions

View File

@ -1124,7 +1124,7 @@ class posixAccount extends baseModule implements passwordService {
} }
} }
// id-number is in use and account is a new account // id-number is in use and account is a new account
if ((in_array($this->attributes['uidNumber'][0], $uids)) && !isset($this->orig['uidNumber'][0])) $errors[] = array('ERROR', _('ID-Number'), _('ID is already in use')); if ((in_array($this->attributes['uidNumber'][0], $uids)) && !isset($this->orig['uidNumber'][0])) $errors[] = $this->messages['uidNumber'][3];
// id-number is in use, account is existing account and id-number is not used by itself // id-number is in use, account is existing account and id-number is not used by itself
if ((in_array($this->attributes['uidNumber'][0], $uids)) && isset($this->orig['uidNumber'][0]) && ($this->orig['uidNumber'][0] != $this->attributes['uidNumber'][0]) ) { if ((in_array($this->attributes['uidNumber'][0], $uids)) && isset($this->orig['uidNumber'][0]) && ($this->orig['uidNumber'][0] != $this->attributes['uidNumber'][0]) ) {
$errors[] = $this->messages['uidNumber'][3]; $errors[] = $this->messages['uidNumber'][3];
@ -2155,7 +2155,7 @@ class posixAccount extends baseModule implements passwordService {
)); ));
} }
if (($this->get_scope() == 'user') && !$this->isBooleanConfigOptionSet('posixAccount_' . $typeId . '_hidegecos')) { if (($this->get_scope() == 'user') && !$this->isBooleanConfigOptionSet('posixAccount_' . $typeId . '_hidegecos')) {
$return['upload_columns'][] = array( $return[] = array(
'name' => 'posixAccount_gecos', 'name' => 'posixAccount_gecos',
'description' => _('Gecos'), 'description' => _('Gecos'),
'help' => 'gecos', 'help' => 'gecos',
@ -2163,7 +2163,7 @@ class posixAccount extends baseModule implements passwordService {
); );
} }
if (($this->get_scope() == 'host') && !$this->isBooleanConfigOptionSet('posixAccount_' . $typeId . '_hidegecos')) { if (($this->get_scope() == 'host') && !$this->isBooleanConfigOptionSet('posixAccount_' . $typeId . '_hidegecos')) {
$return['upload_columns'][] = array( $return[] = array(
'name' => 'posixAccount_gecos', 'name' => 'posixAccount_gecos',
'description' => _('Gecos'), 'description' => _('Gecos'),
'help' => 'gecos', 'help' => 'gecos',
@ -2584,6 +2584,7 @@ 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'])];
try {
$remote = new \LAM\REMOTE\Remote(); $remote = new \LAM\REMOTE\Remote();
$remote->connect($data[$pos][$ids['posixAccount_createHomeDir']]); $remote->connect($data[$pos][$ids['posixAccount_createHomeDir']]);
$result = $remote->execute( $result = $remote->execute(
@ -2607,6 +2608,10 @@ class posixAccount extends baseModule implements passwordService {
$errors[] = $parts; $errors[] = $parts;
} }
} }
}
catch (LAMException $e) {
$errors[] = array('ERROR', $e->getTitle(), $e->getMessage());
}
$temp['counter']++; $temp['counter']++;
return array ( return array (
'status' => 'inProgress', 'status' => 'inProgress',

View File

@ -1,10 +1,9 @@
<?php <?php
namespace LAM\AJAX; namespace LAM\AJAX;
/* /*
$Id$
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/) This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
Copyright (C) 2011 - 2017 Roland Gruber Copyright (C) 2011 - 2018 Roland Gruber
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by