v.1.1 changes 16-04-2026:

- Minor changes to interface.
- Fixed different missing includes.
- Access now denied to api calls that are related to disabled modules.
- Fixed sorting of CPU and memory in server overview.
This commit is contained in:
2026-04-16 15:01:40 +02:00
parent 36b0ebd10c
commit eec1d13cf5
40 changed files with 26451 additions and 26428 deletions

1
.gitignore vendored
View File

@@ -2,4 +2,5 @@ pub/data/devices/*/documents/*
pub/data/devices/*/firmware/*
.idea/*
composer.*
CAcert.crt
pub/config.php

View File

@@ -0,0 +1 @@
v.1.1

View File

@@ -44,8 +44,11 @@ class API
public function __construct()
{
# Setup Database connection
require_once $_SERVER['DOCUMENT_ROOT'] . '/bin/php/db_connect.php';
include_once $_SERVER['DOCUMENT_ROOT'] . '/bin/php/Functions/globalFunctions.php';
# Setup Database connection
$this->conn = $GLOBALS['conn'];
if (!empty($_SESSION['user']['user_uuid'])) {
@@ -77,6 +80,9 @@ class API
}
}
# Get the enabled modules for the user
$GLOBALS['modules_enabled'] = getEnabledModules();
// Disable builder input for non-GET requests to prevent potential SQL injection vulnerabilities.
// Also disable the builder for users with the 'frontend' user type as an extra security measure.
// The builder should only be active for API users making GET requests.
@@ -98,7 +104,6 @@ class API
$this->user_type = 'frontend';
# Load the locale for the user, this is used for the return message in the frontend and other globalFunctions.
include_once $_SERVER['DOCUMENT_ROOT'] . '/bin/php/Functions/globalFunctions.php';
$locale = getPreferredLocale();
global $translations;
$translations = require $_SERVER['DOCUMENT_ROOT'] . "/bin/locales/{$locale}.php";

View File

@@ -2,11 +2,6 @@
use api\classes\API_companies;
if (!$GLOBALS['modules_enabled']['customers']) {
echo '405 Not Allowed';
exit;
}
session_start();
require_once $_SERVER['DOCUMENT_ROOT'] . '/api/classes/API_companies.php';
@@ -15,6 +10,10 @@ require_once $_SERVER['DOCUMENT_ROOT'] . '/api/classes/API_companies.php';
# Check permissions
$API_companies = new API_companies();
if (!$GLOBALS['modules_enabled']['customers']) {
echo '405 Not Allowed';
exit;
}
if ($API_companies->request_method === 'PUT') {
$API_companies->checkPermissions('customer-companies', 'RW');

View File

@@ -2,17 +2,17 @@
use api\classes\API_office_stompjes;
session_start();
require_once $_SERVER['DOCUMENT_ROOT'] . '/api/classes/API_office_stompjes.php';
$API_office_stompjes = new API_office_stompjes();
if (!$GLOBALS['modules_enabled']['office']) {
echo '405 Not Allowed';
exit;
}
session_start();
require_once $_SERVER['DOCUMENT_ROOT'] . '/api/classes/API_office_stompjes.php';
$API_office_stompjes = new API_office_stompjes();
if ($API_office_stompjes->request_method === 'POST') {
$API_office_stompjes->checkPermissions('ofice-stompjes-canstomp', 'RW');

View File

@@ -2,17 +2,17 @@
use api\classes\API_servers;
if (!$GLOBALS['modules_enabled']['servers']) {
echo '405 Not Allowed';
exit;
}
session_start();
require_once $_SERVER['DOCUMENT_ROOT'] . '/api/classes/API_servers.php';
$API_servers = new API_servers();
if (!$GLOBALS['modules_enabled']['servers']) {
echo '405 Not Allowed';
exit;
}
if ($API_servers->request_method === 'POST') {
$API_servers->checkPermissions('servers', 'RW');

View File

@@ -31,6 +31,7 @@ if (!$API_servers->checkPermissions('customer-companies', 'RO', true)) {
# JS Scripts to load for this page
$jsScriptLoadData['datepicker'] = true;
$jsScriptLoadData['breadCrumbs'] = true;
$jsScriptLoadData['delete_confirmation'] = true;
$jsScriptLoadData['datatables'] = true;
$jsScriptLoadData['multiFilterSelectServers'] = true;

View File

@@ -296,16 +296,17 @@ $pageNavbar->outPutNavbar();
</h2>
<div id="accordion">
<div class="card">
<?php foreach ($disks as $disk) { ?>
<a data-bs-toggle="collapse" data-bs-target="#collapse<?php echo $disk['disk_name'] ?>">
<div class="card-header py-1" id="heading<?php echo $disk['disk_name'] ?>">
<?php foreach ($disks as $i => $disk) {
$collapseId = 'collapseDisk' . $i; ?>
<a data-bs-toggle="collapse" data-bs-target="#collapse<?php echo $collapseId ?>">
<div class="card-header py-1" id="heading<?php echo $collapseId ?>">
<h4 class="mb-0">
<i class="fa-solid fa-hard-drive text-secondary"></i> <?php echo $disk['disk_name'] ?>
</h4>
</div>
</a>
<div id="collapse<?php echo $disk['disk_name'] ?>" class="collapse" data-parent="#accordion">
<div id="collapse<?php echo $collapseId ?>" class="collapse" data-parent="#accordion">
<div class="card-body">
<table class="table table-borderless table-sm">
<tr>

View File

@@ -47,7 +47,7 @@ $stmt->execute([$user_group_uuid]);
$group_permissions = $stmt->fetchAll(PDO::FETCH_ASSOC);
# Set breadcrumb data
array_push($GLOBALS['breadCrumbArray'], array('display' => __('user_gr1oups'), 'href' => '/accesscontrol/#user-groups'));
array_push($GLOBALS['breadCrumbArray'], array('display' => __('user_groups'), 'href' => '/accesscontrol/#user-groups'));
array_push($GLOBALS['breadCrumbArray'], array('display' => $user_group['user_group_name'], 'href' => ''));
# Start page output

View File

@@ -102,7 +102,6 @@ $pageNavbar->outPutNavbar();
<div class="card">
<div class="card-body">
<h1 class="">Inserve actions</h1>
<hr>
<div class="row row-cols-1 row-cols-md-3 g-2">
<?php if ($GLOBALS['modules_enabled']['customers'] && $API->checkPermissions('customer-companies', 'RW', true)) { ?>
<div class="col">
@@ -112,11 +111,13 @@ $pageNavbar->outPutNavbar();
<form method="post" action="/api/v1/sources/inserve/sync-companies/">
<input type="hidden" name="_return" value="/system/sources/inserve">
<p class="card-text">This API call retrieves all companies from Inserve and creates or updates them in Sentri.</p>
<button class="btn btn-primary">
<i class="fa-solid fa-arrow-rotate-right"></i> &nbsp;Sync.
</button>
</form>
</div>
<div class="card-footer">
<button class="btn btn-primary">
<i class="fa-solid fa-arrow-rotate-right"></i> &nbsp;Sync.
</button>
</div>
</div>
</div>
<?php } ?>
@@ -129,11 +130,13 @@ $pageNavbar->outPutNavbar();
<form method="post" action="/api/v1/sources/inserve/sync-cloud-distributor/">
<input type="hidden" name="_return" value="/system/sources/inserve">
<p class="card-text">This API call synchronizes active companies in Sentri with the corresponding cloud distributor companies in Inserve. These cloud distributor companies are required to associate Sentri server licenses with companies in Inserve.</p>
<button class="btn btn-primary">
<i class="fa-solid fa-arrow-rotate-right"></i> &nbsp;Sync
</button>
</form>
</div>
<div class="card-footer">
<button class="btn btn-primary">
<i class="fa-solid fa-arrow-rotate-right"></i> &nbsp;Sync
</button>
</div>
</div>
</div>
<?php } ?>
@@ -146,11 +149,13 @@ $pageNavbar->outPutNavbar();
<form method="post" action="/api/v1/sources/inserve/sync-server-licenses/">
<input type="hidden" name="_return" value="/system/sources/inserve">
<p class="card-text">This API call first executes the sync-cloud-distributor action and then synchronizes all servers in an active, deleted, or trial state with Inserve licenses. It creates or updates server licenses in Inserve if they do not exist or if the license quantities differ from those in Sentri.</p>
<button class="btn btn-primary">
<i class="fa-solid fa-arrow-rotate-right"></i> &nbsp;Sync
</button>
</form>
</div>
<div class="card-footer">
<button class="btn btn-primary">
<i class="fa-solid fa-arrow-rotate-right"></i> &nbsp;Sync
</button>
</div>
</div>
</div>
<?php } ?>
@@ -159,3 +164,4 @@ $pageNavbar->outPutNavbar();
</div>
</div>
</div>
</div>

View File

@@ -291,8 +291,10 @@ class serverOverviewBuilder
if ($mem == 0 && $demand == 0) {
$mem_assigned = 'N/A';
$mem_assigned_sort = 0;
} else {
$mem_assigned = $this->cleanNumber($mem) . "M";
$mem_assigned_sort = $this->cleanNumber($mem);
}
$mem_demand_text_color = '';
@@ -315,7 +317,15 @@ class serverOverviewBuilder
} else {
$mem_demand = "N/A";
$mem_percent_numb = 'N/A';
$mem_percent_sort = -1;
$mem_percent_sort = 0;
}
if ($server['server_cpu']) {
$server_cpu = htmlspecialchars($server['server_cpu']);
$server_cpu_sort = (int)$server_cpu;
} else {
$server_cpu = "N/A";
$server_cpu_sort = 0;
}
$ipv4_list = '';
@@ -390,9 +400,8 @@ class serverOverviewBuilder
</td>
<?php } ?>
<td data-column="server_os" class="text-nowrap"><?php echo $server['server_os'] ?></td>
<td data-column="server_cpu" class="text-nowrap"><?php echo $server['server_cpu'] ?>
</td>
<td data-column="server_memory" class="text-nowrap" data-filter="<?php echo htmlspecialchars($mem); ?>" data-sort="<?php echo htmlspecialchars($mem); ?>">
<td data-column="server_cpu" class="text-nowrap" data-filter="<?php echo $server_cpu ?>" data-sort="<?php echo $server_cpu_sort ?>"><?php echo $server_cpu ?></td>
<td data-column="server_memory" class="text-nowrap" data-filter="<?php echo $mem_assigned; ?>" data-sort="<?php echo $mem_assigned_sort; ?>">
<?php echo $mem_assigned ?>
</td>