mirror of
https://github.com/getnamingo/registry.git
synced 2025-05-29 17:00:06 +02:00
Better logging in the CP
This commit is contained in:
parent
b187816e3d
commit
dc5844688b
2 changed files with 109 additions and 8 deletions
|
@ -192,6 +192,22 @@ class SystemController extends Controller
|
|||
return $response->withHeader('Location', '/registry')->withStatus(302);
|
||||
}
|
||||
|
||||
$currentDateTime = new \DateTime();
|
||||
$currentDate = $currentDateTime->format('Y-m-d H:i:s.v'); // Current timestamp
|
||||
$db->insert(
|
||||
'users_audit',
|
||||
[
|
||||
'user_id' => $_SESSION['auth_user_id'],
|
||||
'user_event' => 'settings.update',
|
||||
'user_resource' => 'control.panel',
|
||||
'user_agent' => $_SERVER['HTTP_USER_AGENT'],
|
||||
'user_ip' => get_client_ip(),
|
||||
'user_location' => get_client_location(),
|
||||
'event_time' => $currentDate,
|
||||
'user_data' => null
|
||||
]
|
||||
);
|
||||
|
||||
$this->container->get('flash')->addMessage('success', 'Registry details have been updated successfully');
|
||||
return $response->withHeader('Location', '/registry')->withStatus(302);
|
||||
|
||||
|
@ -560,6 +576,22 @@ class SystemController extends Controller
|
|||
return $response->withHeader('Location', '/registry/tld/create')->withStatus(302);
|
||||
}
|
||||
|
||||
$currentDateTime = new \DateTime();
|
||||
$currentDate = $currentDateTime->format('Y-m-d H:i:s.v'); // Current timestamp
|
||||
$db->insert(
|
||||
'users_audit',
|
||||
[
|
||||
'user_id' => $_SESSION['auth_user_id'],
|
||||
'user_event' => 'tld.created',
|
||||
'user_resource' => 'control.panel',
|
||||
'user_agent' => $_SERVER['HTTP_USER_AGENT'],
|
||||
'user_ip' => get_client_ip(),
|
||||
'user_location' => get_client_location(),
|
||||
'event_time' => $currentDate,
|
||||
'user_data' => null
|
||||
]
|
||||
);
|
||||
|
||||
$this->container->get('flash')->addMessage('success', 'TLD ' . $data['extension'] . ' has been created successfully');
|
||||
return $response->withHeader('Location', '/registry/tlds')->withStatus(302);
|
||||
}
|
||||
|
@ -886,6 +918,22 @@ class SystemController extends Controller
|
|||
unset($_SESSION['u_tld_id']);
|
||||
unset($_SESSION['u_tld_extension']);
|
||||
|
||||
$currentDateTime = new \DateTime();
|
||||
$currentDate = $currentDateTime->format('Y-m-d H:i:s.v'); // Current timestamp
|
||||
$db->insert(
|
||||
'users_audit',
|
||||
[
|
||||
'user_id' => $_SESSION['auth_user_id'],
|
||||
'user_event' => 'tld.updated',
|
||||
'user_resource' => 'control.panel',
|
||||
'user_agent' => $_SERVER['HTTP_USER_AGENT'],
|
||||
'user_ip' => get_client_ip(),
|
||||
'user_location' => get_client_location(),
|
||||
'event_time' => $currentDate,
|
||||
'user_data' => null
|
||||
]
|
||||
);
|
||||
|
||||
$this->container->get('flash')->addMessage('success', 'TLD ' . $tld_extension . ' has been updated successfully');
|
||||
return $response->withHeader('Location', '/registry/tld/'.$tld_extension)->withStatus(302);
|
||||
} catch (Exception $e) {
|
||||
|
@ -1092,6 +1140,22 @@ class SystemController extends Controller
|
|||
return $response->withHeader('Location', '/registry/reserved')->withStatus(302);
|
||||
}
|
||||
|
||||
$currentDateTime = new \DateTime();
|
||||
$currentDate = $currentDateTime->format('Y-m-d H:i:s.v'); // Current timestamp
|
||||
$db->insert(
|
||||
'users_audit',
|
||||
[
|
||||
'user_id' => $_SESSION['auth_user_id'],
|
||||
'user_event' => 'reserved.updated',
|
||||
'user_resource' => 'control.panel',
|
||||
'user_agent' => $_SERVER['HTTP_USER_AGENT'],
|
||||
'user_ip' => get_client_ip(),
|
||||
'user_location' => get_client_location(),
|
||||
'event_time' => $currentDate,
|
||||
'user_data' => null
|
||||
]
|
||||
);
|
||||
|
||||
$this->container->get('flash')->addMessage('success', 'Reserved names have been updated successfully');
|
||||
return $response->withHeader('Location', '/registry/reserved')->withStatus(302);
|
||||
|
||||
|
|
|
@ -143,11 +143,48 @@
|
|||
placeholder: "{{ __('No log data for user.') }}",
|
||||
columns: [
|
||||
{formatter:"responsiveCollapse", width:30, minWidth:30, hozAlign:"center", resizable:false, headerSort:false, responsive:0},
|
||||
{title: "{{ __('Event') }}", field: "user_event", minWidth:30, width:120, resizable:false, headerSort:false, responsive:0},
|
||||
{title: "{{ __('User Agent') }}", field: "user_agent", minWidth:30, width:500, resizable:false, headerSort:false, responsive:2},
|
||||
{title: "{{ __('IP') }}", field: "user_ip", minWidth:30, width:150, resizable:false, headerSort:false, responsive:0},
|
||||
{title: "{{ __('Location') }}", field: "user_location", minWidth:30, width:100, resizable:false, headerSort:false, responsive:0},
|
||||
{title: "{{ __('Timestamp') }}", field: "event_time", minWidth:30, width:250, resizable:false, headerSort:false, responsive:0},
|
||||
{
|
||||
title: "{{ __('Event') }}",
|
||||
field: "user_event",
|
||||
minWidth: 30,
|
||||
width: 120,
|
||||
resizable: false,
|
||||
headerSort: false,
|
||||
responsive: 0,
|
||||
formatter: function(cell) {
|
||||
const value = cell.getValue();
|
||||
return `<span title="${value}">${value}</span>`;
|
||||
},
|
||||
},
|
||||
{
|
||||
title: "{{ __('User Agent') }}",
|
||||
field: "user_agent",
|
||||
minWidth: 30,
|
||||
width: 300,
|
||||
resizable: false,
|
||||
headerSort: false,
|
||||
responsive: 2,
|
||||
formatter: function(cell) {
|
||||
const value = cell.getValue();
|
||||
return `<span title="${value}">${value}</span>`;
|
||||
},
|
||||
},
|
||||
{title: "{{ __('IP') }}", field: "user_ip", minWidth:30, width:120, resizable:false, headerSort:false, responsive:2},
|
||||
{
|
||||
title: "{{ __('Location') }}",
|
||||
field: "user_location",
|
||||
minWidth: 30,
|
||||
width: 100,
|
||||
resizable: false,
|
||||
headerSort: false,
|
||||
responsive: 0,
|
||||
formatter: function(cell) {
|
||||
const countryCode = cell.getValue(); // Get the location code, e.g., "UA"
|
||||
return `<span class="flag flag-country-${countryCode.toLowerCase()}" title="${countryCode}"></span>`;
|
||||
},
|
||||
},
|
||||
{title: "{{ __('Timestamp') }}", field: "event_time", minWidth:30, width:250, resizable:false, headerSort:false, responsive:2},
|
||||
{title: "{{ __('User Log') }}", field: "user_data", minWidth:30, width:300, resizable:false, headerSort:false, responsive:0},
|
||||
]
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue