1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-13 18:14:26 +02:00

Issue #5476 - Emulation mode. (beta)

This commit is contained in:
camer0n
2025-04-21 17:03:52 -07:00
parent 5275acdacd
commit effb433b1d
2 changed files with 58 additions and 0 deletions

View File

@@ -182,6 +182,13 @@ JS;
->setMode('main')
->setAction('logoutas');
break;
case 'emulate':
$this->getRequest()
->setQuery(array())
->setMode('main')
->setAction('emulate');
break;
// redirect to AdminObserver/AdminPage()
case 'admin':
@@ -862,6 +869,26 @@ class users_admin_ui extends e_admin_ui
{
// System Message only on non-successful logout as another user
}
/**
* Allows the emulation of a user ID if the current user has sufficient permissions and a user ID is provided.
* If the conditions are met, a message with the emulated User ID is displayed, and the session is updated to emulate the specified user ID.
*
* @return void
*/
public function emulatePage()
{
if(getperms('0') && !empty($_POST['userid']))
{
e107::getMessage()->addInfo("Emulating User ID".print_a($_POST,true));
e107::getSession()->set('emulate', (int) $_POST['userid']);
}
$this->redirect('list', 'main', true);
}
/**
* Remove admin status trigger
@@ -2723,6 +2750,8 @@ class users_admin_form_ui extends e_admin_form_ui
// login/logout As
if(getperms('0') && !($row['user_admin'] && getperms('0', $row['user_perms'])))
{
$opts['emulate'] = 'Emulate Permissions';
if(e107::getUser()->getSessionDataAs() == $row['user_id'])
{
// $text .= "<option value='logoutas'>".sprintf(USRLAN_AS_2, $row['user_name'])."</option>";