fix import of role

This commit is contained in:
Uwe Steinmann 2020-09-03 14:22:11 +02:00
parent a78800e036
commit 480a130180

View File

@ -99,26 +99,21 @@ function renderGroupData($colname, $objdata) { /* {{{ */
} /* }}} */ } /* }}} */
function getRoleData($colname, $coldata, $objdata) { /* {{{ */ function getRoleData($colname, $coldata, $objdata) { /* {{{ */
switch($coldata) { global $dms;
case 'admin': if($role = $dms->getRoleByName($coldata)) {
$role = 1; $objdata['role'] = $role;
break; } else {
case 'guest': $objdata['role'] = null;
$role = 2;
break;
case 'user':
$role = 0;
break;
default:
$role = 0;
$objdata['__logs__'][] = array('type'=>'error', 'msg'=> "No such role with name '".$coldata."'"); $objdata['__logs__'][] = array('type'=>'error', 'msg'=> "No such role with name '".$coldata."'");
} }
$objdata['role'] = $role;
return $objdata; return $objdata;
} /* }}} */ } /* }}} */
function renderRoleData($colname, $objdata) { /* {{{ */ function renderRoleData($colname, $objdata) { /* {{{ */
return ($objdata[$colname] == 1 ? 'admin' : ($objdata[$colname] == 2 ? 'guest' : 'user')); $html = '';
if($objdata[$colname])
$html .= $objdata[$colname]->getName();
return $html;
} /* }}} */ } /* }}} */
if (!$user->isAdmin()) { if (!$user->isAdmin()) {