import of users does not issue an error if a group column isn't set

This commit is contained in:
Uwe Steinmann 2020-09-14 10:40:00 +02:00
parent 84a849a28f
commit 3945ae54b9
2 changed files with 14 additions and 5 deletions

View File

@ -4,6 +4,7 @@
- fix import of users - fix import of users
- major rework of scripts in utils, unify reading of settings, use PHP_EOL - major rework of scripts in utils, unify reading of settings, use PHP_EOL
- allow inline editing of document name - allow inline editing of document name
- import of users does not issue an error if a group column isn't set
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
Changes in version 5.1.19 Changes in version 5.1.19

View File

@ -70,6 +70,10 @@ function renderFolderData($colname, $objdata) { /* {{{ */
function getGroupData($colname, $coldata, $objdata) { /* {{{ */ function getGroupData($colname, $coldata, $objdata) { /* {{{ */
global $dms; global $dms;
/* explode column name to extract index of group. Actually, the whole column
* name could be used as well, as it is just a unique index in the array
* of groups.
*/
$kk = explode('_', $colname); $kk = explode('_', $colname);
if(count($kk) == 2) if(count($kk) == 2)
$gn = $kk[1]; $gn = $kk[1];
@ -77,11 +81,15 @@ function getGroupData($colname, $coldata, $objdata) { /* {{{ */
$gn = '1'; $gn = '1';
if(!isset($objdata['groups'])) if(!isset($objdata['groups']))
$objdata['groups'] = []; $objdata['groups'] = [];
if($group = $dms->getGroupByName($coldata)) { /* $coldata can be empty, if an imported users is assigned to less groups
$objdata['groups'][$gn] = $group; * than group columns exists.
} else { */
// $objdata['groups'][$gn] = null; if($coldata) {
$objdata['__logs__'][] = array('type'=>'error', 'msg'=> "No such group with name '".$coldata."'"); if($group = $dms->getGroupByName($coldata)) {
$objdata['groups'][$gn] = $group;
} else {
$objdata['__logs__'][] = array('type'=>'error', 'msg'=> "No such group with name '".$coldata."'");
}
} }
return $objdata; return $objdata;
} /* }}} */ } /* }}} */