Plan device actions exclusively as approved scripts and provide reboot library revisions

This commit is contained in:
2026-11-18 12:04:58 +01:00
parent adc04f0148
commit cd80bfc704
31 changed files with 1014 additions and 779 deletions
+20 -2
View File
@@ -15,6 +15,7 @@ import {
import { AdminControl } from './management';
import { allowed } from './safety';
import { CatalogCheckNotice } from './catalog-check';
import { devicePlatform } from './script-catalog';
import { ErrorBox, errorText, useResource } from './resource';
import { NavIcon, orderDetailRoute } from './navigation';
import { orderTitle, Status } from './order-presentation';
@@ -115,6 +116,22 @@ function devicePath(customer: string, asset: string) {
return tenantPath(customer, '/devices/' + encodeURIComponent(asset));
}
function reportedScriptProfiles(device: RecordValue) {
const os = devicePlatform(device);
if (!os || !Array.isArray(device.capabilities)) return 'Nicht gemeldet';
const caps = new Set(device.capabilities);
if (!caps.has('run_script')) return 'Nicht gemeldet';
const windows = os === 'windows';
const identity = windows ? 'system' : 'root';
const service = windows ? 'PowerShell als Dienstkonto' : 'Shell als Dienstkonto';
if (!caps.has(os + '.base/1') || caps.has(windows ? 'linux.base/1' : 'windows.base/1')) return 'Nicht gemeldet';
if (windows && !['rmm.sync.v1', 'script.powershell/1', 'script.powershell.process_remote_signed/1'].every(cap => caps.has(cap)))
return 'Nicht gemeldet';
const admin = ['rmm.sync.v1', 'script.full_maintenance/1', 'helper.' + identity + '.v1', identity + ':run_script']
.every(capability => caps.has(capability));
return admin ? service + ' und als Administrator (' + (windows ? 'SYSTEM' : 'root') + ')' : service;
}
function DeviceDetail({
customer,
asset,
@@ -158,7 +175,8 @@ function DeviceDetail({
['Speicher frei / gesamt', capacity(d.disk_free_bytes, d.disk_total_bytes)],
['Letzter Kontakt', time(d.last_contact_at)],
['Inventar erhoben', time(d.observed_at)],
['Agentversion', label(d.agent_version)]
['Agentversion', label(d.agent_version)],
['Vom Agenten gemeldete Skriptausführung', reportedScriptProfiles(d)]
];
return (
<div className="device-detail">
@@ -654,7 +672,7 @@ export function Devices({
<button className="quiet" onClick={() => onSelection({ customer: '', ids: [] })}>
Auswahl aufheben
</button>
<button disabled={!allowed(auth, 'operations:plan')} onClick={onCreateOrder}>Auftrag erstellen</button>
<button disabled={!allowed(auth, 'operations:plan') || !allowed(auth, 'scripts:execute')} onClick={onCreateOrder}>Auftrag erstellen</button>
</div>
)}
</>