Files
reflector-dashboard/auth/lib/acl.php
T

26 lines
1.1 KiB
PHP

<?php
/*
* SvxPortal — web front-end for SvxReflector
* Copyright (C) 2026 SA7AUX (Björn)
* SPDX-License-Identifier: AGPL-3.0-or-later
*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License as published by the Free
* Software Foundation, either version 3 of the License, or (at your option) any
* later version. See the LICENSE file for details.
*/
declare(strict_types=1);
// acl.php — shared PHP helper for every web (dmr-web, svx-web).
// Canonical copy: <dmr-portal>/auth/lib/acl.php; other repos carry a COPY.
// Admin-on-admin checks. Needs acct_admin_level() and json_out() from the site.
// An admin may change another account only when their own level is strictly
// higher (and may always change themselves).
function require_privilege(string $acting_uuid, int $acting_level, string $target_uuid): void {
if ($target_uuid === $acting_uuid) return;
$target_level = acct_admin_level($target_uuid);
if ($target_level >= $acting_level) {
json_out(['ok' => false, 'error' => 'insufficient_privilege'], 403);
}
}