Compare commits

..

4 Commits

Author SHA1 Message Date
Clemens Schwaighofer
fc105f9295 Add ACL Login lookup edit access id to edit access cuid 2025-01-16 14:36:11 +09:00
Clemens Schwaighofer
053ab69330 Add edit access cuuid to the unit detail list 2025-01-16 14:04:30 +09:00
Clemens Schwaighofer
fd079316f5 ACL Login: Add edit_access_id to unit detail block
This is needed for a lot of legacy data lookup
2025-01-16 13:55:17 +09:00
Clemens Schwaighofer
08664e9834 Update log writing for login info
Fix the deprecated message in the Admin/Backend one with a full sample
Update the admin_header include sample page with the corret writeLog call
2025-01-16 10:40:41 +09:00
4 changed files with 25 additions and 2 deletions

View File

@@ -1531,6 +1531,12 @@ final class CoreLibsACLLoginTest extends TestCase
$login_mock->loginGetEditAccessCuidFromUid($mock_settings['edit_access_uid']),
'Assert check access uid to cuid valid'
);
// - loginGetEditAccessCuidFromId
$this->assertEquals(
$expected['check_access_cuid'],
$login_mock->loginGetEditAccessCuidFromUid($mock_settings['edit_access_id']),
'Assert check access id to cuid valid'
);
// Deprecated
// - loginCheckEditAccess
$this->assertEquals(

View File

@@ -116,7 +116,7 @@ $data = [
// log action
// no log if login
if (!$login->loginActionRun()) {
$login->writeLog('Submit', $data, $cms->adbGetActionSet(), 'BINARY');
$login->writeLog('Submit', $data, action_set:$cms->adbGetActionSet(), write_type:'BINARY');
}
//------------------------------ logging end

View File

@@ -1418,6 +1418,7 @@ class Login
'additional_acl' => Json::jsonConvertToArray($res['additional_acl']),
'data' => $ea_data
];
// LEGACY LOOKUP
$unit_access_eaid[$res['edit_access_id']] = [
'cuid' => $res['cuid'],
];
@@ -1552,8 +1553,10 @@ class Login
$this->acl['unit_legacy'][$unit['id']] = $this->acl['unit'][$ea_cuid];
// detail name/level set
$this->acl['unit_detail'][$ea_cuid] = [
'id' => $unit['id'],
'name' => $unit['name'],
'uid' => $unit['uid'],
'cuuid' => $unit['cuuid'],
'level' => $this->default_acl_list[$this->acl['unit'][$ea_cuid]]['name'] ?? -1,
'default' => $unit['default'],
'data' => $unit['data'],
@@ -3277,6 +3280,20 @@ HTML;
return (int)$_SESSION['LOGIN_UNIT_CUID'][$uid];
}
/**
* Legacy lookup for edit access id to cuid
*
* @param int $id edit access id PK
* @return string|false edit access cuid or false if not found
*/
public function loginGetEditAccessCuidFromId(int $id): string|false
{
if (!isset($_SESSION['LOGIN_UNIT_ACL_LEVEL'][$id])) {
return false;
}
return (string)$_SESSION['LOGIN_UNIT_ACL_LEVEL'][$id]['cuid'];
}
/**
* Check if admin flag is set
*

View File

@@ -289,7 +289,7 @@ class Backend
* JSON, STRING/SERIEAL, BINARY/BZIP or ZLIB
* @param string|null $db_schema [default=null] override target schema
* @return void
* @deprecated Use $login->writeLog() and set action_set from ->adbGetActionSet()
* @deprecated Use $login->writeLog($event, $data, action_set:$cms->adbGetActionSet(), write_type:$write_type)
*/
public function adbEditLog(
string $event = '',