Bug fixes in ACL\Login and DB\IO\Extended

This commit is contained in:
Clemens Schwaighofer
2022-04-22 15:32:06 +09:00
parent d0e294ecf5
commit 43b51895f0
2 changed files with 6 additions and 5 deletions

View File

@@ -885,13 +885,13 @@ class Login
$this->acl['show_ea_extra'] = false;
}
// set the default edit access
$this->acl['default_edit_access'] = $_SESSION['UNIT_DEFAULT'];
$this->acl['default_edit_access'] = $_SESSION['UNIT_DEFAULT'] ?? null;
// integrate the type acl list, but only for the keyword -> level
foreach ($this->default_acl_list as $level => $data) {
$this->acl['min'][$data['type']] = $level;
}
// set the full acl list too
$this->acl['acl_list'] = $_SESSION['DEFAULT_ACL_LIST'];
$this->acl['acl_list'] = $_SESSION['DEFAULT_ACL_LIST'] ?? [];
// debug
// $this->debug('ACL', $this->print_ar($this->acl));
}
@@ -1453,7 +1453,8 @@ EOM;
* checks that the given edit access id is valid for this user
* @param int|null $edit_access_id edit access id to check
* @return int|null same edit access id if ok
* or the default edit access id if given one is not valid
* or the default edit access id
* if given one is not valid
*/
public function loginCheckEditAccessId(?int $edit_access_id): ?int
{
@@ -1463,7 +1464,7 @@ EOM;
is_array($_SESSION['UNIT']) &&
!array_key_exists($edit_access_id, $_SESSION['UNIT'])
) {
return (int)$_SESSION['UNIT_DEFAULT'];
return $_SESSION['UNIT_DEFAULT'] ?? null;
} else {
return $edit_access_id;
}

View File

@@ -503,7 +503,7 @@ class ArrayIO extends \CoreLibs\DB\IO
// max id, falls INSERT
$q = 'SELECT MAX(' . $this->pk_name . ') + 1 AS pk_id FROM ' . $this->table_name;
if (is_array($res = $this->dbReturnRow($q))) {
$pk_id = $res['pkd_id'];
$pk_id = $res['pk_id'];
} else {
$pk_id = 1;
}