Files
deskhub/DeskHub-Webseite/api/staff/v1/web_pages.php
T
2026-10-23 17:22:28 +00:00

22 lines
680 B
PHP

<?php
declare(strict_types=1);
require_once __DIR__ . '/common.php';
require_once __DIR__ . '/../../../includes/web_handoff.php';
api_require_method('GET', 'POST');
$staff = api_require_staff();
$pdo = get_db();
if ($_SERVER['REQUEST_METHOD'] === 'GET') {
// Welche Seiten der Weboberfläche darf dieser Mitarbeiter über die App öffnen?
api_json(['pages' => web_handoff_pages($staff)]);
}
$body = api_request_body();
$path = trim((string) ($body['path'] ?? ''));
$url = $path !== '' ? web_handoff_create($pdo, $staff, $path) : null;
if ($url === null) {
api_error(403, 'PAGE_NOT_ALLOWED', 'Diese Seite darf nicht geöffnet werden.');
}
api_json(['url' => $url]);