1
0
mirror of https://github.com/e107inc/e107.git synced 2025-07-31 20:00:37 +02:00

Issue #5064 - Draft fix for user impersonation (getperms())

This commit is contained in:
camer0n
2023-09-08 14:18:06 -07:00
parent 1ef0cc3352
commit 44526b435c
5 changed files with 104 additions and 6 deletions

View File

@@ -1317,8 +1317,17 @@ function check_class($var, $userclass = null, $uid = 0)
function getperms($arg, $ap = ADMINPERMS, $path = e_SELF)
{
// $ap = "4"; // Just for testing.
if(trim($ap) === '')
{
return false;
}
if(!deftrue('ADMIN') || trim($ap) === '')
if(deftrue('USE_NEW_GETPERMS')) // Add to e107_config.php.
{
return e107::getUser()->checkAdminPerms($arg,$ap,$path);
}
if(!deftrue('ADMIN'))
{
return false;
}
@@ -1630,6 +1639,13 @@ function init_session()
define('USERJOINED', '');
define('e_CLASS_REGEXP', '(^|,)(253|254|250|251|0)(,|$)');
define('e_NOBODY_REGEXP', '(^|,)255(,|$)');
/* $user->set('user_id', 1);
$user->set('user_name','e107-cli');
$user->set('user_admin', 1);
$user->set('user_perms', '0');
$user->set('user_class', '');
$user->set('user_join', '');*/
return;
}