Reine Redaktionsrechte öffnen nicht mehr das Backend (0.25.1)
Some checks failed
CI / PHP 8.3 / mariadb:10.6 (pull_request) Successful in 4m6s
CI / PHP 8.4 / mariadb:10.6 (pull_request) Successful in 4m20s
CI / PHP 8.3 / mariadb:11.4 (pull_request) Successful in 5m17s
CI / PHP 8.4 / mariadb:11.4 (pull_request) Successful in 5m18s
CI / PHP 8.3 / mysql:8.0 (pull_request) Failing after 7m10s
CI / PHP 8.4 / mysql:8.0 (pull_request) Failing after 6m41s
CI / PHP 8.3 / mysql:8.4 (pull_request) Failing after 5m44s
CI / PHP 8.4 / mysql:8.4 (pull_request) Failing after 5m59s
CI / Build-Artefakte aktuell (pull_request) Successful in 1m51s
Some checks failed
CI / PHP 8.3 / mariadb:10.6 (pull_request) Successful in 4m6s
CI / PHP 8.4 / mariadb:10.6 (pull_request) Successful in 4m20s
CI / PHP 8.3 / mariadb:11.4 (pull_request) Successful in 5m17s
CI / PHP 8.4 / mariadb:11.4 (pull_request) Successful in 5m18s
CI / PHP 8.3 / mysql:8.0 (pull_request) Failing after 7m10s
CI / PHP 8.4 / mysql:8.0 (pull_request) Failing after 6m41s
CI / PHP 8.3 / mysql:8.4 (pull_request) Failing after 5m44s
CI / PHP 8.4 / mysql:8.4 (pull_request) Failing after 5m59s
CI / Build-Artefakte aktuell (pull_request) Successful in 1m51s
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
4d155457b8
commit
34d6cdbf1c
121 changed files with 371 additions and 318 deletions
|
|
@ -11,7 +11,7 @@ namespace App\Support;
|
|||
*/
|
||||
class Abilities
|
||||
{
|
||||
/** @var array<string, array{label: string, group: string, resource: string|null}> */
|
||||
/** @var array<string, array{label: string, group: string, resource: string|null, portal: bool}> */
|
||||
private array $abilities = [];
|
||||
|
||||
/** @var array<string, array{label: string, options: callable, descendants: callable|null}> */
|
||||
|
|
@ -27,12 +27,29 @@ class Abilities
|
|||
$this->define('updates.manage', 'Aktualisierungen, Lizenz und Systemzustand', 'System');
|
||||
$this->define('mail.manage', 'E-Mail-Versand einrichten', 'System');
|
||||
$this->define('feedback.send', 'Rückmeldungen an den Hersteller senden', 'System');
|
||||
$this->define('media.manage', 'Mediathek verwalten: ersetzen, löschen, aufräumen', 'Mediathek');
|
||||
$this->define('media.manage', 'Mediathek verwalten: ersetzen, löschen, aufräumen', 'Mediathek', portal: true);
|
||||
}
|
||||
|
||||
public function define(string $ability, string $label, string $group, ?string $resource = null): void
|
||||
/**
|
||||
* @param bool $portal Recht wird vollständig im Portal ausgeübt (Redaktion) – öffnet nicht das Backend
|
||||
*/
|
||||
public function define(string $ability, string $label, string $group, ?string $resource = null, bool $portal = false): void
|
||||
{
|
||||
$this->abilities[$ability] = ['label' => $label, 'group' => $group, 'resource' => $resource];
|
||||
$this->abilities[$ability] = ['label' => $label, 'group' => $group, 'resource' => $resource, 'portal' => $portal];
|
||||
}
|
||||
|
||||
/**
|
||||
* Braucht dieses Recht das Backend (/admin)? Nur-Portal-Rechte und unbekannte
|
||||
* (z. B. von deaktivierten Plugins) nicht.
|
||||
*/
|
||||
public function needsBackend(string $ability): bool
|
||||
{
|
||||
return isset($this->abilities[$ability]) && ! $this->abilities[$ability]['portal'];
|
||||
}
|
||||
|
||||
public function isPortalOnly(string $ability): bool
|
||||
{
|
||||
return (bool) ($this->abilities[$ability]['portal'] ?? false);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue