Rollen ausschließen: bei Inhalten (Zielgruppen) und für ganze Module
Some checks failed
CI / PHP 8.3 / mariadb:10.6 (pull_request) Successful in 3m45s
CI / PHP 8.4 / mariadb:10.6 (pull_request) Successful in 3m39s
CI / PHP 8.3 / mariadb:11.4 (pull_request) Successful in 4m25s
CI / PHP 8.4 / mariadb:11.4 (pull_request) Successful in 4m21s
CI / PHP 8.4 / mysql:8.0 (pull_request) Failing after 6m49s
CI / PHP 8.3 / mysql:8.0 (pull_request) Failing after 6m59s
CI / PHP 8.4 / mysql:8.4 (pull_request) Failing after 6m21s
CI / PHP 8.3 / mysql:8.4 (pull_request) Failing after 6m30s
CI / Build-Artefakte aktuell (pull_request) Successful in 1m10s

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Friederich Loheide 2026-09-26 19:30:11 +00:00
parent 19193b850b
commit 1877a0922f
113 changed files with 699 additions and 428 deletions

View file

@ -3,6 +3,7 @@
namespace App\Pagebuilder;
use App\Models\User;
use App\Plugins\PluginAccess;
use App\Support\Permissions\Audiences;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Str;
@ -231,7 +232,7 @@ class Content
}
/**
* @return array{role?: list<string>, department?: list<string>, location?: list<string>}|null
* @return array{role?: list<string>, department?: list<string>, location?: list<string>, exclude_role?: list<string>}|null
*/
private function sanitizeVisibility(mixed $visibility): ?array
{
@ -241,7 +242,7 @@ class Content
$clean = [];
foreach (['role', 'department', 'location'] as $rule) {
foreach (['role', 'department', 'location', 'exclude_role'] as $rule) {
$values = array_values(array_unique(array_filter(array_map(
fn ($value) => is_scalar($value) ? mb_substr(trim((string) $value), 0, 150) : '',
(array) ($visibility[$rule] ?? []),
@ -267,7 +268,7 @@ class Content
$type = $this->blocks->get($block['type'] ?? '');
// Blöcke deaktivierter Plugins und fremde Zielgruppen einfach auslassen.
if (! $type || ! Audiences::matches($block['visibility'] ?? null, $user)) {
if (! $type || ! Audiences::matches($block['visibility'] ?? null, $user) || ! app(PluginAccess::class)->allows($type->key, $user)) {
continue;
}