Some checks failed
CI / PHP 8.4 / mariadb:10.6 (pull_request) Successful in 1m37s
CI / PHP 8.3 / mariadb:10.6 (pull_request) Successful in 1m41s
CI / PHP 8.3 / mariadb:11.4 (pull_request) Successful in 1m40s
CI / PHP 8.4 / mariadb:11.4 (pull_request) Successful in 1m42s
CI / PHP 8.3 / mysql:8.0 (pull_request) Failing after 2m10s
CI / PHP 8.4 / mysql:8.0 (pull_request) Failing after 2m6s
CI / PHP 8.4 / mysql:8.4 (pull_request) Failing after 1m55s
CI / PHP 8.3 / mysql:8.4 (pull_request) Failing after 2m2s
CI / Build-Artefakte aktuell (pull_request) Successful in 52s
- OpenID Connect mit PKCE, State und Nonce; ID-Token-Prüfung gegen die Microsoft-Schlüssel (Signatur, Mandant, App, Gültigkeit, Nonce) inkl. Neuladen bei Schlüsselwechsel - Konto bei erster Anmeldung anlegen oder per E-Mail verknüpfen, optionale Domain-Beschränkung, deaktivierte Konten bleiben gesperrt - Gruppen (inkl. Overage über Graph, transitiv) und App-Rollen → Rollen, additiv; nur Zuweisungen aus Entra werden abgeglichen, manuelle bleiben - Profilfelder, Vorgesetzte*r und Profilfoto aus Graph, je Feld wählbar und im Portal schreibgeschützt; Fallback auf Token-Angaben, wenn Graph ausfällt - Hintergrund-Abgleich mit Delta-Abfragen (Zeitbudget, Fortsetzung über nextLink/deltaLink), Offboarding deaktivierter/gelöschter Konten, optionale Vorab-Anlage, Fotos/Vorgesetzte rollierend, Gruppen und App-Rollen stündlich - Admin „Anmeldung“: Einrichtung mit Umleitungs-URI und Berechtigungen, verschlüsseltes Geheimnis (nie im Browser), Gruppensuche, Status, „Mapping testen“ - Fix: @odata.nextLink/@odata.deltaLink wurden als Pfad gelesen – Folgeseiten fehlten - Profilseite mit Vorgesetzter/m und Mitarbeitenden; Version 0.4.0 Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
87 lines
2.9 KiB
PHP
87 lines
2.9 KiB
PHP
<?php
|
||
|
||
namespace App\Support;
|
||
|
||
/**
|
||
* Registry der Rechte (Abilities). Kern und Plugins melden hier an, welche
|
||
* Rechte es gibt – das Rollen-Formular und der Rechte-Prüfer bauen darauf auf.
|
||
*
|
||
* Globale Rechte gelten überall („Benutzer verwalten“). Objekt-Rechte gelten für
|
||
* einzelne Objekte eines Typs („Beiträge schreiben in Kategorie MAV-Info“).
|
||
*/
|
||
class Abilities
|
||
{
|
||
/** @var array<string, array{label: string, group: string, resource: string|null}> */
|
||
private array $abilities = [];
|
||
|
||
/** @var array<string, array{label: string, options: callable}> */
|
||
private array $resourceTypes = [];
|
||
|
||
public function __construct()
|
||
{
|
||
$this->define('users.manage', 'Benutzer verwalten', 'System');
|
||
$this->define('roles.manage', 'Rollen und Rechte verwalten', 'System');
|
||
$this->define('identity.manage', 'Anmeldung (Microsoft Entra ID) einrichten', 'System');
|
||
$this->define('plugins.manage', 'Plugins verwalten und installieren', 'System');
|
||
$this->define('appearance.manage', 'Erscheinungsbild und Schnellzugriffe', 'System');
|
||
$this->define('updates.manage', 'Aktualisierungen, Lizenz und Systemzustand', 'System');
|
||
$this->define('feedback.send', 'Rückmeldungen an den Hersteller senden', 'System');
|
||
}
|
||
|
||
public function define(string $ability, string $label, string $group, ?string $resource = null): void
|
||
{
|
||
$this->abilities[$ability] = ['label' => $label, 'group' => $group, 'resource' => $resource];
|
||
}
|
||
|
||
/**
|
||
* Objekttyp, auf den sich Rechte beziehen können (z. B. „news_category“).
|
||
*
|
||
* @param callable(): array<int|string, string> $options ID => Bezeichnung
|
||
*/
|
||
public function resourceType(string $type, string $label, callable $options): void
|
||
{
|
||
$this->resourceTypes[$type] = ['label' => $label, 'options' => $options];
|
||
}
|
||
|
||
/**
|
||
* @return array<string, array{label: string, group: string, resource: string|null}>
|
||
*/
|
||
public function all(): array
|
||
{
|
||
return $this->abilities;
|
||
}
|
||
|
||
/**
|
||
* @return array<string, array{label: string, group: string, resource: string|null}>
|
||
*/
|
||
public function global(): array
|
||
{
|
||
return array_filter($this->abilities, fn (array $a) => $a['resource'] === null);
|
||
}
|
||
|
||
/**
|
||
* @return array<string, array{label: string, group: string, resource: string|null}>
|
||
*/
|
||
public function forResource(string $type): array
|
||
{
|
||
return array_filter($this->abilities, fn (array $a) => $a['resource'] === $type);
|
||
}
|
||
|
||
/**
|
||
* @return array<string, array{label: string, options: callable}>
|
||
*/
|
||
public function resourceTypes(): array
|
||
{
|
||
return $this->resourceTypes;
|
||
}
|
||
|
||
public function exists(string $ability): bool
|
||
{
|
||
return isset($this->abilities[$ability]);
|
||
}
|
||
|
||
public function label(string $ability): string
|
||
{
|
||
return $this->abilities[$ability]['label'] ?? $ability;
|
||
}
|
||
}
|