add config switch to disabled impersonate

This commit is contained in:
HB9HIL
2024-08-19 21:07:26 +02:00
parent f52323b6b3
commit 5d2b8c998e
4 changed files with 45 additions and 3 deletions

View File

@@ -669,4 +669,17 @@ $config['disable_oqrs'] = false;
$config['special_callsign'] = false;
// hides the usermenu; takes action only if "special_callsign" is true
$config['sc_hide_usermenu'] = true;
$config['sc_hide_usermenu'] = true;
/*
|--------------------------------------------------------------------------
| Impersonate
|--------------------------------------------------------------------------
|
| This config switch disables the impersonate feature. This feauture is used to impersonate another user.
| Impersonate is enabled by default. To disable it, set the value to false.
|
*/
$config['disable_impersonate'] = false;

View File

@@ -15,6 +15,13 @@ class User extends CI_Controller {
$data['results'] = $this->user_model->users();
$data['session_uid'] = $this->session->userdata('user_id');
// Check if impersonating is disabled in the config
if ($this->config->item('disable_impersonate')) {
$data['disable_impersonate'] = true;
} else {
$data['disable_impersonate'] = false;
}
// Get Date format
if($this->session->userdata('user_date_format')) {
// If Logged in and session exists
@@ -1175,6 +1182,11 @@ class User extends CI_Controller {
public function impersonate() {
// Check if impersonating is disabled in the config
if ($this->config->item('disable_impersonate')) {
show_404();
}
// Load the encryption library
if (!$this->load->is_loaded('encryption')) {
$this->load->library('encryption');

View File

@@ -51,7 +51,9 @@
<th></th>
<th style="text-align: center; vertical-align: middle;" scope="col"><?= __("Edit"); ?></th>
<th style="text-align: center; vertical-align: middle;" scope="col"><?= __("Password Reset"); ?></th>
<th style="text-align: center; vertical-align: middle;" scope="col"><?= __("Impersonate"); ?></th>
<?php if (!$disable_impersonate) { ?>
<th style="text-align: center; vertical-align: middle;" scope="col"><?= __("Impersonate"); ?></th>
<?php } ?>
<th style="text-align: center; vertical-align: middle;" scope="col"><?= __("Delete"); ?></th>
</tr>
</thead>
@@ -97,6 +99,7 @@
echo '<a class="btn btn-primary btn-sm ms-1 admin_pwd_reset" data-username="' . $row->user_name . '" data-callsign="' . $row->user_callsign . '" data-userid="' . $row->user_id . '" data-usermail="' . $row->user_email . '"><i class="fas fa-key"></i></a>';
}
?></td>
<?php if (!$disable_impersonate) { ?>
<td style="text-align: center; vertical-align: middle;">
<?php
if ($session_uid != $row->user_id) { ?>
@@ -154,6 +157,7 @@
<?php }
?>
</td>
<?php } ?>
<td style="text-align: center; vertical-align: middle;">
<?php
if ($session_uid != $row->user_id) {

View File

@@ -669,4 +669,17 @@ $config['disable_oqrs'] = false;
$config['special_callsign'] = false;
// hides the usermenu; takes action only if "special_callsign" is true
$config['sc_hide_usermenu'] = true;
$config['sc_hide_usermenu'] = true;
/*
|--------------------------------------------------------------------------
| Impersonate
|--------------------------------------------------------------------------
|
| This config switch disables the impersonate feature. This feauture is used to impersonate another user.
| Impersonate is enabled by default. To disable it, set the value to false.
|
*/
$config['disable_impersonate'] = false;