Sicherheitsupdate nach Audit (0.29.0) #50
226 changed files with 1952 additions and 450 deletions
|
|
@ -1,3 +1,5 @@
|
|||
# Vorlage für die ENTWICKLUNG (APP_ENV=local, APP_DEBUG=true). Auf Servern legt der Installer die
|
||||
# .env selbst an (production, Debug aus) – diese Datei dort nicht von Hand kopieren.
|
||||
APP_NAME=Inhaus
|
||||
APP_ENV=local
|
||||
APP_KEY=
|
||||
|
|
@ -63,3 +65,6 @@ AWS_BUCKET=
|
|||
AWS_USE_PATH_STYLE_ENDPOINT=false
|
||||
|
||||
VITE_APP_NAME="${APP_NAME}"
|
||||
|
||||
# Hinter einem Reverse-Proxy: dessen Adresse(n) oder * (für korrekte Besucher-IP, HTTPS-Erkennung und Begrenzungen)
|
||||
# TRUSTED_PROXIES=
|
||||
|
|
|
|||
|
|
@ -51,6 +51,21 @@ jobs:
|
|||
- run: vendor-dev/bin/phpunit
|
||||
- run: vendor-dev/bin/pint --test
|
||||
|
||||
audit:
|
||||
name: Bekannte Sicherheitslücken in Paketen
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: https://code.forgejo.org/actions/checkout@v4
|
||||
- uses: https://github.com/shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: '8.4'
|
||||
coverage: none
|
||||
- run: composer audit --locked --no-dev
|
||||
- uses: https://code.forgejo.org/actions/setup-node@v4
|
||||
with:
|
||||
node-version: '22'
|
||||
- run: npm audit --omit=dev --audit-level=high
|
||||
|
||||
artifacts:
|
||||
name: Build-Artefakte aktuell
|
||||
runs-on: ubuntu-latest
|
||||
|
|
|
|||
|
|
@ -8,6 +8,10 @@ Options -Indexes
|
|||
|
||||
<IfModule mod_rewrite.c>
|
||||
RewriteEngine On
|
||||
|
||||
# Interne Ordner und Dateien nie ausliefern – auch nicht, wenn ihr Pfad „/public/“ enthält
|
||||
RewriteRule ^(\.env|\.git|app|bootstrap|config|database|plugins|plugins-core|resources|routes|storage|tests|vendor|vendor-dev)(/|$) - [F,L]
|
||||
|
||||
RewriteCond %{REQUEST_URI} !/public/
|
||||
RewriteRule ^(.*)$ public/$1 [L]
|
||||
</IfModule>
|
||||
|
|
|
|||
16
CHANGELOG.md
16
CHANGELOG.md
|
|
@ -4,6 +4,22 @@ Neueste Version oben. Jeder Abschnitt beginnt mit `## MAJOR.MINOR.PATCH` und
|
|||
enthält kurze Stichpunkte für Anwenderinnen und Anwender – keine Commit-Texte.
|
||||
Der Self-Updater zeigt diese Abschnitte bei neuen Versionen an.
|
||||
|
||||
## 0.29.0 – Sicherheitsupdate
|
||||
|
||||
Ergebnis eines umfassenden Sicherheitsaudits. Bitte zeitnah einspielen.
|
||||
|
||||
- Deaktivierte Konten werden sofort abgemeldet – auch bei offener Sitzung, „Angemeldet bleiben“, App-Zugängen und Push
|
||||
- Rechte: Wer keinen Vollzugriff hat, kann nur Rollen und Rechte vergeben, die er selbst besitzt, und keine Konten mit Vollzugriff bearbeiten
|
||||
- Profil: E-Mail-Adresse, Abteilung und Standort ändert nur die Administration (Abteilung und Standort steuern, wer welche Inhalte sieht; unter „Profilfelder → Selbst pflegen“ bewusst freigebbar)
|
||||
- Anmeldung: „Passwort vergessen“ verrät nicht mehr, ob es ein Konto gibt, und ist begrenzt; Konten, die sich nur über Microsoft & Co. anmelden, bekommen darüber kein Passwort; Passwortwechsel meldet andere Geräte ab; Anmeldedienste verknüpfen Konten mit Passwort oder Administrationsrechten nur bei bestätigter E-Mail-Adresse
|
||||
- Suche, Schnittstelle und Seiten-Downloads zeigen nur noch, was die Person tatsächlich sehen darf (auch bei Blöcken für bestimmte Zielgruppen)
|
||||
- Uploads: sichere Dateinamen und -typen, gründlichere SVG-Bereinigung, Bilder bis 50 Megapixel, Grenzen für ZIP-Archive
|
||||
- Kein Zugriff auf interne Server über Push-Abonnements, den WordPress-Import oder Plugin-Updates
|
||||
- Gespeicherte Zugangsdaten (E-Mail-Server, LDAP, OIDC, IT-Service) müssen bei geändertem Ziel neu eingegeben werden
|
||||
- Sicherheits-Header für alle Seiten, sicheres Sitzungs-Cookie bei HTTPS, Begrenzungen für API, Kommentare, Suche und Vorschau; TRUSTED_PROXIES für Server hinter einem Reverse-Proxy
|
||||
- Weitere Korrekturen: Fußzeilen-Links ohne javascript:, CSV-Exporte gegen Formeln abgesichert, Formular-Empfänger nur mit Ergebnis-Rechten, Stellen-Ansprechperson, Geburtstage in „Gemeinsam“, Protokoll für Kontenänderungen und Anmeldungen
|
||||
- Betriebshinweise in docs/SECURITY.md (u. a. nginx-Konfiguration für den Upload-Ordner)
|
||||
|
||||
## 0.28.3
|
||||
|
||||
- Stellenausschreibungen: vierte Bewerbungsart „Per E-Mail an eine Adresse“ – die Stelle zeigt die Adresse und einen Knopf „E-Mail schreiben“ mit passendem Betreff
|
||||
|
|
|
|||
|
|
@ -21,6 +21,11 @@ class ResetUserPassword implements ResetsUserPasswords
|
|||
*/
|
||||
public function reset(User $user, array $input): void
|
||||
{
|
||||
// Konten, die sich nur über einen Anmeldedienst anmelden, bekommen kein lokales Passwort
|
||||
if (! $user->is_active || ($user->password === null && $user->identities()->exists())) {
|
||||
throw ValidationException::withMessages(['email' => trans('passwords.token')]);
|
||||
}
|
||||
|
||||
Validator::make($input, [
|
||||
'password' => $this->passwordRules(),
|
||||
])->validate();
|
||||
|
|
@ -28,5 +33,8 @@ class ResetUserPassword implements ResetsUserPasswords
|
|||
$user->forceFill([
|
||||
'password' => Hash::make($input['password']),
|
||||
])->save();
|
||||
|
||||
// Bisherige Sitzungen und App-Zugänge beenden
|
||||
$user->revokeAccess();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,5 +31,8 @@ class UpdateUserPassword implements UpdatesUserPasswords
|
|||
$user->forceFill([
|
||||
'password' => Hash::make($input['password']),
|
||||
])->save();
|
||||
|
||||
// Andere Geräte abmelden, App-Zugänge widerrufen – diese Sitzung bleibt
|
||||
$user->revokeAccess(keepCurrentSession: true);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
46
app/Filament/Components/SafeUpload.php
Normal file
46
app/Filament/Components/SafeUpload.php
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
<?php
|
||||
|
||||
namespace App\Filament\Components;
|
||||
|
||||
use Filament\Forms\Components\FileUpload;
|
||||
use Illuminate\Support\Str;
|
||||
use Livewire\Features\SupportFileUploads\TemporaryUploadedFile;
|
||||
|
||||
/**
|
||||
* Uploads in den öffentlichen Ordner (public/uploads): nur bestimmte Dateitypen, und
|
||||
* die Dateiendung ergibt sich aus dem geprüften Inhalt – nie aus dem Namen der
|
||||
* hochgeladenen Datei (sonst ließe sich z. B. „bild.html“ oder „bild.php“ ablegen).
|
||||
*/
|
||||
final class SafeUpload
|
||||
{
|
||||
public const IMAGES = ['image/jpeg', 'image/png', 'image/webp', 'image/gif'];
|
||||
|
||||
public const EXTENSIONS = [
|
||||
'image/jpeg' => 'jpg',
|
||||
'image/png' => 'png',
|
||||
'image/webp' => 'webp',
|
||||
'image/gif' => 'gif',
|
||||
'image/svg+xml' => 'svg',
|
||||
'image/x-icon' => 'ico',
|
||||
'image/vnd.microsoft.icon' => 'ico',
|
||||
'font/woff2' => 'woff2',
|
||||
'application/font-woff2' => 'woff2',
|
||||
];
|
||||
|
||||
/**
|
||||
* @param list<string> $types erlaubte MIME-Typen
|
||||
*/
|
||||
public static function apply(FileUpload $upload, array $types = self::IMAGES, ?string $forcedExtension = null): FileUpload
|
||||
{
|
||||
return $upload
|
||||
->acceptedFileTypes($types)
|
||||
->getUploadedFileNameForStorageUsing(fn (TemporaryUploadedFile $file) => self::name($file, $forcedExtension));
|
||||
}
|
||||
|
||||
public static function name(TemporaryUploadedFile $file, ?string $forcedExtension = null): string
|
||||
{
|
||||
$extension = $forcedExtension ?? self::EXTENSIONS[strtolower((string) $file->getMimeType())] ?? 'bin';
|
||||
|
||||
return Str::ulid().'.'.$extension;
|
||||
}
|
||||
}
|
||||
|
|
@ -3,6 +3,7 @@
|
|||
namespace App\Filament\Pages\Appearance;
|
||||
|
||||
use App\Filament\Clusters\AppearanceCluster;
|
||||
use App\Filament\Components\SafeUpload;
|
||||
use App\Support\Audit;
|
||||
use App\Support\Branding;
|
||||
use App\Support\Theme\Contrast;
|
||||
|
|
@ -45,7 +46,7 @@ abstract class AppearancePage extends Page
|
|||
|
||||
protected static function image(string $name, string $label, string $help): FileUpload
|
||||
{
|
||||
return FileUpload::make($name)->label($label)->helperText($help)
|
||||
return SafeUpload::apply(FileUpload::make($name), [...SafeUpload::IMAGES, 'image/svg+xml'])->label($label)->helperText($help)
|
||||
->disk('uploads')->directory('theme')->visibility('public')->maxSize(4096);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
namespace App\Filament\Pages\Appearance;
|
||||
|
||||
use App\Filament\Components\SafeUpload;
|
||||
use App\Support\Theme\Fonts;
|
||||
use App\Support\Theme\Theme;
|
||||
use BackedEnum;
|
||||
|
|
@ -32,6 +33,7 @@ class AppearanceTypography extends AppearancePage
|
|||
->helperText('Z. B. die Hausschrift aus dem Corporate Design. Wird lokal ausgeliefert – keine Verbindung zu Google oder anderen Diensten. Bitte die Lizenz für die Nutzung im Web beachten.')
|
||||
->disk('uploads')->directory('theme/fonts')->visibility('public')->maxSize(2048)
|
||||
->acceptedFileTypes(['font/woff2', 'application/font-woff2', 'application/octet-stream'])
|
||||
->getUploadedFileNameForStorageUsing(fn ($file) => SafeUpload::name($file, 'woff2'))
|
||||
->rule('extensions:woff2')->live()->columnSpanFull(),
|
||||
Radio::make('radius')->label('Ecken')->options(collect(Theme::RADII)->map(fn ($r) => $r[0])->all())->inline()->required(),
|
||||
Radio::make('density')->label('Abstände')->options(collect(Theme::DENSITIES)->map(fn ($d) => $d[0])->all())->inline()->required(),
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ namespace App\Filament\Resources\DashboardTiles;
|
|||
|
||||
use App\Filament\Clusters\HomepageCluster;
|
||||
use App\Filament\Components\AudienceSection;
|
||||
use App\Filament\Components\SafeUpload;
|
||||
use App\Filament\Resources\DashboardTiles\Pages\ManageDashboardTiles;
|
||||
use App\Models\DashboardTile;
|
||||
use BackedEnum;
|
||||
|
|
@ -60,7 +61,7 @@ class DashboardTileResource extends Resource
|
|||
->helperText('Die Reihenfolge innerhalb des Bereichs legen Sie unter „Startseite“ fest.'),
|
||||
TextInput::make('title')->label(fn (Get $get) => $get('type') === 'image' ? 'Bildunterschrift (optional)' : 'Überschrift')->maxLength(150),
|
||||
|
||||
FileUpload::make('image_path')->label('Bild')->image()->disk('uploads')->directory('dashboard')->visibility('public')
|
||||
SafeUpload::apply(FileUpload::make('image_path'))->label('Bild')->image()->disk('uploads')->directory('dashboard')->visibility('public')
|
||||
->maxSize(8 * 1024)->required($type('image'))->visible($type('image'))->columnSpanFull()
|
||||
->helperText('Für die Seitenleiste z. B. 800 × 600 Pixel, für „ganz oben“ ein breites Banner (z. B. 2400 × 500).'),
|
||||
TextInput::make('alt')->label('Alternativtext')->maxLength(200)->visible($type('image'))->helperText('Beschreibt das Bild für Screenreader.'),
|
||||
|
|
|
|||
|
|
@ -339,6 +339,9 @@ class IdentityProviderResource extends Resource
|
|||
->schema([
|
||||
Toggle::make('config.auto_provision')->label('Konto bei erster Anmeldung anlegen')->default(true),
|
||||
Toggle::make('config.link_by_email')->label('Bestehende Konten über die E-Mail-Adresse verknüpfen')->default(true),
|
||||
Toggle::make('config.trust_email')->label('E-Mail-Adressen dieses Anbieters sind geprüft')
|
||||
->helperText('Nur einschalten, wenn niemand beim Anbieter seine E-Mail-Adresse selbst ändern kann. Sonst werden Konten mit Passwort oder Administrationsrechten nicht automatisch verknüpft (Schutz vor Kontoübernahme).')
|
||||
->visible(fn ($get) => ($get('type') ?? null) !== 'entra'),
|
||||
TagsInput::make('config.allowed_domains')->label('Erlaubte E-Mail-Domains')->placeholder('firma.de')
|
||||
->helperText('Leer = alle Konten des Anbieters.'),
|
||||
Select::make('config.default_role_id')->label('Standardrolle für alle')
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ use Filament\Actions\Action;
|
|||
use Filament\Actions\DeleteAction;
|
||||
use Filament\Resources\Pages\EditRecord;
|
||||
use Filament\Support\Icons\Heroicon;
|
||||
use Illuminate\Validation\ValidationException;
|
||||
|
||||
class EditIdentityProvider extends EditRecord
|
||||
{
|
||||
|
|
@ -38,8 +39,16 @@ class EditIdentityProvider extends EditRecord
|
|||
*/
|
||||
protected function mutateFormDataBeforeSave(array $data): array
|
||||
{
|
||||
$destinationChanged = collect($this->record->driver()?->destinationFields() ?? [])
|
||||
->contains(fn (string $field) => (string) ($data['config'][$field] ?? '') !== (string) ($this->record->setting($field) ?? ''));
|
||||
|
||||
foreach ($this->secretFields() as $field) {
|
||||
if (blank($data['config'][$field] ?? null)) {
|
||||
// Gespeichertes Geheimnis nur für dasselbe Ziel weiterverwenden
|
||||
if ($destinationChanged && filled($this->record->setting($field))) {
|
||||
throw ValidationException::withMessages(["data.config.{$field}" => 'Server bzw. Aussteller wurden geändert – bitte das Geheimnis erneut eingeben.']);
|
||||
}
|
||||
|
||||
$data['config'][$field] = $this->record->setting($field);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,8 +3,15 @@
|
|||
namespace App\Filament\Resources\ProfileFields\Pages;
|
||||
|
||||
use App\Filament\Resources\ProfileFields\ProfileFieldResource;
|
||||
use App\Support\Audit;
|
||||
use App\Support\ProfileFields;
|
||||
use App\Support\Settings;
|
||||
use Filament\Actions\Action;
|
||||
use Filament\Actions\CreateAction;
|
||||
use Filament\Forms\Components\Toggle;
|
||||
use Filament\Notifications\Notification;
|
||||
use Filament\Resources\Pages\ManageRecords;
|
||||
use Filament\Support\Icons\Heroicon;
|
||||
|
||||
class ManageProfileFields extends ManageRecords
|
||||
{
|
||||
|
|
@ -13,6 +20,18 @@ class ManageProfileFields extends ManageRecords
|
|||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Action::make('settings')->label('Selbst pflegen')->icon(Heroicon::OutlinedCog6Tooth)->color('gray')
|
||||
->modalHeading('Was Mitarbeitende selbst ändern dürfen')
|
||||
->fillForm(fn () => ['self_edit_org' => (bool) app(Settings::class)->get(ProfileFields::SELF_EDIT_ORG, false)])
|
||||
->schema([
|
||||
Toggle::make('self_edit_org')->label('Abteilung und Standort selbst ändern')
|
||||
->helperText('Vorsicht: Abteilung und Standort bestimmen, wer welche Inhalte sieht (Zielgruppen). Wer sie selbst ändern darf, kann sich so Zugang zu Inhalten anderer Abteilungen verschaffen. Die E-Mail-Adresse ändert immer die Administration unter „Benutzer“.'),
|
||||
])
|
||||
->action(function (array $data) {
|
||||
app(Settings::class)->set(ProfileFields::SELF_EDIT_ORG, (bool) $data['self_edit_org']);
|
||||
Audit::log('profile.self_edit_org', ['enabled' => (bool) $data['self_edit_org']]);
|
||||
Notification::make()->success()->title('Gespeichert')->send();
|
||||
}),
|
||||
CreateAction::make()->label('Profilfeld anlegen'),
|
||||
];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ use App\Models\Role;
|
|||
use App\Models\User;
|
||||
use App\Support\Abilities;
|
||||
use App\Support\Permissions\Permissions;
|
||||
use App\Support\Permissions\RoleGuard;
|
||||
use BackedEnum;
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Filament\Actions\EditAction;
|
||||
|
|
@ -71,6 +72,19 @@ class RoleResource extends Resource
|
|||
->options(fn () => collect($abilities->global())->map(fn (array $a) => $a['label'])->all())
|
||||
->descriptions(fn () => collect($abilities->global())->map(fn (array $a) => $a['group'].($a['portal'] ? ' · im Portal' : ' · Backend'))->all())
|
||||
->bulkToggleable()
|
||||
// Nur Rechte eintragen, die man selbst besitzt
|
||||
->disableOptionWhen(fn (string $value) => ! RoleGuard::canGrant(auth()->user(), $value))
|
||||
->rule(fn (?Role $record) => function (string $attribute, mixed $value, \Closure $fail) use ($record) {
|
||||
$before = $record?->grants()->whereNull('resource_type')->pluck('ability')->all() ?? [];
|
||||
|
||||
foreach (array_merge(array_diff((array) $value, $before), array_diff($before, (array) $value)) as $ability) {
|
||||
if (! RoleGuard::canGrant(auth()->user(), (string) $ability)) {
|
||||
$fail('Sie können nur Rechte vergeben oder entziehen, die Sie selbst haben.');
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
})
|
||||
->afterStateHydrated(fn (CheckboxList $component, ?Role $record) => $component->state(
|
||||
$record?->grants()->whereNull('resource_type')->pluck('ability')->all() ?? []
|
||||
))
|
||||
|
|
@ -164,6 +178,12 @@ class RoleResource extends Resource
|
|||
$record?->users()->wherePivot('source', 'manual')->pluck('users.id')->all() ?? []
|
||||
))
|
||||
->rule(fn (?Role $record) => function (string $attribute, mixed $value, \Closure $fail) use ($record) {
|
||||
$before = $record?->users()->wherePivot('source', 'manual')->pluck('users.id')->all() ?? [];
|
||||
|
||||
if ($record && array_diff(array_map('intval', (array) $value), $before) && ! RoleGuard::canAssign(auth()->user(), $record)) {
|
||||
$fail('Diese Rolle enthält Rechte, die Sie selbst nicht haben – Sie können keine Personen hinzufügen.');
|
||||
}
|
||||
|
||||
if ($record?->isAdministration() && ! in_array(auth()->id(), array_map('intval', (array) $value), true)) {
|
||||
$fail('Sie können sich nicht selbst aus der Rolle „Administration“ entfernen.');
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ namespace App\Filament\Resources\Users\Schemas;
|
|||
use App\Models\ProfileField;
|
||||
use App\Models\Role;
|
||||
use App\Models\User;
|
||||
use App\Support\Permissions\RoleGuard;
|
||||
use App\Support\ProfileFields;
|
||||
use Filament\Forms\Components\DatePicker;
|
||||
use Filament\Forms\Components\Select;
|
||||
|
|
@ -104,12 +105,23 @@ class UserForm
|
|||
->multiple()
|
||||
->preload()
|
||||
->options(fn () => Role::query()->orderByDesc('is_system')->orderBy('name')->pluck('name', 'id')->all())
|
||||
// Nur Rollen, deren Rechte man selbst besitzt (nie „Administration“ ohne Vollzugriff)
|
||||
->disableOptionWhen(fn (string $value) => ! RoleGuard::canAssign(auth()->user(), Role::query()->findOrFail((int) $value)))
|
||||
->afterStateHydrated(function (Select $component, ?User $record) {
|
||||
$component->state($record?->roles()->wherePivot('source', 'manual')->pluck('roles.id')->all() ?? []);
|
||||
})
|
||||
->rule(function (?User $record) {
|
||||
// Die eigene Administrationsrolle kann man sich nicht selbst entziehen.
|
||||
return function (string $attribute, mixed $value, \Closure $fail) use ($record) {
|
||||
$before = $record?->roles()->wherePivot('source', 'manual')->pluck('roles.id')->all() ?? [];
|
||||
$changed = array_merge(array_diff(array_map('intval', (array) $value), $before), array_diff($before, array_map('intval', (array) $value)));
|
||||
|
||||
foreach (Role::query()->whereIn('id', $changed)->get() as $role) {
|
||||
if (! RoleGuard::canAssign(auth()->user(), $role)) {
|
||||
$fail("Die Rolle „{$role->name}“ enthält Rechte, die Sie selbst nicht haben.");
|
||||
}
|
||||
}
|
||||
|
||||
// Die eigene Administrationsrolle kann man sich nicht selbst entziehen.
|
||||
if ($record?->is(auth()->user()) && $record->hasRole(Role::ADMINISTRATION)
|
||||
&& ! in_array(Role::administration()->id, array_map('intval', (array) $value), true)) {
|
||||
$fail('Die eigene Rolle „Administration“ kann nicht entfernt werden.');
|
||||
|
|
|
|||
|
|
@ -4,10 +4,13 @@ namespace App\Http\Controllers\Api;
|
|||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\User;
|
||||
use App\Providers\FortifyServiceProvider;
|
||||
use App\Support\Audit;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use Illuminate\Support\Facades\RateLimiter;
|
||||
use Illuminate\Support\Str;
|
||||
use Illuminate\Validation\ValidationException;
|
||||
|
||||
class AuthController extends Controller
|
||||
|
|
@ -24,12 +27,31 @@ class AuthController extends Controller
|
|||
'device_name' => ['required', 'string', 'max:100'],
|
||||
]);
|
||||
|
||||
$user = User::query()->where('email', $data['email'])->first();
|
||||
// Je E-Mail-Adresse begrenzen (zusätzlich zur Begrenzung je IP) – gegen Durchprobieren von Passwörtern
|
||||
$key = 'api-token:'.Str::lower($data['email']);
|
||||
|
||||
if (RateLimiter::tooManyAttempts($key, 5)) {
|
||||
throw ValidationException::withMessages(['email' => 'Zu viele Versuche. Bitte in einigen Minuten erneut versuchen.']);
|
||||
}
|
||||
|
||||
$user = User::query()->where('email', Str::lower($data['email']))->first();
|
||||
$valid = Hash::check($data['password'], $user?->password ?? FortifyServiceProvider::dummyHash());
|
||||
|
||||
if (! $user || ! $user->is_active || $user->password === null || ! $valid) {
|
||||
RateLimiter::hit($key, 300);
|
||||
|
||||
if (! $user || ! $user->is_active || $user->password === null || ! Hash::check($data['password'], $user->password)) {
|
||||
throw ValidationException::withMessages(['email' => 'Diese Kombination aus Zugangsdaten wurde nicht gefunden.']);
|
||||
}
|
||||
|
||||
RateLimiter::clear($key);
|
||||
|
||||
// Höchstens 20 Zugänge je Person – der älteste fällt weg
|
||||
$excess = $user->tokens()->count() - 19;
|
||||
|
||||
if ($excess > 0) {
|
||||
$user->tokens()->oldest()->limit($excess)->get()->each->delete();
|
||||
}
|
||||
|
||||
$token = $user->createToken(trim($data['device_name']));
|
||||
Audit::log('api.token_created', ['user' => $user->id, 'device' => $data['device_name']]);
|
||||
|
||||
|
|
|
|||
|
|
@ -38,7 +38,9 @@ class NotificationController extends Controller
|
|||
$url = (string) ($notification->data['url'] ?? '');
|
||||
|
||||
// Nur Adressen innerhalb des Portals ansteuern.
|
||||
return redirect()->to($url !== '' && (Str::startsWith($url, '/') && ! Str::startsWith($url, '//') || Str::startsWith($url, url('/'))) ? $url : '/');
|
||||
$local = preg_match('#^/(?![/\\\\])#', $url) || Str::startsWith($url, url('/').'/');
|
||||
|
||||
return redirect()->to($local ? $url : '/');
|
||||
}
|
||||
|
||||
public function markAllRead(Request $request): JsonResponse
|
||||
|
|
|
|||
|
|
@ -8,6 +8,8 @@ use App\Profile\ProfileSections;
|
|||
use App\Support\Audit;
|
||||
use App\Support\Avatars;
|
||||
use App\Support\Covers;
|
||||
use App\Support\ImageTooLarge;
|
||||
use App\Support\Impersonation;
|
||||
use App\Support\ProfileFields;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
|
|
@ -30,6 +32,7 @@ class ProfileController extends Controller
|
|||
{
|
||||
$user = $request->user();
|
||||
$managed = $user->managedFields();
|
||||
$locked = $user->lockedProfileFields();
|
||||
|
||||
return Inertia::render('Profile/Edit', [
|
||||
'profile' => [
|
||||
|
|
@ -45,6 +48,8 @@ class ProfileController extends Controller
|
|||
],
|
||||
// Felder, die Microsoft Entra ID pflegt – im Portal nur lesbar.
|
||||
'managed' => $managed,
|
||||
// Nicht selbst änderbar (E-Mail, ggf. Abteilung/Standort): pflegt die Personalverwaltung
|
||||
'locked' => $locked,
|
||||
'customFields' => $profileFields->formFor($user, $managed),
|
||||
'sections' => app(ProfileSections::class)->resolve($user),
|
||||
// Apps & Geräte: persönliche Zugangs-Tokens für die REST-API
|
||||
|
|
@ -60,7 +65,7 @@ class ProfileController extends Controller
|
|||
public function update(UpdateProfileRequest $request, ProfileFields $profileFields): RedirectResponse
|
||||
{
|
||||
$user = $request->user();
|
||||
$managed = $user->managedFields();
|
||||
$managed = $user->lockedProfileFields();
|
||||
$user->update(collect($request->validated())->except([...$managed, 'custom_fields'])->all());
|
||||
|
||||
if ($request->has('custom_fields')) {
|
||||
|
|
@ -78,6 +83,8 @@ class ProfileController extends Controller
|
|||
|
||||
try {
|
||||
$avatars->store($request->user(), $request->file('avatar'));
|
||||
} catch (ImageTooLarge $e) {
|
||||
throw ValidationException::withMessages(['avatar' => $e->getMessage()]);
|
||||
} catch (Throwable $e) {
|
||||
// Meist eine Server-Einschränkung (GD ohne WebP, Upload-Ordner schreibgeschützt,
|
||||
// zu wenig Speicher) – verständliche Meldung statt „500 Interner Fehler“.
|
||||
|
|
@ -105,6 +112,8 @@ class ProfileController extends Controller
|
|||
|
||||
public function createToken(Request $request): JsonResponse
|
||||
{
|
||||
// Während „Als Person anmelden“ keine dauerhaften Zugänge für die andere Person
|
||||
abort_if(app(Impersonation::class)->active(), 403, 'Während „Als Person anmelden“ können keine App-Zugänge angelegt werden.');
|
||||
$data = $request->validate(['name' => ['required', 'string', 'max:100']], [], ['name' => 'Name']);
|
||||
abort_if($request->user()->tokens()->count() >= 20, 422, 'Höchstens 20 Apps und Geräte – bitte alte entfernen.');
|
||||
|
||||
|
|
@ -129,6 +138,8 @@ class ProfileController extends Controller
|
|||
|
||||
try {
|
||||
$covers->store($request->user(), $request->file('cover'));
|
||||
} catch (ImageTooLarge $e) {
|
||||
throw ValidationException::withMessages(['cover' => $e->getMessage()]);
|
||||
} catch (Throwable $e) {
|
||||
report($e);
|
||||
|
||||
|
|
|
|||
|
|
@ -23,8 +23,17 @@ class PushController extends Controller
|
|||
'keys.auth' => ['required', 'string', 'max:40'],
|
||||
]);
|
||||
|
||||
abort_unless(WebPush::isAllowedEndpoint($data['endpoint']), 422, 'Dieser Push-Dienst wird nicht unterstützt.');
|
||||
|
||||
$hash = hash('sha256', $data['endpoint']);
|
||||
$existing = PushSubscription::query()->where('endpoint_hash', $hash)->first();
|
||||
|
||||
// Fremde Abonnements nicht übernehmen; höchstens 10 Geräte je Person
|
||||
abort_if($existing && $existing->user_id !== $request->user()->id, 409, 'Dieses Gerät ist einer anderen Person zugeordnet.');
|
||||
abort_if(! $existing && PushSubscription::query()->where('user_id', $request->user()->id)->count() >= 10, 422, 'Höchstens 10 Geräte – bitte Push auf einem alten Gerät ausschalten.');
|
||||
|
||||
PushSubscription::query()->updateOrCreate(
|
||||
['endpoint_hash' => hash('sha256', $data['endpoint'])],
|
||||
['endpoint_hash' => $hash],
|
||||
[
|
||||
'user_id' => $request->user()->id,
|
||||
'endpoint' => $data['endpoint'],
|
||||
|
|
|
|||
31
app/Http/Middleware/EnsureActiveUser.php
Normal file
31
app/Http/Middleware/EnsureActiveUser.php
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Closure;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
|
||||
/**
|
||||
* Deaktivierte Konten werden sofort abgemeldet – auch bei offener Sitzung.
|
||||
*/
|
||||
class EnsureActiveUser
|
||||
{
|
||||
public function handle(Request $request, Closure $next): Response
|
||||
{
|
||||
$user = Auth::guard('web')->user();
|
||||
|
||||
if ($user && ! $user->is_active) {
|
||||
Auth::guard('web')->logout();
|
||||
$request->session()->invalidate();
|
||||
$request->session()->regenerateToken();
|
||||
|
||||
return $request->expectsJson()
|
||||
? response()->json(['message' => 'Ihr Konto ist deaktiviert.'], 401)
|
||||
: redirect('/login')->with('status', 'Ihr Konto ist deaktiviert.');
|
||||
}
|
||||
|
||||
return $next($request);
|
||||
}
|
||||
}
|
||||
|
|
@ -3,6 +3,7 @@
|
|||
namespace App\Http\Middleware;
|
||||
|
||||
use App\Support\Installation;
|
||||
use App\Support\Update\MaintenanceFlag;
|
||||
use App\Support\Update\Migrations;
|
||||
use Closure;
|
||||
use Illuminate\Http\Request;
|
||||
|
|
@ -24,7 +25,8 @@ class RunPendingMigrations
|
|||
|
||||
public function handle(Request $request, Closure $next): Response
|
||||
{
|
||||
if (app()->runningUnitTests() || ! Installation::isInstalled()) {
|
||||
// Nicht während eines laufenden Updates – dann sind die Dateien womöglich erst halb kopiert
|
||||
if (app()->runningUnitTests() || ! Installation::isInstalled() || app(MaintenanceFlag::class)->isActive()) {
|
||||
return $next($request);
|
||||
}
|
||||
|
||||
|
|
|
|||
41
app/Http/Middleware/SecurityHeaders.php
Normal file
41
app/Http/Middleware/SecurityHeaders.php
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Closure;
|
||||
use Illuminate\Http\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
|
||||
/**
|
||||
* Grundlegende Sicherheits-Header für alle Seiten: keine Einbettung in fremde Seiten
|
||||
* (Clickjacking), kein MIME-Raten, sparsamer Referrer, HSTS bei HTTPS und eine
|
||||
* Basis-CSP. Eigene Header einzelner Antworten (z. B. Datei-Downloads) bleiben erhalten.
|
||||
*/
|
||||
class SecurityHeaders
|
||||
{
|
||||
public function handle(Request $request, Closure $next): Response
|
||||
{
|
||||
$response = $next($request);
|
||||
$headers = $response->headers;
|
||||
|
||||
$defaults = [
|
||||
'X-Frame-Options' => 'SAMEORIGIN',
|
||||
'X-Content-Type-Options' => 'nosniff',
|
||||
'Referrer-Policy' => 'strict-origin-when-cross-origin',
|
||||
'Permissions-Policy' => 'camera=(), microphone=(), geolocation=(), payment=(), usb=()',
|
||||
'Content-Security-Policy' => "frame-ancestors 'self'; object-src 'none'; base-uri 'self'",
|
||||
];
|
||||
|
||||
foreach ($defaults as $name => $value) {
|
||||
if (! $headers->has($name)) {
|
||||
$headers->set($name, $value);
|
||||
}
|
||||
}
|
||||
|
||||
if ($request->isSecure() && ! $headers->has('Strict-Transport-Security')) {
|
||||
$headers->set('Strict-Transport-Security', 'max-age=31536000');
|
||||
}
|
||||
|
||||
return $response;
|
||||
}
|
||||
}
|
||||
30
app/Http/Middleware/ThrottlePasswordReset.php
Normal file
30
app/Http/Middleware/ThrottlePasswordReset.php
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Closure;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\RateLimiter;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
|
||||
/**
|
||||
* „Passwort vergessen“ und „Passwort zurücksetzen“ begrenzen (Fortify drosselt diese Wege nicht):
|
||||
* gegen Massenmails und das Durchprobieren von Adressen.
|
||||
*/
|
||||
class ThrottlePasswordReset
|
||||
{
|
||||
public function handle(Request $request, Closure $next): Response
|
||||
{
|
||||
if ($request->isMethod('POST') && $request->routeIs('password.email', 'password.update')) {
|
||||
$key = 'password-reset:'.$request->ip();
|
||||
|
||||
if (RateLimiter::tooManyAttempts($key, 10)) {
|
||||
abort(429, 'Zu viele Versuche. Bitte in einigen Minuten erneut versuchen.');
|
||||
}
|
||||
|
||||
RateLimiter::hit($key, 600);
|
||||
}
|
||||
|
||||
return $next($request);
|
||||
}
|
||||
}
|
||||
|
|
@ -13,7 +13,7 @@ class UpdateProfileRequest extends FormRequest
|
|||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
$managed = $this->user()->managedFields();
|
||||
$managed = $this->user()->lockedProfileFields();
|
||||
|
||||
return [
|
||||
'first_name' => [in_array('first_name', $managed, true) ? 'nullable' : 'required', 'string', 'max:100'],
|
||||
|
|
|
|||
23
app/Http/Responses/NeutralPasswordResetLinkResponse.php
Normal file
23
app/Http/Responses/NeutralPasswordResetLinkResponse.php
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Responses;
|
||||
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Laravel\Fortify\Contracts\FailedPasswordResetLinkRequestResponse;
|
||||
use Laravel\Fortify\Contracts\SuccessfulPasswordResetLinkRequestResponse;
|
||||
|
||||
/**
|
||||
* „Passwort vergessen“ antwortet immer gleich – ob es das Konto gibt oder nicht
|
||||
* (sonst ließe sich ausprobieren, welche Adressen ein Konto haben).
|
||||
*/
|
||||
class NeutralPasswordResetLinkResponse implements FailedPasswordResetLinkRequestResponse, SuccessfulPasswordResetLinkRequestResponse
|
||||
{
|
||||
public function __construct(protected string $status = '') {}
|
||||
|
||||
public function toResponse($request)
|
||||
{
|
||||
$message = trans('passwords.sent');
|
||||
|
||||
return $request->wantsJson() ? new JsonResponse(['message' => $message], 200) : back()->with('status', $message);
|
||||
}
|
||||
}
|
||||
|
|
@ -78,6 +78,17 @@ abstract class IdentityDriver
|
|||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Felder, die bestimmen, wohin die Geheimnisse geschickt werden (Server, Aussteller …).
|
||||
* Ändert sich eines, müssen die Geheimnisse neu eingegeben werden.
|
||||
*
|
||||
* @return list<string>
|
||||
*/
|
||||
public function destinationFields(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Standardzuordnung Profilfeld => Attribut für neue Anbieter.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -51,6 +51,12 @@ class IdentitySync
|
|||
? User::query()->where('email', $email)->first()
|
||||
: null;
|
||||
|
||||
// Konten mit Passwort oder Backend-Rechten nur verknüpfen, wenn die Adresse verlässlich
|
||||
// ist – sonst könnte, wer beim Anbieter seine E-Mail ändern kann, fremde Konten übernehmen.
|
||||
if ($user && ($user->password !== null || $user->canAccessAdmin()) && ! $this->emailTrusted($provider, $profile)) {
|
||||
throw new IdentityException('Für diese E-Mail-Adresse gibt es bereits ein Portal-Konto. Bitte melden Sie sich mit Ihrem Passwort an oder bitten Sie die Administration, die Anmeldung freizuschalten.');
|
||||
}
|
||||
|
||||
if (! $user) {
|
||||
if (! $allowCreate) {
|
||||
return null;
|
||||
|
|
@ -254,6 +260,19 @@ class IdentitySync
|
|||
return array_values(array_unique($desired));
|
||||
}
|
||||
|
||||
/**
|
||||
* Stammt die E-Mail-Adresse sicher von der Person? Microsoft Entra ID prüft Adressen,
|
||||
* OIDC meldet es per „email_verified“, sonst entscheidet die Administration je Anbieter.
|
||||
*
|
||||
* @param array<string, mixed> $profile
|
||||
*/
|
||||
private function emailTrusted(IdentityProvider $provider, array $profile): bool
|
||||
{
|
||||
return $provider->type === 'entra'
|
||||
|| ($profile['email_verified'] ?? false) === true
|
||||
|| (bool) $provider->setting('trust_email', false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Konto wurde beim Anbieter deaktiviert oder gelöscht: im Portal deaktivieren
|
||||
* und die Rollen aus diesem Anbieter entfernen.
|
||||
|
|
|
|||
|
|
@ -2,15 +2,20 @@
|
|||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Push\PushSubscription;
|
||||
use App\Support\Abilities;
|
||||
use App\Support\Audit;
|
||||
use App\Support\Avatars;
|
||||
use App\Support\Covers;
|
||||
use App\Support\Permissions\Permissions;
|
||||
use App\Support\Permissions\PermissionSet;
|
||||
use App\Support\ProfileFields;
|
||||
use App\Support\Settings;
|
||||
use Database\Factories\UserFactory;
|
||||
use Filament\Models\Contracts\FilamentUser;
|
||||
use Filament\Models\Contracts\HasAvatar;
|
||||
use Filament\Panel;
|
||||
use Illuminate\Auth\Notifications\ResetPassword;
|
||||
use Illuminate\Database\Eloquent\Attributes\Fillable;
|
||||
use Illuminate\Database\Eloquent\Attributes\Hidden;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
|
|
@ -21,6 +26,8 @@ use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
|||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Illuminate\Foundation\Auth\User as Authenticatable;
|
||||
use Illuminate\Notifications\Notifiable;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Support\Str;
|
||||
use Laravel\Sanctum\HasApiTokens;
|
||||
|
||||
|
|
@ -39,6 +46,24 @@ class User extends Authenticatable implements FilamentUser, HasAvatar
|
|||
|
||||
protected static function booted(): void
|
||||
{
|
||||
// Protokoll: Konten anlegen, ändern (ohne Werte von Passwörtern), löschen
|
||||
static::created(fn (User $user) => Audit::log('user.created', ['user' => $user->id, 'email' => $user->email]));
|
||||
static::deleted(fn (User $user) => Audit::log('user.deleted', ['user' => $user->id, 'email' => $user->email]));
|
||||
static::updated(function (User $user) {
|
||||
$changed = array_values(array_diff(array_keys($user->getChanges()), ['updated_at', 'remember_token', 'last_login_at', 'avatar_path', 'cover_path']));
|
||||
|
||||
if ($changed !== []) {
|
||||
Audit::log('user.updated', ['user' => $user->id, 'fields' => $changed, 'is_active' => $user->wasChanged('is_active') ? $user->is_active : null]);
|
||||
}
|
||||
});
|
||||
|
||||
// Deaktiviert: alle Zugänge sofort beenden (Sitzungen, „Angemeldet bleiben“, API, Push)
|
||||
static::updated(function (User $user) {
|
||||
if ($user->wasChanged('is_active') && ! $user->is_active) {
|
||||
$user->revokeAccess();
|
||||
}
|
||||
});
|
||||
|
||||
// Der Anzeigename folgt Vor- und Nachname, solange beide gepflegt sind.
|
||||
static::saving(function (User $user): void {
|
||||
$fullName = trim($user->first_name.' '.$user->last_name);
|
||||
|
|
@ -121,6 +146,20 @@ class User extends Authenticatable implements FilamentUser, HasAvatar
|
|||
*
|
||||
* @return list<string>
|
||||
*/
|
||||
/**
|
||||
* Felder, die die Person im Profil nicht selbst ändern darf: vom Anmeldedienst gepflegte,
|
||||
* die E-Mail-Adresse (Anmeldung, Verknüpfung, IT-Service) und – solange nicht freigegeben –
|
||||
* Abteilung und Standort, weil sie bestimmen, wer welche Inhalte sieht.
|
||||
*
|
||||
* @return list<string>
|
||||
*/
|
||||
public function lockedProfileFields(): array
|
||||
{
|
||||
$selfOrg = (bool) app(Settings::class)->get(ProfileFields::SELF_EDIT_ORG, false);
|
||||
|
||||
return array_values(array_unique([...$this->managedFields(), 'email', ...($selfOrg ? [] : ['department', 'location'])]));
|
||||
}
|
||||
|
||||
public function managedFields(): array
|
||||
{
|
||||
return $this->identities()->with('provider')->get()
|
||||
|
|
@ -165,6 +204,10 @@ class User extends Authenticatable implements FilamentUser, HasAvatar
|
|||
$this->roles()->attach($roleId, ['source' => 'manual', 'created_at' => now()]);
|
||||
}
|
||||
|
||||
if (array_diff($roleIds, $current) || array_diff($current, $roleIds)) {
|
||||
Audit::log('user.roles_changed', ['user' => $this->id, 'added' => array_values(array_diff($roleIds, $current)), 'removed' => array_values(array_diff($current, $roleIds))]);
|
||||
}
|
||||
|
||||
Permissions::flush();
|
||||
}
|
||||
|
||||
|
|
@ -205,4 +248,33 @@ class User extends Authenticatable implements FilamentUser, HasAvatar
|
|||
{
|
||||
$query->where('is_active', true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Alle bestehenden Zugänge beenden: Sitzungen, „Angemeldet bleiben“, API-Tokens, Push-Abos.
|
||||
*/
|
||||
public function revokeAccess(bool $keepCurrentSession = false): void
|
||||
{
|
||||
$this->forceFill(['remember_token' => Str::random(60)])->saveQuietly();
|
||||
$this->tokens()->delete();
|
||||
PushSubscription::query()->where('user_id', $this->id)->delete();
|
||||
|
||||
if (Schema::hasTable(config('session.table', 'sessions'))) {
|
||||
DB::table(config('session.table', 'sessions'))->where('user_id', $this->id)
|
||||
->when($keepCurrentSession && session()->isStarted(), fn ($q) => $q->where('id', '!=', session()->getId()))
|
||||
->delete();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Keine Reset-Mail für deaktivierte Konten und für Konten, die sich nur über
|
||||
* einen Anmeldedienst anmelden (sie sollen kein lokales Passwort bekommen).
|
||||
*/
|
||||
public function sendPasswordResetNotification(#[\SensitiveParameter] $token): void
|
||||
{
|
||||
if (! $this->is_active || ($this->password === null && $this->identities()->exists())) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->notify(new ResetPassword($token));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -77,6 +77,11 @@ class Content
|
|||
|
||||
$type = $this->blocks->get($clean['type']);
|
||||
|
||||
// Blöcke eines Moduls, von dem die Person ausgeschlossen ist, auch in der Vorschau nicht berechnen
|
||||
if ($type && ! app(PluginAccess::class)->allows($type->key, $user)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return $type?->resolve ? $this->resolve($type, $clean, $user, $context) : [];
|
||||
}
|
||||
|
||||
|
|
@ -133,8 +138,13 @@ class Content
|
|||
*
|
||||
* @param array<mixed>|null $content
|
||||
*/
|
||||
public function plainText(?array $content): string
|
||||
public function plainText(?array $content, bool $publicOnly = false): string
|
||||
{
|
||||
// Für Suche und Auszüge: Blöcke mit eingeschränkter Sichtbarkeit (und ihr Inhalt) weglassen
|
||||
if ($publicOnly && is_array($content)) {
|
||||
$content = ['blocks' => self::withoutRestricted($content['blocks'] ?? [])];
|
||||
}
|
||||
|
||||
$parts = $this->collect($content, function (array $block) {
|
||||
$texts = [];
|
||||
|
||||
|
|
@ -154,6 +164,29 @@ class Content
|
|||
return trim(preg_replace('/\s+/u', ' ', html_entity_decode(implode(' ', $parts))) ?? '');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array<mixed> $blocks
|
||||
* @return list<array<string, mixed>>
|
||||
*/
|
||||
private static function withoutRestricted(array $blocks): array
|
||||
{
|
||||
$result = [];
|
||||
|
||||
foreach ($blocks as $block) {
|
||||
if (! is_array($block) || array_filter((array) ($block['visibility'] ?? []))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (isset($block['items'])) {
|
||||
$block['items'] = array_map(fn ($item) => is_array($item) ? [...$item, 'blocks' => self::withoutRestricted((array) ($item['blocks'] ?? []))] : $item, (array) $block['items']);
|
||||
}
|
||||
|
||||
$result[] = $block;
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return list<array<string, mixed>>
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -170,7 +170,7 @@ final class Field
|
|||
}
|
||||
|
||||
// Relative Adressen im Portal, Anker oder http(s)/mailto/tel – nichts anderes (kein javascript:).
|
||||
if (preg_match('#^(/(?!/)|\#)#', $url) || preg_match('#^(https?://|mailto:|tel:)#i', $url)) {
|
||||
if (preg_match('#^(/(?![/\\\\])|\#)#', $url) || preg_match('#^(https?://|mailto:|tel:)#i', $url)) {
|
||||
return $url;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ class PluginAssets
|
|||
|
||||
$this->cache[$slug] = [
|
||||
'base' => '/plugin-assets/'.rawurlencode($slug).'/'.rawurlencode($manifest->version).'/',
|
||||
'components' => array_filter(array_map($clean, (array) ($data['components'] ?? []))),
|
||||
'components' => array_filter(array_map($clean, (array) ($data['components'] ?? [])), fn ($file, $key) => $file !== null && preg_match('#^[A-Za-z0-9_/-]+$#', (string) $key), ARRAY_FILTER_USE_BOTH),
|
||||
'css' => array_values(array_filter(array_map($clean, (array) ($data['css'] ?? [])))),
|
||||
];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,7 +25,10 @@ class PluginInstaller
|
|||
return ! filter_var(config('inhaus.disallow_file_mods'), FILTER_VALIDATE_BOOL);
|
||||
}
|
||||
|
||||
public function install(string $zipFile): PluginManifest
|
||||
/**
|
||||
* @param string|null $expectedSlug bei Updates: das Archiv muss genau dieses Plugin enthalten
|
||||
*/
|
||||
public function install(string $zipFile, ?string $expectedSlug = null): PluginManifest
|
||||
{
|
||||
if (! self::uploadsAllowed()) {
|
||||
throw new RuntimeException('Das Installieren von Plugins ist in dieser Installation abgeschaltet.');
|
||||
|
|
@ -42,6 +45,10 @@ class PluginInstaller
|
|||
throw new RuntimeException('Das Archiv enthält kein gültiges Plugin: '.$e->getMessage());
|
||||
}
|
||||
|
||||
if ($expectedSlug !== null && $manifest->slug !== $expectedSlug) {
|
||||
throw new RuntimeException("Das Archiv enthält das Plugin „{$manifest->slug}“ statt „{$expectedSlug}“.");
|
||||
}
|
||||
|
||||
$existing = $this->plugins->find($manifest->slug);
|
||||
|
||||
if ($existing?->core) {
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
namespace App\Plugins;
|
||||
|
||||
use App\Support\Audit;
|
||||
use App\Support\SafeOutbound;
|
||||
use App\Support\Settings;
|
||||
use App\Version;
|
||||
use Illuminate\Support\Facades\Artisan;
|
||||
|
|
@ -102,7 +103,16 @@ class PluginUpdates
|
|||
$file = tempnam(sys_get_temp_dir(), 'plugin-update');
|
||||
|
||||
try {
|
||||
$response = Http::timeout(120)->withOptions(['sink' => $file])->get($this->safeUrl($info['download_url']));
|
||||
// Nur über HTTPS (auch bei Weiterleitungen), nie an interne Adressen, Größe schon beim Laden begrenzen
|
||||
$response = Http::timeout(120)->withOptions([
|
||||
...SafeOutbound::options(['https']),
|
||||
'sink' => $file,
|
||||
'progress' => function ($total, $downloaded) {
|
||||
if ($total > self::MAX_BYTES || $downloaded > self::MAX_BYTES) {
|
||||
throw new RuntimeException('Das Update ist größer als 50 MB.');
|
||||
}
|
||||
},
|
||||
])->get($this->safeUrl($info['download_url']));
|
||||
|
||||
if (! $response->successful()) {
|
||||
throw new RuntimeException("Download fehlgeschlagen (HTTP {$response->status()}).");
|
||||
|
|
@ -117,11 +127,7 @@ class PluginUpdates
|
|||
}
|
||||
|
||||
$wasEnabled = $this->plugins->isEnabled($slug);
|
||||
$manifest = $this->installer->install($file);
|
||||
|
||||
if ($manifest->slug !== $slug) {
|
||||
throw new RuntimeException("Das Archiv enthält das Plugin „{$manifest->slug}“ statt „{$slug}“.");
|
||||
}
|
||||
$manifest = $this->installer->install($file, expectedSlug: $slug);
|
||||
|
||||
// Neue Tabellen oder Spalten des Plugins sofort anlegen
|
||||
if ($wasEnabled && is_dir($manifest->migrationsPath())) {
|
||||
|
|
@ -141,7 +147,7 @@ class PluginUpdates
|
|||
*/
|
||||
private function fetch(string $url): array
|
||||
{
|
||||
$response = Http::timeout(15)->acceptJson()->get($this->safeUrl($url));
|
||||
$response = Http::timeout(15)->acceptJson()->withOptions(SafeOutbound::options(['https']))->get($this->safeUrl($url));
|
||||
|
||||
if (! $response->successful()) {
|
||||
throw new RuntimeException("Update-Adresse antwortet mit HTTP {$response->status()}.");
|
||||
|
|
@ -193,6 +199,10 @@ class PluginUpdates
|
|||
throw new RuntimeException('Update-Adressen müssen mit https:// beginnen.');
|
||||
}
|
||||
|
||||
if (! SafeOutbound::isPublicUrl($url, ['https'])) {
|
||||
throw new RuntimeException('Update-Adressen dürfen nicht auf interne Server zeigen.');
|
||||
}
|
||||
|
||||
return $url;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,7 +24,8 @@ class RolePolicy
|
|||
|
||||
public function update(User $user, Role $role): bool
|
||||
{
|
||||
return $user->can('roles.manage');
|
||||
// Die Rolle „Administration“ (Vollzugriff) ändert nur, wer selbst Vollzugriff hat
|
||||
return $user->can('roles.manage') && (! $role->isAdministration() || $user->permissions()->isSuperuser());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
namespace App\Policies;
|
||||
|
||||
use App\Models\User;
|
||||
use App\Support\Permissions\RoleGuard;
|
||||
|
||||
class UserPolicy
|
||||
{
|
||||
|
|
@ -23,11 +24,11 @@ class UserPolicy
|
|||
|
||||
public function update(User $user, User $model): bool
|
||||
{
|
||||
return $user->can('users.manage');
|
||||
return $user->can('users.manage') && RoleGuard::canManageUser($user, $model);
|
||||
}
|
||||
|
||||
public function delete(User $user, User $model): bool
|
||||
{
|
||||
return $user->can('users.manage') && ! $model->is($user);
|
||||
return $user->can('users.manage') && ! $model->is($user) && RoleGuard::canManageUser($user, $model);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,8 +38,11 @@ use App\Support\Theme\ThemeCompiler;
|
|||
use App\Support\Update\InstalledVersion;
|
||||
use App\Support\Update\MaintenanceFlag;
|
||||
use App\Support\Update\UpdateProgress;
|
||||
use Illuminate\Cache\RateLimiting\Limit;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Gate;
|
||||
use Illuminate\Support\Facades\RateLimiter;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use Illuminate\Validation\Rules\Password;
|
||||
use Laravel\Sanctum\Sanctum;
|
||||
|
|
@ -88,6 +91,8 @@ class AppServiceProvider extends ServiceProvider
|
|||
|
||||
public function boot(): void
|
||||
{
|
||||
RateLimiter::for('api', fn (Request $request) => Limit::perMinute(180)->by($request->user()?->id ?: $request->ip()));
|
||||
|
||||
// API-Tokens deaktivierter Konten gelten nicht mehr
|
||||
Sanctum::authenticateAccessTokensUsing(fn ($token, bool $isValid) => $isValid && $token->tokenable instanceof User && $token->tokenable->is_active);
|
||||
|
||||
|
|
|
|||
|
|
@ -4,9 +4,13 @@ namespace App\Providers;
|
|||
|
||||
use App\Actions\Fortify\ResetUserPassword;
|
||||
use App\Actions\Fortify\UpdateUserPassword;
|
||||
use App\Http\Responses\NeutralPasswordResetLinkResponse;
|
||||
use App\Models\IdentityProvider;
|
||||
use App\Models\User;
|
||||
use App\Support\Audit;
|
||||
use Illuminate\Auth\Events\Failed;
|
||||
use Illuminate\Auth\Events\Login;
|
||||
use Illuminate\Auth\Events\PasswordReset;
|
||||
use Illuminate\Cache\RateLimiting\Limit;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Event;
|
||||
|
|
@ -15,10 +19,19 @@ use Illuminate\Support\Facades\RateLimiter;
|
|||
use Illuminate\Support\ServiceProvider;
|
||||
use Illuminate\Support\Str;
|
||||
use Inertia\Inertia;
|
||||
use Laravel\Fortify\Contracts\FailedPasswordResetLinkRequestResponse;
|
||||
use Laravel\Fortify\Contracts\SuccessfulPasswordResetLinkRequestResponse;
|
||||
use Laravel\Fortify\Fortify;
|
||||
|
||||
class FortifyServiceProvider extends ServiceProvider
|
||||
{
|
||||
public function register(): void
|
||||
{
|
||||
// „Passwort vergessen“ verrät nicht, ob es ein Konto gibt
|
||||
$this->app->bind(FailedPasswordResetLinkRequestResponse::class, NeutralPasswordResetLinkResponse::class);
|
||||
$this->app->bind(SuccessfulPasswordResetLinkRequestResponse::class, NeutralPasswordResetLinkResponse::class);
|
||||
}
|
||||
|
||||
public function boot(): void
|
||||
{
|
||||
Fortify::updateUserPasswordsUsing(UpdateUserPassword::class);
|
||||
|
|
@ -47,14 +60,16 @@ class FortifyServiceProvider extends ServiceProvider
|
|||
Fortify::authenticateUsing(function (Request $request): ?User {
|
||||
$user = User::query()->where('email', Str::lower($request->input(Fortify::username())))->first();
|
||||
|
||||
if ($user && $user->is_active && $user->password !== null
|
||||
&& Hash::check($request->input('password'), $user->password)) {
|
||||
return $user;
|
||||
}
|
||||
// Immer ein Passwort prüfen – gleiche Antwortzeit, ob es das Konto gibt oder nicht
|
||||
$valid = Hash::check((string) $request->input('password'), $user?->password ?? self::dummyHash());
|
||||
|
||||
return null;
|
||||
return $user && $user->is_active && $user->password !== null && $valid ? $user : null;
|
||||
});
|
||||
|
||||
// Anmeldungen protokollieren: fehlgeschlagene Passwort-Anmeldungen und Passwort-Resets
|
||||
Event::listen(Failed::class, fn ($event) => Audit::log('auth.login_failed', ['email' => Str::lower((string) ($event->credentials['email'] ?? ''))], $event->user?->id));
|
||||
Event::listen(PasswordReset::class, fn ($event) => Audit::log('auth.password_reset', ['user' => $event->user->id], $event->user->id));
|
||||
|
||||
Event::listen(Login::class, function (Login $event): void {
|
||||
if ($event->user instanceof User) {
|
||||
$event->user->forceFill(['last_login_at' => now()])->saveQuietly();
|
||||
|
|
@ -67,4 +82,11 @@ class FortifyServiceProvider extends ServiceProvider
|
|||
return Limit::perMinute(5)->by($throttleKey);
|
||||
});
|
||||
}
|
||||
|
||||
public static function dummyHash(): string
|
||||
{
|
||||
static $hash;
|
||||
|
||||
return $hash ??= Hash::make(Str::random(32));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,6 +20,36 @@ class WebPush
|
|||
{
|
||||
public const KEYS = 'push.vapid';
|
||||
|
||||
/**
|
||||
* Push-Dienste der Browser. Nur dorthin wird gesendet – sonst ließe sich der Server
|
||||
* über ein präpariertes Abonnement zu Anfragen an interne Adressen bewegen.
|
||||
*/
|
||||
public const SERVICE_HOSTS = [
|
||||
'fcm.googleapis.com', 'android.googleapis.com', // Chrome, Edge (Android), Opera, Samsung
|
||||
'*.push.services.mozilla.com', // Firefox
|
||||
'*.notify.windows.com', // Edge (Windows)
|
||||
'web.push.apple.com', '*.push.apple.com', // Safari, iOS
|
||||
];
|
||||
|
||||
public static function isAllowedEndpoint(string $endpoint): bool
|
||||
{
|
||||
$parts = parse_url($endpoint);
|
||||
|
||||
if (($parts['scheme'] ?? null) !== 'https' || ! isset($parts['host']) || isset($parts['user']) || isset($parts['port'])) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$host = strtolower($parts['host']);
|
||||
|
||||
foreach (self::SERVICE_HOSTS as $allowed) {
|
||||
if ($host === $allowed || (str_starts_with($allowed, '*.') && str_ends_with($host, substr($allowed, 1)))) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/** Präfix einer DER-kodierten P-256-Public-Key-Struktur (SubjectPublicKeyInfo) vor dem 65-Byte-Punkt */
|
||||
private const P256_SPKI_PREFIX = '3059301306072a8648ce3d020106082a8648ce3d030107034200';
|
||||
|
||||
|
|
@ -43,10 +73,14 @@ class WebPush
|
|||
*/
|
||||
public function send(PushSubscription $subscription, array $payload): bool
|
||||
{
|
||||
if (! self::isAllowedEndpoint($subscription->endpoint)) {
|
||||
return false; // unbekannter Dienst – Abonnement wird entfernt
|
||||
}
|
||||
|
||||
$body = $this->encrypt((string) json_encode($payload, JSON_UNESCAPED_UNICODE), $subscription->public_key, $subscription->auth_token);
|
||||
$keys = $this->keys();
|
||||
|
||||
$response = Http::timeout(10)->withHeaders([
|
||||
$response = Http::timeout(10)->withoutRedirecting()->withHeaders([
|
||||
'Authorization' => 'vapid t='.$this->jwt($subscription->endpoint, $keys['private']).', k='.$keys['public'],
|
||||
'Content-Encoding' => 'aes128gcm',
|
||||
'Content-Type' => 'application/octet-stream',
|
||||
|
|
|
|||
|
|
@ -19,6 +19,11 @@ class Audit
|
|||
{
|
||||
$userId ??= auth()->id();
|
||||
|
||||
// Bei „Als Person anmelden“: wer tatsächlich gehandelt hat
|
||||
if (app()->bound('session') && session()->isStarted() && ($impersonator = session()->get(Impersonation::SESSION))) {
|
||||
$data['impersonator_id'] = (int) $impersonator;
|
||||
}
|
||||
|
||||
Log::info("audit: {$action}", [...$data, 'user_id' => $userId]);
|
||||
|
||||
try {
|
||||
|
|
|
|||
16
app/Support/BlockedFiles.php
Normal file
16
app/Support/BlockedFiles.php
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
<?php
|
||||
|
||||
namespace App\Support;
|
||||
|
||||
/**
|
||||
* Dateitypen, die nirgends hochgeladen werden dürfen (ausführbar, Skripte, Webseiten).
|
||||
* Eine Liste für alle Upload-Stellen (Seiten, Downloads …).
|
||||
*/
|
||||
final class BlockedFiles
|
||||
{
|
||||
public const EXTENSIONS = [
|
||||
'php', 'phtml', 'phar', 'php3', 'php4', 'php5', 'php7', 'php8', 'pht', 'shtml', 'htaccess',
|
||||
'exe', 'bat', 'cmd', 'com', 'sh', 'msi', 'ps1', 'psm1', 'vbs', 'vbe', 'wsf', 'wsh', 'scr', 'hta', 'jar', 'lnk', 'reg', 'cpl',
|
||||
'js', 'mjs', 'html', 'htm', 'svg', 'xhtml', 'jsp', 'asp', 'aspx', 'cgi', 'pl', 'py',
|
||||
];
|
||||
}
|
||||
29
app/Support/Csv.php
Normal file
29
app/Support/Csv.php
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
<?php
|
||||
|
||||
namespace App\Support;
|
||||
|
||||
/**
|
||||
* Hilfen für CSV-Exporte, die in Excel/LibreOffice geöffnet werden.
|
||||
*/
|
||||
final class Csv
|
||||
{
|
||||
/**
|
||||
* Zelle gegen Formel-Einschleusung schützen: Werte, die mit = + - @ Tab oder
|
||||
* Zeilenumbruch beginnen, würden sonst als Formel ausgeführt.
|
||||
*/
|
||||
public static function cell(mixed $value): string
|
||||
{
|
||||
$value = (string) ($value ?? '');
|
||||
|
||||
return preg_match('/^[=+\-@\t\r]/', $value) ? "'".$value : $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param list<mixed> $row
|
||||
* @return list<string>
|
||||
*/
|
||||
public static function row(array $row): array
|
||||
{
|
||||
return array_map(self::cell(...), $row);
|
||||
}
|
||||
}
|
||||
17
app/Support/ImageTooLarge.php
Normal file
17
app/Support/ImageTooLarge.php
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
<?php
|
||||
|
||||
namespace App\Support;
|
||||
|
||||
use RuntimeException;
|
||||
|
||||
/**
|
||||
* Bild mit zu vielen Pixeln – wird vor dem Entpacken abgelehnt (Schutz vor
|
||||
* „Dekompressionsbomben“, die den Arbeitsspeicher des Servers füllen).
|
||||
*/
|
||||
class ImageTooLarge extends RuntimeException
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct('Das Bild ist zu groß (höchstens '.(Images::MAX_PIXELS / 1_000_000).' Megapixel). Bitte verkleinern und erneut hochladen.');
|
||||
}
|
||||
}
|
||||
|
|
@ -19,6 +19,12 @@ use Throwable;
|
|||
*/
|
||||
class Images
|
||||
{
|
||||
/** Höchstens so viele Pixel (50 MP ≈ 8.660 × 5.770) – größere Bilder werden abgelehnt */
|
||||
public const MAX_PIXELS = 50_000_000;
|
||||
|
||||
/** Obergrenze für das angehobene Speicherlimit der Bildverarbeitung */
|
||||
private const MAX_MEMORY = 1024 * 1024 * 1024;
|
||||
|
||||
public const VARIANTS = [
|
||||
'thumb' => [480, 270],
|
||||
'large' => [1600, 900],
|
||||
|
|
@ -206,6 +212,12 @@ class Images
|
|||
public static function raiseMemoryLimitFor(string $file): void
|
||||
{
|
||||
$size = @getimagesize($file);
|
||||
|
||||
// Pixelzahl aus dem Dateikopf prüfen, bevor GD das Bild entpackt
|
||||
if ($size && $size[0] * $size[1] > self::MAX_PIXELS) {
|
||||
throw new ImageTooLarge;
|
||||
}
|
||||
|
||||
$needed = $size ? (int) ($size[0] * $size[1] * 4 * 1.8) : 0;
|
||||
$current = self::bytes((string) ini_get('memory_limit'));
|
||||
|
||||
|
|
@ -213,7 +225,7 @@ class Images
|
|||
return;
|
||||
}
|
||||
|
||||
$target = max(256 * 1024 * 1024, memory_get_usage() + $needed);
|
||||
$target = min(self::MAX_MEMORY, max(256 * 1024 * 1024, memory_get_usage() + $needed));
|
||||
|
||||
if ($current < $target) {
|
||||
@ini_set('memory_limit', (string) $target);
|
||||
|
|
|
|||
|
|
@ -45,6 +45,14 @@ class Impersonation
|
|||
return null;
|
||||
}
|
||||
|
||||
// Zwischenzeitlich deaktiviert? Dann nicht zurückwechseln, sondern ganz abmelden.
|
||||
if (! $original->is_active) {
|
||||
session()->forget(self::SESSION);
|
||||
Auth::guard('web')->logout();
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
$target = Auth::user();
|
||||
session()->forget(self::SESSION);
|
||||
$this->switchTo($original);
|
||||
|
|
|
|||
|
|
@ -2,7 +2,10 @@
|
|||
|
||||
namespace App\Support;
|
||||
|
||||
use App\Models\Role;
|
||||
use Illuminate\Encryption\Encrypter;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
/**
|
||||
* Installationsstatus und Vorbereitung für den Web-Installer.
|
||||
|
|
@ -17,7 +20,28 @@ class Installation
|
|||
return filter_var($forced, FILTER_VALIDATE_BOOL);
|
||||
}
|
||||
|
||||
return is_file(storage_path('.installed')) || app()->environment('local');
|
||||
if (is_file(storage_path('.installed')) || app()->environment('local')) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Markierung verloren (z. B. storage/ nach einem Umzug nicht mitkopiert)? Gibt es bereits
|
||||
// ein Administrationskonto, ist das Portal eingerichtet – der Installer darf nie wieder öffnen.
|
||||
static $checked = null;
|
||||
|
||||
if ($checked === null) {
|
||||
try {
|
||||
$checked = Schema::hasTable('role_user')
|
||||
&& DB::table('role_user')->join('roles', 'roles.id', '=', 'role_user.role_id')->where('roles.slug', Role::ADMINISTRATION)->exists();
|
||||
} catch (\Throwable) {
|
||||
$checked = false; // noch keine Datenbank eingerichtet
|
||||
}
|
||||
|
||||
if ($checked) {
|
||||
@self::markInstalled();
|
||||
}
|
||||
}
|
||||
|
||||
return $checked;
|
||||
}
|
||||
|
||||
public static function markInstalled(): void
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ namespace App\Support;
|
|||
|
||||
use Illuminate\Support\Facades\Crypt;
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
use Illuminate\Validation\ValidationException;
|
||||
use Throwable;
|
||||
|
||||
/**
|
||||
|
|
@ -57,7 +58,15 @@ class MailSettings
|
|||
'mail.from_name' => $values['from_name'] ?? null,
|
||||
];
|
||||
|
||||
// Leeres Passwortfeld = gespeichertes behalten.
|
||||
// Leeres Passwortfeld = gespeichertes behalten – aber nur, solange Server und Benutzer gleich bleiben.
|
||||
// Sonst könnte, wer die Einstellungen ändern darf, das gespeicherte Passwort an einen eigenen Server schicken.
|
||||
$destinationChanged = collect(['host' => 'mail.host', 'port' => 'mail.port', 'username' => 'mail.username'])
|
||||
->contains(fn ($key, $field) => (string) ($values[$field] ?? '') !== (string) ($this->settings->get($key) ?? ''));
|
||||
|
||||
if (blank($values['password'] ?? null) && $destinationChanged && $this->settings->get('mail.password') && ($values['mailer'] ?? null) === 'smtp') {
|
||||
throw ValidationException::withMessages(['data.password' => 'Server oder Benutzer wurden geändert – bitte das Passwort erneut eingeben.']);
|
||||
}
|
||||
|
||||
if (filled($values['password'] ?? null)) {
|
||||
$data['mail.password'] = Crypt::encryptString($values['password']);
|
||||
}
|
||||
|
|
|
|||
44
app/Support/Permissions/RoleGuard.php
Normal file
44
app/Support/Permissions/RoleGuard.php
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
<?php
|
||||
|
||||
namespace App\Support\Permissions;
|
||||
|
||||
use App\Models\Role;
|
||||
use App\Models\User;
|
||||
|
||||
/**
|
||||
* Schutz vor Rechte-Ausweitung: Wer keinen Vollzugriff hat, darf nur Rollen vergeben
|
||||
* bzw. Rechte eintragen, die er selbst besitzt – nie „Administration“.
|
||||
*/
|
||||
final class RoleGuard
|
||||
{
|
||||
public static function canAssign(?User $actor, Role $role): bool
|
||||
{
|
||||
if (! $actor) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($actor->permissions()->isSuperuser()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if ($role->isAdministration() || $role->grants()->where('ability', '*')->exists()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return $role->grants()->whereNull('resource_type')->pluck('ability')
|
||||
->every(fn (string $ability) => $actor->can($ability));
|
||||
}
|
||||
|
||||
public static function canGrant(?User $actor, string $ability): bool
|
||||
{
|
||||
return $actor !== null && ($actor->permissions()->isSuperuser() || ($ability !== '*' && $actor->can($ability)));
|
||||
}
|
||||
|
||||
/**
|
||||
* Konten mit Vollzugriff bearbeiten (Passwort, E-Mail, Rollen, Löschen) nur mit eigenem Vollzugriff.
|
||||
*/
|
||||
public static function canManageUser(?User $actor, User $target): bool
|
||||
{
|
||||
return $actor !== null && ($actor->permissions()->isSuperuser() || ! $target->permissions()->isSuperuser());
|
||||
}
|
||||
}
|
||||
|
|
@ -14,6 +14,9 @@ use Throwable;
|
|||
*/
|
||||
class ProfileFields
|
||||
{
|
||||
/** Dürfen Mitarbeitende Abteilung und Standort selbst ändern? (Standard: nein – steuern Sichtbarkeit) */
|
||||
public const SELF_EDIT_ORG = 'profile.self_edit_org';
|
||||
|
||||
private const CACHE_KEY = 'profile-fields';
|
||||
|
||||
/** @var Collection<int, ProfileField>|null */
|
||||
|
|
|
|||
94
app/Support/SafeOutbound.php
Normal file
94
app/Support/SafeOutbound.php
Normal file
|
|
@ -0,0 +1,94 @@
|
|||
<?php
|
||||
|
||||
namespace App\Support;
|
||||
|
||||
use Psr\Http\Message\UriInterface;
|
||||
use RuntimeException;
|
||||
|
||||
/**
|
||||
* Ausgehende Anfragen an Adressen, die aus Inhalten oder Einstellungen stammen:
|
||||
* nie an interne Ziele (localhost, private Netze, Link-Local, Metadaten-Dienste) –
|
||||
* auch nicht über Weiterleitungen (Schutz vor SSRF).
|
||||
*/
|
||||
final class SafeOutbound
|
||||
{
|
||||
/** @var array<string, list<string>> nur für Tests: feste Auflösung statt DNS */
|
||||
private static array $fakeHosts = [];
|
||||
|
||||
/**
|
||||
* @param array<string, string|list<string>> $hosts
|
||||
*/
|
||||
public static function fakeResolve(array $hosts): void
|
||||
{
|
||||
self::$fakeHosts = array_map(fn ($ips) => (array) $ips, $hosts);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param list<string> $schemes
|
||||
*/
|
||||
public static function isPublicUrl(string $url, array $schemes = ['https', 'http']): bool
|
||||
{
|
||||
$parts = parse_url($url);
|
||||
$scheme = strtolower((string) ($parts['scheme'] ?? ''));
|
||||
$host = strtolower(trim((string) ($parts['host'] ?? ''), '[]'));
|
||||
|
||||
if (! in_array($scheme, $schemes, true) || $host === '' || isset($parts['user']) || in_array($host, ['localhost', 'localhost.localdomain'], true) || str_ends_with($host, '.localhost') || str_ends_with($host, '.internal') || str_ends_with($host, '.local')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$ips = filter_var($host, FILTER_VALIDATE_IP) ? [$host] : self::resolve($host);
|
||||
|
||||
if ($ips === []) {
|
||||
return false;
|
||||
}
|
||||
|
||||
foreach ($ips as $ip) {
|
||||
if (! filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Optionen für den HTTP-Client: höchstens 3 Weiterleitungen, jede wird erneut geprüft.
|
||||
*
|
||||
* @param list<string> $schemes
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public static function options(array $schemes = ['https', 'http']): array
|
||||
{
|
||||
return [
|
||||
'allow_redirects' => [
|
||||
'max' => 3,
|
||||
'protocols' => $schemes,
|
||||
'on_redirect' => function ($request, $response, UriInterface $uri) use ($schemes) {
|
||||
if (! self::isPublicUrl((string) $uri, $schemes)) {
|
||||
throw new RuntimeException('Weiterleitung auf eine nicht erlaubte Adresse.');
|
||||
}
|
||||
},
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return list<string>
|
||||
*/
|
||||
private static function resolve(string $host): array
|
||||
{
|
||||
if (isset(self::$fakeHosts[$host])) {
|
||||
return self::$fakeHosts[$host];
|
||||
}
|
||||
|
||||
$ips = [];
|
||||
|
||||
foreach ([DNS_A, DNS_AAAA] as $type) {
|
||||
foreach (@dns_get_record($host, $type) ?: [] as $record) {
|
||||
$ips[] = $record['ip'] ?? $record['ipv6'] ?? null;
|
||||
}
|
||||
}
|
||||
|
||||
return array_values(array_filter($ips));
|
||||
}
|
||||
}
|
||||
|
|
@ -41,17 +41,20 @@ final class SvgSanitizer
|
|||
|
||||
$xpath = new DOMXPath($dom);
|
||||
|
||||
foreach (iterator_to_array($xpath->query('//*[local-name()="script" or local-name()="foreignObject" or local-name()="iframe" or local-name()="object" or local-name()="embed"]')) as $node) {
|
||||
// Auch Animationen (set/animate) – sie können Links nachträglich auf javascript: setzen.
|
||||
foreach (iterator_to_array($xpath->query('//*[local-name()="script" or local-name()="foreignObject" or local-name()="iframe" or local-name()="object" or local-name()="embed" or local-name()="set" or starts-with(local-name(), "animate") or local-name()="handler" or local-name()="listener"]')) as $node) {
|
||||
$node->parentNode->removeChild($node);
|
||||
}
|
||||
|
||||
foreach (iterator_to_array($xpath->query('//*')) as $element) {
|
||||
/** @var DOMElement $element */
|
||||
foreach (iterator_to_array($element->attributes) as $attribute) {
|
||||
$name = strtolower($attribute->nodeName);
|
||||
$name = strtolower($attribute->localName ?? $attribute->nodeName);
|
||||
$value = strtolower(preg_replace('/\s+/', '', $attribute->nodeValue));
|
||||
|
||||
if (str_starts_with($name, 'on') || (in_array($name, ['href', 'xlink:href', 'src'], true) && ! str_starts_with($value, '#') && ! str_starts_with($value, 'data:image/'))) {
|
||||
$dangerous = str_contains($value, 'javascript:') || str_contains($value, 'vbscript:') || str_contains($value, 'data:text') || str_contains($value, 'expression(');
|
||||
|
||||
if (str_starts_with($name, 'on') || $dangerous || (in_array($name, ['href', 'src'], true) && ! str_starts_with($value, '#') && ! str_starts_with($value, 'data:image/'))) {
|
||||
$element->removeAttributeNode($attribute);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
namespace App\Support\Theme;
|
||||
|
||||
use App\Pagebuilder\Field;
|
||||
use App\Support\Settings;
|
||||
use Illuminate\Support\Arr;
|
||||
|
||||
|
|
@ -106,8 +107,9 @@ class Theme
|
|||
{
|
||||
$theme = self::normalize([...$this->working(), ...$values]);
|
||||
|
||||
foreach (['logo_light', 'logo_dark', 'logo_mark'] as $logo) {
|
||||
SvgSanitizer::sanitizeFile($theme[$logo]);
|
||||
// Alle Bildfelder – jedes könnte eine SVG-Datei sein
|
||||
foreach (['logo_light', 'logo_dark', 'logo_mark', 'app_icon', 'login_image', 'profile_cover', 'avatar_placeholder'] as $image) {
|
||||
SvgSanitizer::sanitizeFile($theme[$image]);
|
||||
}
|
||||
|
||||
$this->settings->set(self::DRAFT, $theme);
|
||||
|
|
@ -161,8 +163,9 @@ class Theme
|
|||
$theme['profile_cover_overlay'] = array_key_exists((int) $theme['profile_cover_overlay'], self::COVER_OVERLAYS) ? (int) $theme['profile_cover_overlay'] : 70;
|
||||
$theme['login_layout'] = array_key_exists($theme['login_layout'], self::LOGIN_LAYOUTS) ? $theme['login_layout'] : 'split';
|
||||
$theme['footer_links'] = array_values(array_filter(array_map(
|
||||
fn ($link) => is_array($link) && filled($link['label'] ?? null) && filled($link['url'] ?? null)
|
||||
? ['label' => mb_substr(trim($link['label']), 0, 60), 'url' => mb_substr(trim($link['url']), 0, 500)]
|
||||
// Nur sichere Adressen (kein javascript:, auch nicht aus importierten Themes)
|
||||
fn ($link) => is_array($link) && filled($link['label'] ?? null) && ($url = Field::safeUrl(mb_substr(trim((string) ($link['url'] ?? '')), 0, 500))) !== ''
|
||||
? ['label' => mb_substr(trim($link['label']), 0, 60), 'url' => $url]
|
||||
: null,
|
||||
(array) $theme['footer_links'],
|
||||
)));
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ class ZipExtractor
|
|||
}
|
||||
|
||||
try {
|
||||
self::checkLimits($zip);
|
||||
$this->recreate($targetDir);
|
||||
$root = realpath($targetDir);
|
||||
$prefix = $this->commonPrefix($zip);
|
||||
|
|
@ -143,4 +144,35 @@ class ZipExtractor
|
|||
throw new RuntimeException("Verzeichnis {$dir} kann nicht angelegt werden. Bitte Schreibrechte prüfen.");
|
||||
}
|
||||
}
|
||||
|
||||
/** Grenzen gegen „ZIP-Bomben“ (ein Inhaus-Update entpackt heute ~17.000 Dateien, ~70 MB) */
|
||||
public const MAX_ENTRIES = 60_000;
|
||||
|
||||
public const MAX_TOTAL_BYTES = 800 * 1024 * 1024;
|
||||
|
||||
public const MAX_RATIO = 200;
|
||||
|
||||
private static function checkLimits(ZipArchive $zip): void
|
||||
{
|
||||
if ($zip->numFiles > self::MAX_ENTRIES) {
|
||||
throw new RuntimeException('Das Archiv enthält zu viele Dateien.');
|
||||
}
|
||||
|
||||
$total = 0;
|
||||
|
||||
for ($i = 0; $i < $zip->numFiles; $i++) {
|
||||
$stat = $zip->statIndex($i);
|
||||
$size = (int) ($stat['size'] ?? 0);
|
||||
$total += $size;
|
||||
|
||||
// Stark komprimierte große Einträge sind verdächtig
|
||||
if ($size > 10 * 1024 * 1024 && $size > max(1, (int) ($stat['comp_size'] ?? 0)) * self::MAX_RATIO) {
|
||||
throw new RuntimeException('Das Archiv enthält eine ungewöhnlich stark komprimierte Datei und wurde abgelehnt.');
|
||||
}
|
||||
|
||||
if ($total > self::MAX_TOTAL_BYTES) {
|
||||
throw new RuntimeException('Das Archiv ist entpackt zu groß.');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,5 +9,5 @@ namespace App;
|
|||
*/
|
||||
final class Version
|
||||
{
|
||||
public const VERSION = '0.28.3';
|
||||
public const VERSION = '0.29.0';
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,11 +1,15 @@
|
|||
<?php
|
||||
|
||||
use App\Http\Middleware\EnsureActiveUser;
|
||||
use App\Http\Middleware\EnsureNotInMaintenance;
|
||||
use App\Http\Middleware\HandleInertiaRequests;
|
||||
use App\Http\Middleware\RedirectToInstaller;
|
||||
use App\Http\Middleware\RunPendingMigrations;
|
||||
use App\Http\Middleware\RunPseudoCron;
|
||||
use App\Http\Middleware\SecurityHeaders;
|
||||
use App\Http\Middleware\ThemePreview;
|
||||
use App\Http\Middleware\ThrottlePasswordReset;
|
||||
use App\Support\ImageTooLarge;
|
||||
use Illuminate\Foundation\Application;
|
||||
use Illuminate\Foundation\Configuration\Exceptions;
|
||||
use Illuminate\Foundation\Configuration\Middleware;
|
||||
|
|
@ -19,13 +23,24 @@ return Application::configure(basePath: dirname(__DIR__))
|
|||
health: '/up',
|
||||
)
|
||||
->withMiddleware(function (Middleware $middleware): void {
|
||||
// Hinter einem Reverse-Proxy (z. B. Caddy, nginx): TRUSTED_PROXIES=10.0.0.1,10.0.0.2 oder *
|
||||
if ($proxies = env('TRUSTED_PROXIES')) {
|
||||
$middleware->trustProxies(at: $proxies === '*' ? '*' : array_map('trim', explode(',', $proxies)));
|
||||
}
|
||||
|
||||
// REST-API: je Person bzw. Adresse begrenzen (Limiter „api“ in AppServiceProvider)
|
||||
$middleware->throttleApi();
|
||||
|
||||
// SAML-Antworten kommen per POST vom Anbieter (siehe routes/web.php).
|
||||
$middleware->validateCsrfTokens(except: ['auth/*/callback']);
|
||||
|
||||
$middleware->web(prepend: [
|
||||
SecurityHeaders::class,
|
||||
EnsureNotInMaintenance::class,
|
||||
RedirectToInstaller::class,
|
||||
], append: [
|
||||
EnsureActiveUser::class,
|
||||
ThrottlePasswordReset::class,
|
||||
RunPendingMigrations::class,
|
||||
ThemePreview::class,
|
||||
HandleInertiaRequests::class,
|
||||
|
|
@ -39,6 +54,13 @@ return Application::configure(basePath: dirname(__DIR__))
|
|||
'user_id' => auth()->id(),
|
||||
]));
|
||||
|
||||
// Zu große Bilder: verständliche Meldung statt Serverfehler (alle Upload-Stellen)
|
||||
$exceptions->render(function (ImageTooLarge $e, Request $request) {
|
||||
return $request->expectsJson()
|
||||
? response()->json(['message' => $e->getMessage(), 'errors' => ['image' => [$e->getMessage()]]], 422)
|
||||
: back()->withErrors(['image' => $e->getMessage(), 'avatar' => $e->getMessage(), 'cover' => $e->getMessage()]);
|
||||
});
|
||||
|
||||
$exceptions->shouldRenderJsonWhen(
|
||||
fn (Request $request) => $request->is('api/*') || $request->expectsJson(),
|
||||
);
|
||||
|
|
|
|||
|
|
@ -169,7 +169,8 @@ return [
|
|||
|
|
||||
*/
|
||||
|
||||
'secure' => env('SESSION_SECURE_COOKIE'),
|
||||
// Standard: sicheres Cookie, sobald das Portal über HTTPS läuft
|
||||
'secure' => env('SESSION_SECURE_COOKIE', str_starts_with((string) env('APP_URL', ''), 'https://')),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
|
|||
89
docs/SECURITY.md
Normal file
89
docs/SECURITY.md
Normal file
|
|
@ -0,0 +1,89 @@
|
|||
# Sicherheit – Betrieb und Hinweise
|
||||
|
||||
Stand: Sicherheitsaudit zu Version 0.29.0. Hier steht, was Inhaus selbst absichert und was
|
||||
beim Betrieb auf dem Server zu beachten ist.
|
||||
|
||||
## Was Inhaus absichert
|
||||
|
||||
- **Anmeldung:**
|
||||
- Deaktivierte Konten werden sofort abgemeldet. Sitzungen, „Angemeldet bleiben“, App-Zugänge
|
||||
und Push-Abos verlieren dabei ihre Gültigkeit.
|
||||
- Passwortwechsel beendet andere Sitzungen und App-Zugänge.
|
||||
- „Passwort vergessen“ verrät nicht, ob es ein Konto gibt, und ist begrenzt.
|
||||
- Konten, die sich nur über einen Anmeldedienst (Entra, OIDC, SAML, LDAP) anmelden, bekommen
|
||||
darüber kein lokales Passwort.
|
||||
- **Verknüpfen per E-Mail:** Konten mit Passwort oder Backend-Rechten werden nur verknüpft, wenn
|
||||
der Anbieter die Adresse bestätigt hat, also bei Entra, bei OIDC mit `email_verified` oder mit
|
||||
der Einstellung „E-Mail-Adressen dieses Anbieters sind geprüft“.
|
||||
- **Rechte:**
|
||||
- Wer keinen Vollzugriff hat, vergibt nur Rollen und Rechte, die er selbst hat.
|
||||
- Konten mit Vollzugriff bearbeitet nur, wer selbst Vollzugriff hat.
|
||||
- „Als Person anmelden“ wird protokolliert; das Protokoll nennt auch, wer tatsächlich gehandelt hat.
|
||||
- **Profil:**
|
||||
- E-Mail, Abteilung und Standort ändert nur die Administration.
|
||||
- Abteilung und Standort steuern Zielgruppen. Sie lassen sich unter „Profilfelder → Selbst
|
||||
pflegen“ bewusst freigeben.
|
||||
- **Sichtbarkeit:** Suche, API und Datei-Downloads zeigen nur, was die Person auf der Seite sieht.
|
||||
Blöcke für andere Zielgruppen zählen nicht.
|
||||
- **Uploads:**
|
||||
- Dateinamen und Endungen erzeugt der Server aus dem geprüften Inhalt.
|
||||
- SVG-Dateien werden bereinigt.
|
||||
- Bilder haben höchstens 50 Megapixel.
|
||||
- ZIP-Archive (Plugins, Updates) sind in Größe und Anzahl der Dateien begrenzt.
|
||||
- **Ausgehende Anfragen:** Web-Push geht nur an die Push-Dienste der Browser. WordPress-Import und
|
||||
Plugin-Updates erreichen keine internen Adressen, auch nicht über Weiterleitungen.
|
||||
- **Gespeicherte Zugangsdaten** (SMTP, LDAP, OIDC, OpenNIT) gehen nur an das Ziel, für das sie
|
||||
eingetragen wurden. Ändert sich Server oder Adresse, müssen sie neu eingegeben werden.
|
||||
- **HTTP-Header:** `X-Frame-Options`, `X-Content-Type-Options`, `Referrer-Policy`,
|
||||
`Permissions-Policy`, eine Basis-CSP und HSTS bei HTTPS. Das Sitzungs-Cookie ist bei HTTPS
|
||||
automatisch `Secure`.
|
||||
- **Fehlerprotokoll:** Unter „Systemzustand → Letzte Fehler“ stehen die letzten Fehler, jeweils
|
||||
mit betroffener Adresse.
|
||||
|
||||
## Auf dem Server
|
||||
|
||||
### Webserver
|
||||
|
||||
`public/` ist der Webroot. Liegt die Installation im Webroot des Hosters, leitet die mitgelieferte
|
||||
`.htaccess` nach `public/` um und sperrt die internen Ordner. Diese Datei wird bei Updates nicht
|
||||
überschrieben; ältere Installationen übernehmen die neue Fassung also nur von Hand.
|
||||
|
||||
Der Ordner `public/uploads` darf **nie Code ausführen** und muss Dateien mit sicheren Headern
|
||||
ausliefern. Unter Apache übernimmt das `public/uploads/.htaccess`; Voraussetzung sind
|
||||
`AllowOverride All` und `mod_headers`. Für **nginx**:
|
||||
|
||||
```nginx
|
||||
location ^~ /uploads/ {
|
||||
location ~* \.(php[0-9]?|phtml|phar)$ { deny all; }
|
||||
add_header Content-Security-Policy "default-src 'none'; img-src 'self' data:; style-src 'unsafe-inline'; font-src 'self'; sandbox" always;
|
||||
add_header X-Content-Type-Options "nosniff" always;
|
||||
try_files $uri =404;
|
||||
}
|
||||
```
|
||||
|
||||
Für **Caddy** gilt dasselbe sinngemäß: kein `php_fastcgi` unter `/uploads/` und die beiden Header setzen.
|
||||
|
||||
### Hinter einem Reverse-Proxy
|
||||
|
||||
`TRUSTED_PROXIES=<IP des Proxys>` in der `.env` eintragen (oder `*`, wenn nur der Proxy den Server
|
||||
erreicht). Sonst sehen alle Anfragen gleich aus: Begrenzungen treffen dann alle gemeinsam,
|
||||
HTTPS wird nicht erkannt.
|
||||
|
||||
### Cronjob
|
||||
|
||||
Die Zeile unter „Systemzustand → Hintergrundaufgaben“ jede Minute ausführen lassen. Ohne Cron laufen
|
||||
Hintergrundaufgaben nur nach normalen Seitenaufrufen.
|
||||
|
||||
## Empfehlungen, die außerhalb von Inhaus liegen
|
||||
|
||||
- **Signierte Updates:** Update-Archive werden über HTTPS geladen und auf Unversehrtheit geprüft, aber
|
||||
nicht signiert. Empfehlung: Releases auf dem Update-Server mit Ed25519 signieren und den
|
||||
öffentlichen Schlüssel in Inhaus hinterlegen. Das braucht eine Änderung am Update-Server.
|
||||
- **Plugin-Updates:** Für eigene Plugins in der Update-Antwort `sha256` angeben.
|
||||
- **SAML:** Die Anmeldung ist gegen Fälschung abgesichert (signierte Antworten, einmalige Anfragen).
|
||||
Das „Unterschieben“ einer fremden Anmeldung, also Login-CSRF, lässt sich bei SAML wegen
|
||||
SameSite-Cookies nicht vollständig verhindern. Das Risiko ist gering.
|
||||
- **Kunden-Plugins** laufen mit vollen Rechten. Nur Plugins aus vertrauenswürdiger Quelle installieren.
|
||||
Plugin-Routen brauchen selbst `auth`, das vom Generator erzeugte Gerüst macht das.
|
||||
- **Mediathek:** Alt-Text und Bildunterschrift können alle Redakteurinnen und Redakteure gemeinsam
|
||||
pflegen; das ist so gewollt.
|
||||
|
|
@ -4,8 +4,8 @@ declare(strict_types=1);
|
|||
|
||||
return [
|
||||
'reset' => 'Das Passwort wurde zurückgesetzt!',
|
||||
'sent' => 'E-Mail zum Zurücksetzen des Passworts wurde gesendet!',
|
||||
'throttled' => 'Bitte warten Sie, bevor Sie es erneut versuchen.',
|
||||
'sent' => 'Falls es ein Konto mit dieser E-Mail-Adresse gibt, ist eine E-Mail zum Zurücksetzen des Passworts unterwegs.',
|
||||
'throttled' => 'Falls es ein Konto mit dieser E-Mail-Adresse gibt, ist eine E-Mail zum Zurücksetzen des Passworts unterwegs.',
|
||||
'token' => 'Der Passwort-Wiederherstellungsschlüssel ist ungültig oder abgelaufen.',
|
||||
'user' => 'Es konnte leider kein Nutzer mit dieser E-Mail-Adresse gefunden werden.',
|
||||
'user' => 'Falls es ein Konto mit dieser E-Mail-Adresse gibt, ist eine E-Mail zum Zurücksetzen des Passworts unterwegs.',
|
||||
];
|
||||
|
|
|
|||
|
|
@ -86,11 +86,22 @@ class BirthdayList
|
|||
*
|
||||
* @return list<array{date: string, person: array<string, mixed>}>
|
||||
*/
|
||||
public function inMonth(int $year, int $month): array
|
||||
public function inMonth(int $year, int $month, ?User $viewer = null): array
|
||||
{
|
||||
$scope = $this->scope();
|
||||
|
||||
return Birthday::query()
|
||||
->where('month', $month)
|
||||
->whereHas('user', fn ($q) => $q->where('is_active', true))
|
||||
->whereHas('user', function ($q) use ($viewer, $scope) {
|
||||
$q->where('is_active', true);
|
||||
|
||||
// Derselbe Kreis wie in der Geburtstagsliste (Abteilung bzw. Standort)
|
||||
if ($viewer && $scope === 'department') {
|
||||
$viewer->department ? $q->where('department', $viewer->department) : $q->whereKey($viewer->id);
|
||||
} elseif ($viewer && $scope === 'location') {
|
||||
$viewer->location ? $q->where('location', $viewer->location) : $q->whereKey($viewer->id);
|
||||
}
|
||||
})
|
||||
->with('user')
|
||||
->get()
|
||||
->filter(fn (Birthday $b) => checkdate($month, $b->day, $year) || ($month === 2 && $b->day === 29))
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ namespace Inhaus\Plugins\Downloads\Http\Controllers;
|
|||
use App\Http\Controllers\Controller;
|
||||
use App\Models\Grant;
|
||||
use App\Support\Audit;
|
||||
use App\Support\BlockedFiles;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
|
@ -27,7 +28,7 @@ use Symfony\Component\HttpFoundation\StreamedResponse;
|
|||
class DownloadController extends Controller
|
||||
{
|
||||
/** Nie als Datei annehmen: ausführbarer Code, Webseiten, Skripte. */
|
||||
private const BLOCKED = ['php', 'phtml', 'phar', 'php3', 'php4', 'php5', 'php7', 'php8', 'pht', 'shtml', 'htaccess', 'exe', 'bat', 'cmd', 'com', 'sh', 'js', 'mjs', 'html', 'htm', 'svg', 'xhtml', 'jsp', 'asp', 'aspx', 'cgi', 'pl', 'py', 'msi', 'ps1', 'vbs', 'scr'];
|
||||
private const BLOCKED = BlockedFiles::EXTENSIONS;
|
||||
|
||||
public const MAX_KB = 100 * 1024;
|
||||
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ class Calendar
|
|||
|
||||
private function escape(string $value): string
|
||||
{
|
||||
return str_replace(['\\', ';', ',', "\r\n", "\n"], ['\\\\', '\;', '\\,', '\\n', '\\n'], $value);
|
||||
return str_replace(['\\', ';', ',', "\r\n", "\n", "\r"], ['\\\\', '\;', '\\,', '\\n', '\\n', '\\n'], $value);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
namespace Inhaus\Plugins\Events\Filament\Resources\Events;
|
||||
|
||||
use App\Filament\Components\AudienceSection;
|
||||
use App\Filament\Components\SafeUpload;
|
||||
use BackedEnum;
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Filament\Actions\EditAction;
|
||||
|
|
@ -86,7 +87,7 @@ class EventResource extends Resource
|
|||
->schema([
|
||||
AudienceSection::make('event', 'Wer den Termin sieht. Leer lassen = alle.'),
|
||||
Toggle::make('is_published')->label('Veröffentlicht')->default(true),
|
||||
FileUpload::make('image_path')
|
||||
SafeUpload::apply(FileUpload::make('image_path'))
|
||||
->label('Bild')
|
||||
->helperText('Optional, Querformat.')
|
||||
->image()
|
||||
|
|
|
|||
|
|
@ -75,20 +75,24 @@ class FormResource extends Resource
|
|||
Toggle::make('settings.once_per_user')->label('Jede Person nur einmal')->inline(false),
|
||||
Textarea::make('settings.confirmation')->label('Bestätigung nach dem Absenden')->placeholder('Vielen Dank! Ihre Angaben sind eingegangen.')->rows(2)->maxLength(1000)->columnSpanFull(),
|
||||
Toggle::make('settings.anonymous')->label('Anonym')
|
||||
->disabled(fn (?Form $record) => $record && ! auth()->user()->can('forms.manage') && ! auth()->user()->can('viewResults', $record))->dehydrated()
|
||||
->helperText('Name und E-Mail-Adresse werden nicht gespeichert und nicht mitgeschickt – z. B. für Umfragen oder vertrauliche Meldungen an die MAV.')
|
||||
->columnSpanFull(),
|
||||
TextInput::make('settings.retention_days')->label('Einsendungen automatisch löschen nach')->numeric()->minValue(1)->maxValue(3650)->suffix('Tagen')
|
||||
->helperText('Leer = nicht automatisch löschen.'),
|
||||
]),
|
||||
Tab::make('Benachrichtigung')->icon(Heroicon::OutlinedEnvelope)->schema([
|
||||
TagsInput::make('settings.notify_emails')->label('E-Mail an')->placeholder('personal@firma.de')
|
||||
->nestedRecursiveRules(['email'])
|
||||
->helperText('Bei jeder Einsendung. Auch Funktionspostfächer möglich.'),
|
||||
Toggle::make('settings.notify_viewers')->label('Alle mit Zugriff auf die Ergebnisse benachrichtigen (E-Mail und Glocke im Portal)'),
|
||||
Toggle::make('settings.mail_answers')->label('Angaben in die E-Mail aufnehmen')->default(true)
|
||||
->helperText('Aus, wenn die Angaben vertraulich sind – die E-Mail enthält dann nur einen Link zu den Ergebnissen.'),
|
||||
Toggle::make('settings.send_copy')->label('Kopie an die ausfüllende Person'),
|
||||
]),
|
||||
Tab::make('Benachrichtigung')->icon(Heroicon::OutlinedEnvelope)
|
||||
// Empfänger festlegen nur mit Zugriff auf die Ergebnisse
|
||||
->disabled(fn (?Form $record) => $record && ! auth()->user()->can('forms.manage') && ! auth()->user()->can('viewResults', $record))
|
||||
->schema([
|
||||
TagsInput::make('settings.notify_emails')->label('E-Mail an')->placeholder('personal@firma.de')
|
||||
->nestedRecursiveRules(['email'])
|
||||
->helperText('Bei jeder Einsendung. Auch Funktionspostfächer möglich.'),
|
||||
Toggle::make('settings.notify_viewers')->label('Alle mit Zugriff auf die Ergebnisse benachrichtigen (E-Mail und Glocke im Portal)'),
|
||||
Toggle::make('settings.mail_answers')->label('Angaben in die E-Mail aufnehmen')->default(true)
|
||||
->helperText('Aus, wenn die Angaben vertraulich sind – die E-Mail enthält dann nur einen Link zu den Ergebnissen.'),
|
||||
Toggle::make('settings.send_copy')->label('Kopie an die ausfüllende Person'),
|
||||
]),
|
||||
Tab::make('Zugriff')->icon(Heroicon::OutlinedLockClosed)->schema([
|
||||
Section::make('Ergebnisse')
|
||||
->description('Welche Rollen die Einsendungen dieses Formulars sehen – z. B. nur die Personalabteilung.')
|
||||
|
|
|
|||
|
|
@ -12,6 +12,28 @@ class EditForm extends EditRecord
|
|||
{
|
||||
protected static string $resource = FormResource::class;
|
||||
|
||||
/** Einstellungen, über die Einsendungen weitergegeben oder Personen erkennbar werden */
|
||||
public const CONFIDENTIAL_SETTINGS = ['notify_emails', 'notify_viewers', 'mail_answers', 'send_copy', 'anonymous'];
|
||||
|
||||
/**
|
||||
* Wer nur Felder bearbeiten darf (ohne Ergebnis-Rechte), kann Empfänger und Anonymität
|
||||
* nicht ändern – sonst ließen sich Einsendungen umleiten oder Personen erkennbar machen.
|
||||
*/
|
||||
protected function mutateFormDataBeforeSave(array $data): array
|
||||
{
|
||||
if (! auth()->user()->can('forms.manage') && ! auth()->user()->can('viewResults', $this->record)) {
|
||||
foreach (self::CONFIDENTIAL_SETTINGS as $key) {
|
||||
if (array_key_exists($key, (array) $this->record->settings)) {
|
||||
$data['settings'][$key] = $this->record->settings[$key];
|
||||
} else {
|
||||
unset($data['settings'][$key]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ namespace Inhaus\Plugins\Forms\Http\Controllers;
|
|||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Support\Audit;
|
||||
use App\Support\Csv;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Gate;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
|
|
@ -56,13 +57,13 @@ class FormResultsController extends Controller
|
|||
}
|
||||
});
|
||||
|
||||
fputcsv($out, ['Eingegangen am', ...($anonymous ? [] : ['Name', 'E-Mail']), ...array_values($known)], ';', '"', '');
|
||||
fputcsv($out, ['Eingegangen am', ...($anonymous ? [] : ['Name', 'E-Mail']), ...array_map(self::cell(...), array_values($known))], ';', '"', '');
|
||||
|
||||
$submissions()->with('user:id,name,email')->orderBy('id')->chunkById(500, function ($chunk) use ($out, $known, $anonymous) {
|
||||
foreach ($chunk as $submission) {
|
||||
fputcsv($out, [
|
||||
$submission->created_at->timezone(config('app.timezone'))->format('d.m.Y H:i'),
|
||||
...($anonymous ? [] : [$submission->user?->name ?? '', $submission->user?->email ?? '']),
|
||||
...($anonymous ? [] : [self::cell($submission->user?->name ?? ''), self::cell($submission->user?->email ?? '')]),
|
||||
...array_map(fn ($key) => self::cell($submission->display($key)), array_keys($known)),
|
||||
], ';', '"', '');
|
||||
}
|
||||
|
|
@ -77,6 +78,6 @@ class FormResultsController extends Controller
|
|||
*/
|
||||
private static function cell(string $value): string
|
||||
{
|
||||
return preg_match('/^[=+\-@\t\r]/', $value) ? "'".$value : $value;
|
||||
return Csv::cell($value);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
namespace Inhaus\Plugins\Gemeinsam\Http\Controllers;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Plugins\PluginAccess;
|
||||
use App\Plugins\PluginManager;
|
||||
use App\Support\Audit;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
|
|
@ -27,11 +28,12 @@ class GemeinsamController extends Controller
|
|||
|
||||
foreach (Entry::SECTIONS as $key => $title) {
|
||||
if ($key === 'birthdays') {
|
||||
if (! app(PluginManager::class)->isLoaded('birthdays')) {
|
||||
// Wie das Geburtstags-Modul selbst: nicht für ausgeschlossene Rollen, nur im eingestellten Kreis
|
||||
if (! app(PluginManager::class)->isLoaded('birthdays') || ! app(PluginAccess::class)->allows('birthdays', $request->user())) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$rows = app(BirthdayList::class)->inMonth($month->year, $month->month);
|
||||
$rows = app(BirthdayList::class)->inMonth($month->year, $month->month, $request->user());
|
||||
$sections[] = ['key' => $key, 'title' => $title, 'automatic' => true, 'entries' => array_map(fn ($row) => [
|
||||
'id' => 'b'.$row['person']['id'],
|
||||
'date' => $row['date'],
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ namespace Inhaus\Plugins\ItService\OpenNit;
|
|||
|
||||
use App\Support\Settings as PortalSettings;
|
||||
use Illuminate\Support\Facades\Crypt;
|
||||
use Illuminate\Validation\ValidationException;
|
||||
use Throwable;
|
||||
|
||||
/**
|
||||
|
|
@ -75,6 +76,11 @@ class Settings
|
|||
*/
|
||||
public function save(array $data): void
|
||||
{
|
||||
// Neue Adresse: Token und Secret neu eingeben – sonst gingen die gespeicherten an den neuen Server
|
||||
if (self::normalizeUrl($data['url']) !== $this->url() && $this->token() !== '' && (blank($data['token'] ?? null) || blank($data['secret'] ?? null))) {
|
||||
throw ValidationException::withMessages(['data.token' => 'Die Adresse wurde geändert – bitte Token und Signier-Secret erneut eingeben.']);
|
||||
}
|
||||
|
||||
$this->settings->set(self::URL, self::normalizeUrl($data['url']));
|
||||
|
||||
foreach ([self::TOKEN => $data['token'] ?? null, self::SECRET => $data['secret'] ?? null] as $key => $value) {
|
||||
|
|
|
|||
|
|
@ -20,10 +20,9 @@ class NativeLdapConnector implements LdapConnector
|
|||
$port = $options['port'] ?: ($scheme === 'ldaps' ? 636 : 389);
|
||||
$uris = implode(' ', array_map(fn ($host) => str_contains($host, '://') ? $host : "{$scheme}://{$host}:{$port}", $options['hosts']));
|
||||
|
||||
if (! $options['verify_tls']) {
|
||||
// Muss vor ldap_connect gesetzt werden, damit es für die Verbindung gilt.
|
||||
ldap_set_option(null, LDAP_OPT_X_TLS_REQUIRE_CERT, LDAP_OPT_X_TLS_NEVER);
|
||||
}
|
||||
// Muss vor ldap_connect gesetzt werden und gilt prozessweit – deshalb immer ausdrücklich
|
||||
// setzen, sonst prüften nach einem Server ohne Prüfung auch spätere Verbindungen nicht mehr.
|
||||
ldap_set_option(null, LDAP_OPT_X_TLS_REQUIRE_CERT, $options['verify_tls'] ? LDAP_OPT_X_TLS_DEMAND : LDAP_OPT_X_TLS_NEVER);
|
||||
|
||||
$link = ldap_connect($uris);
|
||||
|
||||
|
|
|
|||
|
|
@ -132,6 +132,11 @@ class LdapDriver extends IdentityDriver
|
|||
return ['bind_password'];
|
||||
}
|
||||
|
||||
public function destinationFields(): array
|
||||
{
|
||||
return ['hosts', 'port', 'bind_dn', 'encryption'];
|
||||
}
|
||||
|
||||
public function defaultAttributeMap(): array
|
||||
{
|
||||
return LdapDirectory::DEFAULT_MAPS['ad'];
|
||||
|
|
|
|||
|
|
@ -0,0 +1,28 @@
|
|||
<?php
|
||||
|
||||
use App\Pagebuilder\Content;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
/**
|
||||
* Suchtext der Beiträge neu erzeugen – ohne Blöcke mit eingeschränkter Sichtbarkeit
|
||||
* (vorher landete auch deren Text in Suche und Auszügen).
|
||||
*/
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
$content = app(Content::class);
|
||||
|
||||
DB::table('news_posts')->whereNotNull('content')->orderBy('id')->each(function ($post) use ($content) {
|
||||
$blocks = json_decode((string) $post->content, true);
|
||||
|
||||
if (! is_array($blocks)) {
|
||||
return;
|
||||
}
|
||||
|
||||
$text = $content->plainText($blocks, publicOnly: true);
|
||||
DB::table('news_posts')->where('id', $post->id)->update(['body' => $text !== '' ? '<p>'.e($text).'</p>' : null]);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
|
@ -8,7 +8,7 @@ use Inhaus\Plugins\News\Http\Controllers\NewsEditorController;
|
|||
Route::middleware('auth')->group(function () {
|
||||
Route::get('/neuigkeiten', [NewsController::class, 'index'])->name('news.index');
|
||||
Route::get('/neuigkeiten/{post:slug}', [NewsController::class, 'show'])->name('news.show');
|
||||
Route::post('/neuigkeiten/{post:slug}/kommentare', [NewsCommentController::class, 'store'])->name('news.comments.store');
|
||||
Route::post('/neuigkeiten/{post:slug}/kommentare', [NewsCommentController::class, 'store'])->middleware('throttle:20,1')->name('news.comments.store');
|
||||
Route::put('/kommentare/{comment}', [NewsCommentController::class, 'update'])->name('news.comments.update');
|
||||
Route::delete('/kommentare/{comment}', [NewsCommentController::class, 'destroy'])->name('news.comments.destroy');
|
||||
|
||||
|
|
@ -16,7 +16,7 @@ Route::middleware('auth')->group(function () {
|
|||
Route::get('/neu', 'create')->name('create');
|
||||
Route::post('/', 'store')->name('store');
|
||||
Route::post('/bilder', 'uploadImage')->name('images');
|
||||
Route::post('/vorschau', 'preview')->name('preview');
|
||||
Route::post('/vorschau', 'preview')->middleware('throttle:60,1')->name('preview');
|
||||
Route::get('/{post}', 'edit')->name('edit');
|
||||
Route::put('/{post}', 'update')->name('update');
|
||||
Route::delete('/{post}', 'destroy')->name('destroy');
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
namespace Inhaus\Plugins\News\Filament\Resources\NewsPosts;
|
||||
|
||||
use App\Filament\Components\SafeUpload;
|
||||
use BackedEnum;
|
||||
use Filament\Actions\Action;
|
||||
use Filament\Actions\DeleteAction;
|
||||
|
|
@ -112,7 +113,7 @@ class NewsPostResource extends Resource
|
|||
->options(fn () => FormEmbed::options())
|
||||
->visible(fn () => FormEmbed::available())
|
||||
->searchable(),
|
||||
FileUpload::make('cover_path')
|
||||
SafeUpload::apply(FileUpload::make('cover_path'))
|
||||
->label('Titelbild')
|
||||
->helperText('Querformat, mindestens 1600 × 900 Pixel.')
|
||||
->image()
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ class NewsApiController extends Controller
|
|||
'author' => $post->author ? ['id' => $post->author->id, 'name' => $post->author->name, 'avatar_url' => $post->author->avatarUrl(96)] : null,
|
||||
// Inhalt als Blöcke (wie im Pagebuilder) und als reiner Text
|
||||
'blocks' => $rendered['blocks'],
|
||||
'text' => $content->plainText($post->blocks()),
|
||||
'text' => $content->plainText($rendered),
|
||||
]]);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -49,6 +49,9 @@ class NewsCommentController extends Controller
|
|||
public function update(Request $request, NewsComment $comment): RedirectResponse
|
||||
{
|
||||
abort_unless($comment->user_id === $request->user()->id, 403);
|
||||
// Nur solange der Beitrag sichtbar ist und Kommentare offen sind
|
||||
$post = $comment->post;
|
||||
abort_unless($post && $post->comments_enabled && $post->isPublished() && $post->isVisibleTo($request->user()), 403, 'Kommentare sind für diesen Beitrag geschlossen.');
|
||||
|
||||
$data = $request->validate(['body' => ['required', 'string', 'max:'.NewsComment::MAX_LENGTH]], [], ['body' => 'Kommentar']);
|
||||
$comment->forceFill(['body' => trim($data['body']), 'edited_at' => now()])->save();
|
||||
|
|
|
|||
|
|
@ -165,7 +165,8 @@ class NewsEditorController extends Controller
|
|||
}
|
||||
|
||||
$content = $this->content->sanitize(json_decode($data['content'] ?? '[]', true) ?: []);
|
||||
$text = $this->content->plainText($content);
|
||||
// Nur allgemein sichtbare Blöcke – der Text dient Suche und Auszügen für alle
|
||||
$text = $this->content->plainText($content, publicOnly: true);
|
||||
|
||||
$post->fill([
|
||||
'title' => $data['title'],
|
||||
|
|
|
|||
|
|
@ -26,9 +26,14 @@ class NewsPostPolicy
|
|||
return $user->can('news.manage') || ($post->category_id && $user->can('news.post.create', ['news_category', $post->category_id]));
|
||||
}
|
||||
|
||||
/**
|
||||
* Veröffentlichte Beiträge löscht nur, wer in der Kategorie veröffentlichen darf
|
||||
* (gilt im Portal und im Backend gleichermaßen).
|
||||
*/
|
||||
public function delete(User $user, NewsPost $post): bool
|
||||
{
|
||||
return $this->update($user, $post);
|
||||
return $this->update($user, $post)
|
||||
&& ($post->status !== NewsPost::PUBLISHED || $this->publish($user, $post->category_id));
|
||||
}
|
||||
|
||||
public function publish(User $user, ?int $categoryId): bool
|
||||
|
|
|
|||
|
|
@ -56,6 +56,11 @@ class OidcClient
|
|||
if (! is_string($document[$field] ?? null) || $document[$field] === '') {
|
||||
throw new IdentityException("Das Discovery-Dokument des Anmeldedienstes enthält kein „{$field}“.");
|
||||
}
|
||||
|
||||
// Schlüssel und Tokens nur über HTTPS – sonst ließen sie sich unterwegs austauschen
|
||||
if (! self::secureUrl($document[$field])) {
|
||||
throw new IdentityException("„{$field}“ des Anmeldedienstes muss mit https:// beginnen.");
|
||||
}
|
||||
}
|
||||
|
||||
// Der Aussteller muss exakt der konfigurierten Adresse entsprechen (OIDC Discovery 4.3).
|
||||
|
|
@ -233,4 +238,11 @@ class OidcClient
|
|||
{
|
||||
return Http::timeout(15)->connectTimeout(5)->acceptJson();
|
||||
}
|
||||
|
||||
/** https – nur auf dem eigenen Rechner (Entwicklung) auch http */
|
||||
public static function secureUrl(string $url): bool
|
||||
{
|
||||
return str_starts_with(strtolower($url), 'https://')
|
||||
|| (app()->environment('local', 'testing') && preg_match('#^http://(localhost|127\.0\.0\.1)(:\d+)?(/|$)#i', $url));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -51,6 +51,7 @@ class OidcDriver extends IdentityDriver
|
|||
{
|
||||
return [
|
||||
TextInput::make('config.issuer')->label('Aussteller (Issuer-URL)')->required()->url()->maxLength(255)
|
||||
->rule(fn () => fn (string $attribute, mixed $value, \Closure $fail) => OidcClient::secureUrl((string) $value) ? null : $fail('Bitte eine https://-Adresse angeben.'))
|
||||
->placeholder('https://login.firma.de/realms/mitarbeitende')
|
||||
->helperText('Die Adresse, unter der /.well-known/openid-configuration liegt.')
|
||||
->columnSpanFull(),
|
||||
|
|
@ -75,6 +76,11 @@ class OidcDriver extends IdentityDriver
|
|||
return ['client_secret'];
|
||||
}
|
||||
|
||||
public function destinationFields(): array
|
||||
{
|
||||
return ['issuer'];
|
||||
}
|
||||
|
||||
public function defaultAttributeMap(): array
|
||||
{
|
||||
return ['first_name' => 'given_name', 'last_name' => 'family_name', 'email' => 'email'];
|
||||
|
|
@ -172,6 +178,9 @@ class OidcDriver extends IdentityDriver
|
|||
'email' => 'email',
|
||||
]);
|
||||
|
||||
// Hat der Anbieter die Adresse bestätigt? (für das Verknüpfen bestehender Konten)
|
||||
$profile['email_verified'] = in_array($claims['email_verified'] ?? null, [true, 'true'], true);
|
||||
|
||||
return new ExternalUser(
|
||||
subject: $subject,
|
||||
profile: $profile,
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ Route::middleware('auth')->group(function () {
|
|||
Route::get('/', 'index')->name('index');
|
||||
Route::post('/', 'store')->name('store');
|
||||
Route::post('/bilder', 'uploadImage')->name('images');
|
||||
Route::post('/vorschau', 'preview')->name('preview');
|
||||
Route::post('/vorschau', 'preview')->middleware('throttle:60,1')->name('preview');
|
||||
Route::get('/{snippet}', 'edit')->name('edit');
|
||||
Route::put('/{snippet}', 'update')->name('update');
|
||||
Route::delete('/{snippet}', 'destroy')->name('destroy');
|
||||
|
|
@ -39,6 +39,6 @@ Route::middleware('auth')->group(function () {
|
|||
Route::post('/{page}/sperre/freigeben', 'unlock')->name('unlock');
|
||||
Route::post('/{page}/bilder', 'uploadImage')->name('images');
|
||||
Route::post('/{page}/dateien', 'uploadFile')->name('files');
|
||||
Route::post('/{page}/vorschau', 'preview')->name('preview');
|
||||
Route::post('/{page}/vorschau', 'preview')->middleware('throttle:60,1')->name('preview');
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -62,7 +62,12 @@ class PageController extends Controller
|
|||
public function file(Request $request, PageFile $file, PageTree $tree): StreamedResponse
|
||||
{
|
||||
$page = $file->page;
|
||||
abort_unless($tree->isVisible($page->id, $request->user()) || $request->user()->can('update', $page), 404);
|
||||
$user = $request->user();
|
||||
|
||||
// Redaktion: alle Dateien der Seite. Sonst nur Dateien, die im veröffentlichten Inhalt
|
||||
// für diese Person sichtbar eingebunden sind (Downloads-Block oder Link im Text) –
|
||||
// nicht Dateien aus Entwürfen oder aus Blöcken für andere Zielgruppen.
|
||||
abort_unless($user->can('update', $page) || ($tree->isVisible($page->id, $user) && self::referenced($page, $file, $user)), 404);
|
||||
|
||||
return Storage::disk(PageFile::DISK)->download($file->path, $file->name, [
|
||||
'Content-Type' => $file->mime ?: 'application/octet-stream',
|
||||
|
|
@ -70,4 +75,17 @@ class PageController extends Controller
|
|||
'X-Content-Type-Options' => 'nosniff',
|
||||
]);
|
||||
}
|
||||
|
||||
private static function referenced(Page $page, PageFile $file, $user): bool
|
||||
{
|
||||
if ($page->content === null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$rendered = app(Content::class)->render($page->content, $user, ['page_id' => $page->id]);
|
||||
$inBlocks = collect(app(Content::class)->collect($rendered, fn (array $block) => $block['type'] === 'downloads' ? (array) ($block['data']['files'] ?? []) : []))
|
||||
->map(fn ($id) => (int) $id)->contains($file->id);
|
||||
|
||||
return $inBlocks || str_contains((string) json_encode($rendered, JSON_UNESCAPED_SLASHES), '/dateien/seiten/'.$file->id.'/');
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ use App\Notifications\PortalNotification;
|
|||
use App\Pagebuilder\Blocks;
|
||||
use App\Pagebuilder\Content;
|
||||
use App\Support\Audit;
|
||||
use App\Support\BlockedFiles;
|
||||
use App\Support\Permissions\Audiences;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
|
|
@ -39,7 +40,7 @@ use Inhaus\Plugins\Pages\Publishers;
|
|||
class PageEditorController extends Controller
|
||||
{
|
||||
/** Dateiendungen, die nie als Download angenommen werden. */
|
||||
private const BLOCKED_EXTENSIONS = ['php', 'phtml', 'phar', 'php3', 'php4', 'php5', 'php7', 'php8', 'pht', 'shtml', 'htaccess', 'exe', 'bat', 'cmd', 'com', 'sh', 'js', 'mjs', 'html', 'htm', 'svg', 'xhtml', 'jsp', 'asp', 'aspx', 'cgi', 'pl', 'py'];
|
||||
private const BLOCKED_EXTENSIONS = BlockedFiles::EXTENSIONS;
|
||||
|
||||
public function __construct(private readonly Content $content) {}
|
||||
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ use Illuminate\Validation\Rules\File;
|
|||
use Inertia\Inertia;
|
||||
use Inertia\Response;
|
||||
use Inhaus\Plugins\Pages\Models\ContentSnippet;
|
||||
use Inhaus\Plugins\Pages\Models\Page;
|
||||
use Inhaus\Plugins\Pages\Snippets;
|
||||
|
||||
/**
|
||||
|
|
@ -31,6 +32,9 @@ class SnippetController extends Controller
|
|||
*/
|
||||
public function index(Request $request): JsonResponse
|
||||
{
|
||||
// Namen der Bausteine und Vorlagen nur für die Seiten-Redaktion
|
||||
abort_unless($request->user()->can('viewAny', Page::class), 403);
|
||||
|
||||
$request->validate(['kind' => ['nullable', Rule::in(array_keys(ContentSnippet::KINDS))]]);
|
||||
|
||||
return response()->json(['snippets' => ContentSnippet::query()
|
||||
|
|
|
|||
|
|
@ -3,13 +3,14 @@
|
|||
namespace Inhaus\Plugins\Pages;
|
||||
|
||||
use App\Models\User;
|
||||
use App\Pagebuilder\Content;
|
||||
use App\Search\GlobalSearch;
|
||||
use Inhaus\Plugins\Pages\Models\Page;
|
||||
|
||||
/** Suchquelle für die globale Suche: veröffentlichte, sichtbare Seiten */
|
||||
class PageSearch
|
||||
{
|
||||
public function __construct(private readonly PageTree $tree) {}
|
||||
public function __construct(private readonly PageTree $tree, private readonly Content $content) {}
|
||||
|
||||
/**
|
||||
* @return list<array<string, mixed>>
|
||||
|
|
@ -27,27 +28,30 @@ class PageSearch
|
|||
}
|
||||
});
|
||||
|
||||
return $query->orderBy('title')->limit($limit * 3)->get()
|
||||
->filter(fn (Page $page) => $this->tree->isVisible($page->id, $user))
|
||||
->take($limit)
|
||||
->map(fn (Page $page) => [
|
||||
$terms = GlobalSearch::terms($search);
|
||||
$results = [];
|
||||
|
||||
foreach ($query->orderBy('title')->limit($limit * 3)->get() as $page) {
|
||||
if (count($results) >= $limit || ! $this->tree->isVisible($page->id, $user)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Treffer und Auszug nur aus dem, was diese Person auf der Seite sieht
|
||||
// (Blöcke mit eingeschränkter Sichtbarkeit zählen nicht)
|
||||
$text = $this->content->plainText($this->content->render($page->content, $user, ['page_id' => $page->id]));
|
||||
|
||||
if (! collect($terms)->every(fn (string $term) => mb_stripos($page->title.' '.$text, $term) !== false)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$results[] = [
|
||||
'title' => $page->title,
|
||||
'url' => $page->url(),
|
||||
'excerpt' => GlobalSearch::excerpt($this->text($page->content), $search),
|
||||
'excerpt' => GlobalSearch::excerpt($text, $search),
|
||||
'meta' => collect($this->tree->ancestors($page->id))->pluck('title')->filter()->implode(' › ') ?: 'Seite',
|
||||
])->values()->all();
|
||||
}
|
||||
];
|
||||
}
|
||||
|
||||
/** Alle Texte aus den Pagebuilder-Blöcken */
|
||||
private function text(mixed $content): string
|
||||
{
|
||||
$parts = [];
|
||||
array_walk_recursive($content, function ($value, $key) use (&$parts) {
|
||||
if (is_string($value) && ! in_array($key, ['type', 'id', 'url', 'image', 'icon', 'layout', 'variant'], true) && ! preg_match('#^(https?:|/|[a-z0-9_.-]+$)#i', $value)) {
|
||||
$parts[] = $value;
|
||||
}
|
||||
});
|
||||
|
||||
return implode(' ', $parts);
|
||||
return $results;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -190,9 +190,13 @@ class PagesPlugin extends Plugin
|
|||
Field::ids('files', 'Dateien', 'page-file'),
|
||||
])
|
||||
->resolveUsing(function (array $data, ?User $user, array $context) {
|
||||
$files = PageFile::query()->whereIn('id', $data['files'])
|
||||
->when(isset($context['page_id']), fn ($q) => $q->where('page_id', $context['page_id']))
|
||||
->get()->keyBy('id');
|
||||
// Nur Dateien der eigenen Seite – außerhalb einer Seite (Beitrag, Startseite) keine,
|
||||
// sonst ließen sich Namen von Dateien fremder Seiten per Nummer auslesen.
|
||||
if (! isset($context['page_id'])) {
|
||||
return ['files' => []];
|
||||
}
|
||||
|
||||
$files = PageFile::query()->whereIn('id', $data['files'])->where('page_id', $context['page_id'])->get()->keyBy('id');
|
||||
|
||||
return ['files' => collect($data['files'])->map(fn ($id) => $files->get($id)?->toBlockArray())->filter()->values()->all()];
|
||||
}));
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
namespace Inhaus\Plugins\Qm\Filament\Resources\QmFolders;
|
||||
|
||||
use App\Filament\Components\SafeUpload;
|
||||
use App\Support\Icons;
|
||||
use BackedEnum;
|
||||
use Filament\Actions\Action;
|
||||
|
|
@ -83,9 +84,8 @@ class QmFolderResource extends Resource
|
|||
->getOptionLabelUsing(fn (?string $value) => $value ? Icons::option($value) : null)
|
||||
->placeholder(fn (Get $get) => blank($get('parent_id')) ? 'Ordner' : 'Vom übergeordneten Ordner übernehmen')
|
||||
->helperText('Alle 1.800+ Symbole über die Suche (englische Namen).'),
|
||||
FileUpload::make('icon_path')->label('Oder eigenes Symbol hochladen')
|
||||
->disk('uploads')->directory('qm-icons')->visibility('public')
|
||||
->acceptedFileTypes(['image/svg+xml', 'image/png', 'image/webp', 'image/jpeg'])->maxSize(1024)
|
||||
SafeUpload::apply(FileUpload::make('icon_path'), ['image/svg+xml', 'image/png', 'image/webp', 'image/jpeg'])->label('Oder eigenes Symbol hochladen')
|
||||
->disk('uploads')->directory('qm-icons')->visibility('public')->maxSize(1024)
|
||||
->helperText('SVG (empfohlen), PNG, WebP oder JPG, quadratisch. Ersetzt das Symbol aus der Auswahl.')
|
||||
->live(),
|
||||
Toggle::make('icon_mono')->label('Eigenes Symbol einfarbig darstellen')->default(true)
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ namespace Inhaus\Plugins\Qm\Http\Controllers;
|
|||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Support\Audit;
|
||||
use App\Support\Csv;
|
||||
use App\Support\RichText;
|
||||
use App\Support\Settings;
|
||||
use Carbon\Carbon;
|
||||
|
|
@ -112,7 +113,7 @@ class QmController extends Controller
|
|||
$rows[] = [$p['name'], $p['department'], $p['job_title'], 'offen', ''];
|
||||
}
|
||||
|
||||
$csv = "\u{FEFF}".collect($rows)->map(fn (array $row) => implode(';', array_map(fn ($v) => '"'.str_replace('"', '""', (string) $v).'"', $row)))->implode("\r\n");
|
||||
$csv = "\u{FEFF}".collect($rows)->map(fn (array $row) => implode(';', array_map(fn ($v) => '"'.str_replace('"', '""', Csv::cell($v)).'"', $row)))->implode("\r\n");
|
||||
|
||||
return response($csv, 200, [
|
||||
'Content-Type' => 'text/csv; charset=UTF-8',
|
||||
|
|
|
|||
|
|
@ -90,8 +90,8 @@ class Ocr
|
|||
{
|
||||
$binary = trim((string) $this->settings->get(self::SETTING_BINARY, '')) ?: 'tesseract';
|
||||
|
||||
// Nur ein Programmname oder ein absoluter Pfad – keine Parameter.
|
||||
return preg_match('#^(/[\w./-]+|[\w.-]+)$#', $binary) ? $binary : 'tesseract';
|
||||
// Nur Tesseract selbst (Programmname oder absoluter Pfad dazu) – kein beliebiges Programm.
|
||||
return preg_match('#^(/[\w./-]+/)?tesseract(\.exe)?$#', $binary) ? $binary : 'tesseract';
|
||||
}
|
||||
|
||||
private function rasterizer(bool $exec): ?string
|
||||
|
|
|
|||
|
|
@ -119,7 +119,11 @@ class SamlService
|
|||
*/
|
||||
public function importMetadata(string $url, ?string $entityId = null): array
|
||||
{
|
||||
$response = Http::timeout(15)->connectTimeout(5)->get($url);
|
||||
if (! str_starts_with(strtolower($url), 'https://')) {
|
||||
throw new IdentityException('Die Metadaten-Adresse muss mit https:// beginnen.');
|
||||
}
|
||||
|
||||
$response = Http::timeout(15)->connectTimeout(5)->withOptions(['allow_redirects' => ['max' => 3, 'protocols' => ['https']]])->get($url);
|
||||
|
||||
if (! $response->successful()) {
|
||||
throw new IdentityException('Metadaten nicht abrufbar (HTTP '.$response->status().').');
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ namespace Inhaus\Plugins\Stellen;
|
|||
|
||||
use App\Models\User;
|
||||
use App\Notifications\PortalNotification;
|
||||
use App\Plugins\PluginAccess;
|
||||
use Illuminate\Support\Facades\Notification;
|
||||
use Inhaus\Plugins\Stellen\Models\JobPosting;
|
||||
|
||||
|
|
@ -27,7 +28,12 @@ class Announcer
|
|||
'briefcase',
|
||||
);
|
||||
|
||||
User::query()->active()->whereKeyNot($posting->created_by ?? 0)->chunkById(500, fn ($users) => Notification::send($users, $notification));
|
||||
// Nicht an Rollen, die vom Modul „Stellen“ ausgeschlossen sind
|
||||
$excluded = app(PluginAccess::class)->excludedRoles('stellen');
|
||||
|
||||
User::query()->active()->whereKeyNot($posting->created_by ?? 0)
|
||||
->when($excluded !== [], fn ($q) => $q->whereDoesntHave('roles', fn ($r) => $r->whereIn('roles.id', $excluded)))
|
||||
->chunkById(500, fn ($users) => Notification::send($users, $notification));
|
||||
}
|
||||
|
||||
public function announceDue(): int
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ use Illuminate\Support\Facades\Storage;
|
|||
use Illuminate\Support\Str;
|
||||
use Illuminate\Validation\Rule;
|
||||
use Illuminate\Validation\Rules\File;
|
||||
use Illuminate\Validation\ValidationException;
|
||||
use Inertia\Inertia;
|
||||
use Inertia\Response;
|
||||
use Inhaus\Plugins\Stellen\Announcer;
|
||||
|
|
@ -172,6 +173,11 @@ class JobEditorController extends Controller
|
|||
'title' => 'Titel', 'deadline' => 'Bewerbungsfrist', 'apply_url' => 'Link', 'apply_email' => 'E-Mail-Adresse', 'notify_email' => 'E-Mail', 'pdf' => 'PDF',
|
||||
]);
|
||||
|
||||
// Die Ansprechperson sieht alle Bewerbungen – sich selbst eintragen nur mit „Bewerbungen einsehen“
|
||||
if ((int) ($data['contact_id'] ?? 0) === $request->user()->id && ! $request->user()->can('jobs.applications')) {
|
||||
throw ValidationException::withMessages(['contact_id' => 'Sich selbst als Ansprechperson eintragen darf nur, wer Bewerbungen einsehen darf.']);
|
||||
}
|
||||
|
||||
$url = $data['apply_mode'] === 'link' ? Field::safeUrl($data['apply_url'] ?? '') : '';
|
||||
|
||||
return [
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
namespace Inhaus\Plugins\WordpressImport;
|
||||
|
||||
use App\Support\Images;
|
||||
use App\Support\SafeOutbound;
|
||||
use Illuminate\Http\UploadedFile;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
|
|
@ -65,12 +66,26 @@ class MediaDownloader
|
|||
return $known;
|
||||
}
|
||||
|
||||
// Keine internen Adressen abrufen (die URLs stammen aus der hochgeladenen Exportdatei)
|
||||
if (! SafeOutbound::isPublicUrl($url)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$tmp = tempnam(sys_get_temp_dir(), 'wpimg');
|
||||
|
||||
try {
|
||||
$response = Http::timeout(20)->connectTimeout(10)->get($url);
|
||||
// Beim Überschreiten der Größe schon während des Ladens abbrechen
|
||||
$response = Http::timeout(20)->connectTimeout(10)->withOptions([
|
||||
...SafeOutbound::options(),
|
||||
'progress' => function ($total, $downloaded) {
|
||||
if ($total > self::MAX_BYTES || $downloaded > self::MAX_BYTES) {
|
||||
throw new \RuntimeException('Datei zu groß');
|
||||
}
|
||||
},
|
||||
])->get($url);
|
||||
$mime = strtolower(explode(';', (string) $response->header('Content-Type'))[0]);
|
||||
$extension = ['image/jpeg' => 'jpg', 'image/png' => 'png', 'image/gif' => 'gif', 'image/webp' => 'webp'][$mime] ?? null;
|
||||
|
||||
$body = $response->successful() ? $response->body() : '';
|
||||
|
||||
if (! $extension || $body === '' || strlen($body) > self::MAX_BYTES) {
|
||||
|
|
|
|||
|
|
@ -29,6 +29,11 @@ class WxrReader
|
|||
{
|
||||
$reader = new XMLReader;
|
||||
|
||||
// Keine eigenen Entitäten (Schutz vor „Billion Laughs“ – WordPress-Exporte nutzen keine)
|
||||
if (str_contains((string) @file_get_contents($file, false, null, 0, 65536), '<!ENTITY')) {
|
||||
throw new RuntimeException('Die Datei enthält nicht unterstützte XML-Entitäten.');
|
||||
}
|
||||
|
||||
if (! @$reader->open($file, null, LIBXML_NONET | LIBXML_COMPACT | LIBXML_PARSEHUGE)) {
|
||||
throw new RuntimeException('Die Datei konnte nicht gelesen werden.');
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
import{D as e,E as t,J as n,On as r,_ as i,b as a,bt as o,g as s,mt as c,o as l,qt as u,tr as d,v as f,wt as p}from"./runtime-core.esm-bundler-B8D2lM98.js";import{Xt as m,at as h,ct as g,lt as _,ot as v,st as y}from"./app-tnmYSRAa.js";var b={class:`px-5 pt-1 pb-5`},x={__name:`Accordion`,props:{block:{type:Object,required:!0}},setup(x){let S=x,C=n(`pagebuilder:list`),w=n(`pagebuilder:editing`,!1),T=s(()=>{let e=S.block.items[0]?.id;return S.block.data.multiple?S.block.data.first_open&&e?[e]:[]:S.block.data.first_open?e:void 0});return(n,s)=>(c(),f(r(_),{key:`${x.block.data.multiple}-${r(w)}`,type:x.block.data.multiple?`multiple`:`single`,"default-value":T.value,collapsible:``,class:`divide-y rounded-lg border bg-card`},{default:u(()=>[(c(!0),a(l,null,o(x.block.items,(n,a)=>(c(),f(r(g),{key:n.id,value:n.id},{default:u(()=>[e(r(v),{as:`h3`},{default:u(()=>[e(r(h),{class:`group flex w-full items-center justify-between gap-4 px-5 py-4 text-left text-[15px] font-medium hover:bg-accent/60 focus-visible:outline-none focus-visible:ring-3 focus-visible:ring-ring/30`},{default:u(()=>[t(d(n.title||`Abschnitt ${a+1}`)+` `,1),e(r(m),{class:`size-4 shrink-0 text-muted-foreground transition-transform group-data-[state=open]:rotate-180`})]),_:2},1024)]),_:2},1024),e(r(y),{class:`overflow-hidden data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down`},{default:u(()=>[i(`div`,b,[(c(),f(p(r(C)),{item:n},null,8,[`item`]))])]),_:2},1024)]),_:2},1032,[`value`]))),128))]),_:1},8,[`type`,`default-value`]))}};export{x as default};
|
||||
import{D as e,E as t,J as n,On as r,_ as i,b as a,bt as o,g as s,mt as c,o as l,qt as u,tr as d,v as f,wt as p}from"./runtime-core.esm-bundler-B8D2lM98.js";import{Xt as m,at as h,ct as g,lt as _,ot as v,st as y}from"./app-Bpx12Pl3.js";var b={class:`px-5 pt-1 pb-5`},x={__name:`Accordion`,props:{block:{type:Object,required:!0}},setup(x){let S=x,C=n(`pagebuilder:list`),w=n(`pagebuilder:editing`,!1),T=s(()=>{let e=S.block.items[0]?.id;return S.block.data.multiple?S.block.data.first_open&&e?[e]:[]:S.block.data.first_open?e:void 0});return(n,s)=>(c(),f(r(_),{key:`${x.block.data.multiple}-${r(w)}`,type:x.block.data.multiple?`multiple`:`single`,"default-value":T.value,collapsible:``,class:`divide-y rounded-lg border bg-card`},{default:u(()=>[(c(!0),a(l,null,o(x.block.items,(n,a)=>(c(),f(r(g),{key:n.id,value:n.id},{default:u(()=>[e(r(v),{as:`h3`},{default:u(()=>[e(r(h),{class:`group flex w-full items-center justify-between gap-4 px-5 py-4 text-left text-[15px] font-medium hover:bg-accent/60 focus-visible:outline-none focus-visible:ring-3 focus-visible:ring-ring/30`},{default:u(()=>[t(d(n.title||`Abschnitt ${a+1}`)+` `,1),e(r(m),{class:`size-4 shrink-0 text-muted-foreground transition-transform group-data-[state=open]:rotate-180`})]),_:2},1024)]),_:2},1024),e(r(y),{class:`overflow-hidden data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down`},{default:u(()=>[i(`div`,b,[(c(),f(p(r(C)),{item:n},null,8,[`item`]))])]),_:2},1024)]),_:2},1032,[`value`]))),128))]),_:1},8,[`type`,`default-value`]))}};export{x as default};
|
||||
|
|
@ -1 +1 @@
|
|||
import{D as e,On as t,_ as n,b as r,bt as i,mt as a,o,qt as s,tr as c,v as l}from"./runtime-core.esm-bundler-B8D2lM98.js";import{i as u}from"./dist--2OKCVzt.js";import{t as d}from"./file-check-corner-J0TYMSsH.js";import{C as f}from"./app-tnmYSRAa.js";var p={class:`-mt-1 mb-3 text-[13px] text-muted-foreground`},m={class:`grid gap-1`},h={class:`min-w-0 truncate`},g={__name:`Acknowledgements`,props:{entries:{type:Array,required:!0},total:{type:Number,required:!0},url:{type:String,required:!0}},setup(g){return(_,v)=>(a(),l(f,{title:`Bitte lesen und bestätigen`,"action-label":g.total>g.entries.length?`Alle ${g.total}`:`QM`,"action-href":g.url},{default:s(()=>[n(`p`,p,c(g.total===1?`Ein QM-Dokument wartet`:`${g.total} QM-Dokumente warten`)+` auf Ihre Lesebestätigung. `,1),n(`ul`,m,[(a(!0),r(o,null,i(g.entries,i=>(a(),r(`li`,{key:i.id},[e(t(u),{href:i.url,class:`flex items-center gap-2.5 rounded-md px-2 py-1.5 text-sm hover:bg-accent`},{default:s(()=>[e(t(d),{class:`size-4 shrink-0 text-amber-600 dark:text-amber-400`}),n(`span`,h,c(i.title),1)]),_:2},1032,[`href`])]))),128))])]),_:1},8,[`action-label`,`action-href`]))}};export{g as default};
|
||||
import{D as e,On as t,_ as n,b as r,bt as i,mt as a,o,qt as s,tr as c,v as l}from"./runtime-core.esm-bundler-B8D2lM98.js";import{i as u}from"./dist--2OKCVzt.js";import{t as d}from"./file-check-corner-J0TYMSsH.js";import{C as f}from"./app-Bpx12Pl3.js";var p={class:`-mt-1 mb-3 text-[13px] text-muted-foreground`},m={class:`grid gap-1`},h={class:`min-w-0 truncate`},g={__name:`Acknowledgements`,props:{entries:{type:Array,required:!0},total:{type:Number,required:!0},url:{type:String,required:!0}},setup(g){return(_,v)=>(a(),l(f,{title:`Bitte lesen und bestätigen`,"action-label":g.total>g.entries.length?`Alle ${g.total}`:`QM`,"action-href":g.url},{default:s(()=>[n(`p`,p,c(g.total===1?`Ein QM-Dokument wartet`:`${g.total} QM-Dokumente warten`)+` auf Ihre Lesebestätigung. `,1),n(`ul`,m,[(a(!0),r(o,null,i(g.entries,i=>(a(),r(`li`,{key:i.id},[e(t(u),{href:i.url,class:`flex items-center gap-2.5 rounded-md px-2 py-1.5 text-sm hover:bg-accent`},{default:s(()=>[e(t(d),{class:`size-4 shrink-0 text-amber-600 dark:text-amber-400`}),n(`span`,h,c(i.title),1)]),_:2},1032,[`href`])]))),128))])]),_:1},8,[`action-label`,`action-href`]))}};export{g as default};
|
||||
|
|
@ -1 +1 @@
|
|||
import{D as e,E as t,Ht as n,On as r,Yt as i,_ as a,b as o,bt as s,gn as c,mt as l,o as u,qt as d,tr as f,v as p,y as m}from"./runtime-core.esm-bundler-B8D2lM98.js";import{w as h,x as g}from"./runtime-dom.esm-bundler-BEWGoe8n.js";import{i as _,o as v,s as y}from"./dist--2OKCVzt.js";import{t as b}from"./download-K4OGj5k2.js";import{n as x}from"./lib-Be7KNAML.js";import{F as S,O as C,S as w,T,dt as E,kt as D,p as O,w as k,y as A}from"./app-tnmYSRAa.js";var j={key:0,class:`grid gap-4`},M={class:`flex flex-wrap items-start gap-4`},N={class:`min-w-0 flex-1`},P={class:`text-[13px] text-muted-foreground`},F={class:`text-xs text-muted-foreground`},I={class:`flex flex-wrap gap-2`},L=[`href`],R=[`href`],z={key:0,class:`mt-4 rounded-md bg-muted/60 px-4 py-3 text-sm leading-relaxed break-words whitespace-pre-line`},B=[`onSubmit`],V={class:`grid gap-1 text-[13px] font-medium`},H={class:`grid gap-1 text-[13px] font-medium`},U=[`onUpdate:modelValue`],W={key:1,class:`rounded-lg border border-dashed bg-card`},G={__name:`Applications`,props:{posting:{type:Object,required:!0},applications:{type:Array,required:!0},statuses:{type:Array,required:!0}},setup(G){let K=G,q=v();n(()=>q.props.flash.status,e=>e&&x.success(e));let J=c(Object.fromEntries(K.applications.map(e=>[e.id,{status:e.status,note:e.note??``}])));function Y(e){y.put(`/redaktion/stellen/bewerbungen/${e.id}`,J[e.id],{preserveScroll:!0})}return(n,c)=>(l(),p(T,{title:`Bewerbungen: ${G.posting.title}`},{default:d(()=>[e(k,{title:`Bewerbungen (${G.applications.length})`,description:G.posting.title,breadcrumbs:[{label:`Stellen`,href:`/stellen`},{label:G.posting.title,href:G.posting.url}]},null,8,[`title`,`description`,`breadcrumbs`]),G.applications.length?(l(),o(`ul`,j,[(l(!0),o(u,null,s(G.applications,n=>(l(),o(`li`,{key:n.id,class:`rounded-lg border bg-card p-5`},[a(`div`,M,[e(C,{person:n.person,class:`size-11`},null,8,[`person`]),a(`div`,N,[e(r(_),{href:`/personen/${n.person.id}`,class:`font-semibold hover:underline`},{default:d(()=>[t(f(n.person.name),1)]),_:2},1032,[`href`]),a(`p`,P,f([n.person.job_title,n.person.department].filter(Boolean).join(` · `)||`–`),1),a(`p`,F,`Eingegangen am `+f(r(S)(n.created_at)),1)]),a(`div`,I,[n.file?(l(),p(r(O),{key:0,variant:`outline`,size:`sm`,"as-child":``},{default:d(()=>[a(`a`,{href:n.file.url},[e(r(b)),t(` `+f(n.file.name),1)],8,L)]),_:2},1024)):m(``,!0),e(r(O),{variant:`outline`,size:`sm`,"as-child":``},{default:d(()=>[a(`a`,{href:`mailto:${n.person.email}`},[e(r(D)),c[0]||=t(` E-Mail`,-1)],8,R)]),_:2},1024)])]),n.message?(l(),o(`p`,z,f(n.message),1)):m(``,!0),a(`form`,{class:`mt-4 grid gap-3 border-t pt-4 sm:grid-cols-[12rem_minmax(0,1fr)_auto] sm:items-end`,onSubmit:h(e=>Y(n),[`prevent`])},[a(`label`,V,[c[1]||=t(`Stand `,-1),e(A,{modelValue:J[n.id].status,"onUpdate:modelValue":e=>J[n.id].status=e,options:G.statuses},null,8,[`modelValue`,`onUpdate:modelValue`,`options`])]),a(`label`,H,[c[2]||=t(`Interne Notiz `,-1),i(a(`input`,{"onUpdate:modelValue":e=>J[n.id].note=e,maxlength:`5000`,placeholder:`nur für die Bearbeitung sichtbar`,class:`h-9 rounded-md border border-input bg-card px-3 text-sm font-normal focus-visible:outline-none focus-visible:ring-3 focus-visible:ring-ring/30`},null,8,U),[[g,J[n.id].note]])]),e(r(O),{type:`submit`,size:`sm`,class:`h-9`},{default:d(()=>[...c[3]||=[t(`Speichern`,-1)]]),_:1})],40,B)]))),128))])):(l(),o(`div`,W,[e(w,{icon:r(E),title:`Noch keine Bewerbungen`},null,8,[`icon`])]))]),_:1},8,[`title`]))}};export{G as default};
|
||||
import{D as e,E as t,Ht as n,On as r,Yt as i,_ as a,b as o,bt as s,gn as c,mt as l,o as u,qt as d,tr as f,v as p,y as m}from"./runtime-core.esm-bundler-B8D2lM98.js";import{w as h,x as g}from"./runtime-dom.esm-bundler-BEWGoe8n.js";import{i as _,o as v,s as y}from"./dist--2OKCVzt.js";import{t as b}from"./download-K4OGj5k2.js";import{n as x}from"./lib-Be7KNAML.js";import{F as S,O as C,S as w,T,dt as E,kt as D,p as O,w as k,y as A}from"./app-Bpx12Pl3.js";var j={key:0,class:`grid gap-4`},M={class:`flex flex-wrap items-start gap-4`},N={class:`min-w-0 flex-1`},P={class:`text-[13px] text-muted-foreground`},F={class:`text-xs text-muted-foreground`},I={class:`flex flex-wrap gap-2`},L=[`href`],R=[`href`],z={key:0,class:`mt-4 rounded-md bg-muted/60 px-4 py-3 text-sm leading-relaxed break-words whitespace-pre-line`},B=[`onSubmit`],V={class:`grid gap-1 text-[13px] font-medium`},H={class:`grid gap-1 text-[13px] font-medium`},U=[`onUpdate:modelValue`],W={key:1,class:`rounded-lg border border-dashed bg-card`},G={__name:`Applications`,props:{posting:{type:Object,required:!0},applications:{type:Array,required:!0},statuses:{type:Array,required:!0}},setup(G){let K=G,q=v();n(()=>q.props.flash.status,e=>e&&x.success(e));let J=c(Object.fromEntries(K.applications.map(e=>[e.id,{status:e.status,note:e.note??``}])));function Y(e){y.put(`/redaktion/stellen/bewerbungen/${e.id}`,J[e.id],{preserveScroll:!0})}return(n,c)=>(l(),p(T,{title:`Bewerbungen: ${G.posting.title}`},{default:d(()=>[e(k,{title:`Bewerbungen (${G.applications.length})`,description:G.posting.title,breadcrumbs:[{label:`Stellen`,href:`/stellen`},{label:G.posting.title,href:G.posting.url}]},null,8,[`title`,`description`,`breadcrumbs`]),G.applications.length?(l(),o(`ul`,j,[(l(!0),o(u,null,s(G.applications,n=>(l(),o(`li`,{key:n.id,class:`rounded-lg border bg-card p-5`},[a(`div`,M,[e(C,{person:n.person,class:`size-11`},null,8,[`person`]),a(`div`,N,[e(r(_),{href:`/personen/${n.person.id}`,class:`font-semibold hover:underline`},{default:d(()=>[t(f(n.person.name),1)]),_:2},1032,[`href`]),a(`p`,P,f([n.person.job_title,n.person.department].filter(Boolean).join(` · `)||`–`),1),a(`p`,F,`Eingegangen am `+f(r(S)(n.created_at)),1)]),a(`div`,I,[n.file?(l(),p(r(O),{key:0,variant:`outline`,size:`sm`,"as-child":``},{default:d(()=>[a(`a`,{href:n.file.url},[e(r(b)),t(` `+f(n.file.name),1)],8,L)]),_:2},1024)):m(``,!0),e(r(O),{variant:`outline`,size:`sm`,"as-child":``},{default:d(()=>[a(`a`,{href:`mailto:${n.person.email}`},[e(r(D)),c[0]||=t(` E-Mail`,-1)],8,R)]),_:2},1024)])]),n.message?(l(),o(`p`,z,f(n.message),1)):m(``,!0),a(`form`,{class:`mt-4 grid gap-3 border-t pt-4 sm:grid-cols-[12rem_minmax(0,1fr)_auto] sm:items-end`,onSubmit:h(e=>Y(n),[`prevent`])},[a(`label`,V,[c[1]||=t(`Stand `,-1),e(A,{modelValue:J[n.id].status,"onUpdate:modelValue":e=>J[n.id].status=e,options:G.statuses},null,8,[`modelValue`,`onUpdate:modelValue`,`options`])]),a(`label`,H,[c[2]||=t(`Interne Notiz `,-1),i(a(`input`,{"onUpdate:modelValue":e=>J[n.id].note=e,maxlength:`5000`,placeholder:`nur für die Bearbeitung sichtbar`,class:`h-9 rounded-md border border-input bg-card px-3 text-sm font-normal focus-visible:outline-none focus-visible:ring-3 focus-visible:ring-ring/30`},null,8,U),[[g,J[n.id].note]])]),e(r(O),{type:`submit`,size:`sm`,class:`h-9`},{default:d(()=>[...c[3]||=[t(`Speichern`,-1)]]),_:1})],40,B)]))),128))])):(l(),o(`div`,W,[e(w,{icon:r(E),title:`Noch keine Bewerbungen`},null,8,[`icon`])]))]),_:1},8,[`title`]))}};export{G as default};
|
||||
|
|
@ -1 +1 @@
|
|||
import{_ as e,b as t,bt as n,mt as r,o as i,qt as a,v as o}from"./runtime-core.esm-bundler-B8D2lM98.js";import{C as s}from"./app-tnmYSRAa.js";import{t as c}from"./NewsCard-DMMRKyKb.js";var l={class:`-mx-5 flex snap-x scroll-px-5 gap-4 overflow-x-auto px-5 pb-1 [scrollbar-width:none] sm:mx-0 sm:grid sm:grid-cols-2 sm:overflow-visible sm:px-0 sm:pb-0 xl:grid-cols-4 [&::-webkit-scrollbar]:hidden`},u={__name:`Areas`,props:{posts:{type:Array,required:!0}},setup(u){return(d,f)=>(r(),o(s,{title:`Aktuelles aus den Bereichen`,"action-label":`Alle`,"action-href":`/neuigkeiten`},{default:a(()=>[e(`div`,l,[(r(!0),t(i,null,n(u.posts,e=>(r(),o(c,{key:e.id,post:e,class:`w-[78%] shrink-0 snap-start sm:w-auto`},null,8,[`post`]))),128))])]),_:1}))}};export{u as default};
|
||||
import{_ as e,b as t,bt as n,mt as r,o as i,qt as a,v as o}from"./runtime-core.esm-bundler-B8D2lM98.js";import{C as s}from"./app-Bpx12Pl3.js";import{t as c}from"./NewsCard-B1GgXpot.js";var l={class:`-mx-5 flex snap-x scroll-px-5 gap-4 overflow-x-auto px-5 pb-1 [scrollbar-width:none] sm:mx-0 sm:grid sm:grid-cols-2 sm:overflow-visible sm:px-0 sm:pb-0 xl:grid-cols-4 [&::-webkit-scrollbar]:hidden`},u={__name:`Areas`,props:{posts:{type:Array,required:!0}},setup(u){return(d,f)=>(r(),o(s,{title:`Aktuelles aus den Bereichen`,"action-label":`Alle`,"action-href":`/neuigkeiten`},{default:a(()=>[e(`div`,l,[(r(!0),t(i,null,n(u.posts,e=>(r(),o(c,{key:e.id,post:e,class:`w-[78%] shrink-0 snap-start sm:w-auto`},null,8,[`post`]))),128))])]),_:1}))}};export{u as default};
|
||||
|
|
@ -1 +1 @@
|
|||
import{D as e,On as t,Zn as n,_ as r,b as i,mt as a,qt as o,tr as s,v as c,y as l}from"./runtime-core.esm-bundler-B8D2lM98.js";import{i as u}from"./dist--2OKCVzt.js";import{$t as d,O as f}from"./app-tnmYSRAa.js";var p={class:`relative shrink-0`},m={key:0,class:`absolute -right-1 -bottom-1 grid size-5 place-items-center rounded-full bg-brand text-brand-foreground ring-2 ring-card`},h={class:`min-w-0 flex-1`},g={class:`block truncate text-sm font-medium group-hover:underline`},_={class:`block truncate text-xs text-muted-foreground`},v={__name:`BirthdayItem`,props:{item:{type:Object,required:!0}},setup(v){let y=e=>new Intl.DateTimeFormat(`de-DE`,{day:`numeric`,month:`long`}).format(new Date(`${e}T12:00:00`)),b=e=>new Intl.DateTimeFormat(`de-DE`,{weekday:`short`}).format(new Date(`${e}T12:00:00`));return(x,S)=>(a(),c(t(u),{href:`/personen/${v.item.person.id}`,class:`group flex items-center gap-3 py-2.5`},{default:o(()=>[r(`span`,p,[e(f,{person:v.item.person,class:`size-10`},null,8,[`person`]),v.item.today?(a(),i(`span`,m,[e(t(d),{class:`size-3`})])):l(``,!0)]),r(`span`,h,[r(`span`,g,s(v.item.person.name),1),r(`span`,_,s(v.item.person.job_title||v.item.person.department),1)]),r(`span`,{class:n([`shrink-0 text-right text-xs`,v.item.today?`font-semibold text-brand-text`:`text-muted-foreground`])},s(v.item.today?`Heute`:`${b(v.item.date)}, ${y(v.item.date)}`),3)]),_:1},8,[`href`]))}};export{v as t};
|
||||
import{D as e,On as t,Zn as n,_ as r,b as i,mt as a,qt as o,tr as s,v as c,y as l}from"./runtime-core.esm-bundler-B8D2lM98.js";import{i as u}from"./dist--2OKCVzt.js";import{$t as d,O as f}from"./app-Bpx12Pl3.js";var p={class:`relative shrink-0`},m={key:0,class:`absolute -right-1 -bottom-1 grid size-5 place-items-center rounded-full bg-brand text-brand-foreground ring-2 ring-card`},h={class:`min-w-0 flex-1`},g={class:`block truncate text-sm font-medium group-hover:underline`},_={class:`block truncate text-xs text-muted-foreground`},v={__name:`BirthdayItem`,props:{item:{type:Object,required:!0}},setup(v){let y=e=>new Intl.DateTimeFormat(`de-DE`,{day:`numeric`,month:`long`}).format(new Date(`${e}T12:00:00`)),b=e=>new Intl.DateTimeFormat(`de-DE`,{weekday:`short`}).format(new Date(`${e}T12:00:00`));return(x,S)=>(a(),c(t(u),{href:`/personen/${v.item.person.id}`,class:`group flex items-center gap-3 py-2.5`},{default:o(()=>[r(`span`,p,[e(f,{person:v.item.person,class:`size-10`},null,8,[`person`]),v.item.today?(a(),i(`span`,m,[e(t(d),{class:`size-3`})])):l(``,!0)]),r(`span`,h,[r(`span`,g,s(v.item.person.name),1),r(`span`,_,s(v.item.person.job_title||v.item.person.department),1)]),r(`span`,{class:n([`shrink-0 text-right text-xs`,v.item.today?`font-semibold text-brand-text`:`text-muted-foreground`])},s(v.item.today?`Heute`:`${b(v.item.date)}, ${y(v.item.date)}`),3)]),_:1},8,[`href`]))}};export{v as t};
|
||||
|
|
@ -1 +1 @@
|
|||
import{_ as e,b as t,bt as n,mt as r,o as i,tr as a,v as o,y as s}from"./runtime-core.esm-bundler-B8D2lM98.js";import{t as c}from"./BirthdayItem-DRpMlMQf.js";var l={key:0,class:`mb-3 text-lg font-semibold`},u={class:`divide-y rounded-lg border bg-card px-4`},d={key:0,class:`py-3 text-sm text-muted-foreground`},f={__name:`BirthdaysBlock`,props:{block:{type:Object,required:!0}},setup(f){return(p,m)=>(r(),t(`section`,null,[f.block.data.title?(r(),t(`h3`,l,a(f.block.data.title),1)):s(``,!0),e(`div`,u,[(r(!0),t(i,null,n(f.block.props?.birthdays??[],e=>(r(),o(c,{key:`${e.person.id}-${e.date}`,item:e},null,8,[`item`]))),128)),(f.block.props?.birthdays??[]).length?s(``,!0):(r(),t(`p`,d,`Keine anstehenden Geburtstage.`))])]))}};export{f as default};
|
||||
import{_ as e,b as t,bt as n,mt as r,o as i,tr as a,v as o,y as s}from"./runtime-core.esm-bundler-B8D2lM98.js";import{t as c}from"./BirthdayItem-CwJz1wh2.js";var l={key:0,class:`mb-3 text-lg font-semibold`},u={class:`divide-y rounded-lg border bg-card px-4`},d={key:0,class:`py-3 text-sm text-muted-foreground`},f={__name:`BirthdaysBlock`,props:{block:{type:Object,required:!0}},setup(f){return(p,m)=>(r(),t(`section`,null,[f.block.data.title?(r(),t(`h3`,l,a(f.block.data.title),1)):s(``,!0),e(`div`,u,[(r(!0),t(i,null,n(f.block.props?.birthdays??[],e=>(r(),o(c,{key:`${e.person.id}-${e.date}`,item:e},null,8,[`item`]))),128)),(f.block.props?.birthdays??[]).length?s(``,!0):(r(),t(`p`,d,`Keine anstehenden Geburtstage.`))])]))}};export{f as default};
|
||||
|
|
@ -1 +1 @@
|
|||
import{J as e,On as t,b as n,bt as r,mt as i,o as a,v as o,wt as s,y as c}from"./runtime-core.esm-bundler-B8D2lM98.js";import{t as l}from"./registry-B8rTIqUa.js";var u={class:`grid gap-6`},d={__name:`BlockList`,props:{item:{type:Object,required:!0}},setup(d){let f=e(`pagebuilder:types`,{});return(e,p)=>(i(),n(`div`,u,[(i(!0),n(a,null,r(d.item.blocks,e=>(i(),n(a,{key:e.id},[t(l)(t(f)[e.type]?.component??e.component??``)?(i(),o(s(t(l)(t(f)[e.type]?.component??e.component??``)),{key:0,block:e},null,8,[`block`])):c(``,!0)],64))),128))]))}};export{d as t};
|
||||
import{J as e,On as t,b as n,bt as r,mt as i,o as a,v as o,wt as s,y as c}from"./runtime-core.esm-bundler-B8D2lM98.js";import{t as l}from"./registry-EFHV8NHe.js";var u={class:`grid gap-6`},d={__name:`BlockList`,props:{item:{type:Object,required:!0}},setup(d){let f=e(`pagebuilder:types`,{});return(e,p)=>(i(),n(`div`,u,[(i(!0),n(a,null,r(d.item.blocks,e=>(i(),n(a,{key:e.id},[t(l)(t(f)[e.type]?.component??e.component??``)?(i(),o(s(t(l)(t(f)[e.type]?.component??e.component??``)),{key:0,block:e},null,8,[`block`])):c(``,!0)],64))),128))]))}};export{d as t};
|
||||
|
|
@ -1 +1 @@
|
|||
import{J as e,On as t,Zn as n,_ as r,b as i,mt as a,tr as o,v as s,wt as c,y as l}from"./runtime-core.esm-bundler-B8D2lM98.js";import{t as u}from"./circle-alert-AqOvEy07.js";import{t as d}from"./circle-check-K9QH5jex.js";import{t as f}from"./info-ByKJSon9.js";import{t as p}from"./triangle-alert-DyO_Fk2w.js";import{Nt as m,ht as h}from"./app-tnmYSRAa.js";var g=[`role`],_={class:`min-w-0 flex-1`},v={key:0,class:`mb-2 font-semibold`},y={__name:`Box`,props:{block:{type:Object,required:!0}},setup(y){let b=e(`pagebuilder:list`),x={info:{icon:f,class:`border-sky-200 bg-sky-50 text-sky-950 dark:border-sky-900 dark:bg-sky-950/40 dark:text-sky-100`,iconClass:`text-sky-600 dark:text-sky-400`},note:{icon:m,class:`border-amber-200 bg-amber-50 text-amber-950 dark:border-amber-900 dark:bg-amber-950/40 dark:text-amber-100`,iconClass:`text-amber-600 dark:text-amber-400`},warning:{icon:p,class:`border-red-200 bg-red-50 text-red-950 dark:border-red-900 dark:bg-red-950/40 dark:text-red-100`,iconClass:`text-red-600 dark:text-red-400`},success:{icon:d,class:`border-emerald-200 bg-emerald-50 text-emerald-950 dark:border-emerald-900 dark:bg-emerald-950/40 dark:text-emerald-100`,iconClass:`text-emerald-600 dark:text-emerald-400`},neutral:{icon:u,class:`border-border bg-muted text-foreground`,iconClass:`text-muted-foreground`},highlight:{icon:h,class:`border-brand-200 bg-brand-soft text-foreground`,iconClass:`text-brand-text`}};return(e,u)=>(a(),i(`aside`,{class:n([`pb-box flex gap-3 rounded-lg border p-4 @xl:p-5`,x[y.block.data.variant]?.class]),role:y.block.data.variant===`warning`?`alert`:`note`},[y.block.data.show_icon?(a(),s(c(x[y.block.data.variant]?.icon),{key:0,class:n([`mt-0.5 size-5 shrink-0`,x[y.block.data.variant]?.iconClass])},null,8,[`class`])):l(``,!0),r(`div`,_,[y.block.data.title?(a(),i(`p`,v,o(y.block.data.title),1)):l(``,!0),(a(),s(c(t(b)),{item:y.block.items[0]},null,8,[`item`]))])],10,g))}};export{y as default};
|
||||
import{J as e,On as t,Zn as n,_ as r,b as i,mt as a,tr as o,v as s,wt as c,y as l}from"./runtime-core.esm-bundler-B8D2lM98.js";import{t as u}from"./circle-alert-AqOvEy07.js";import{t as d}from"./circle-check-K9QH5jex.js";import{t as f}from"./info-ByKJSon9.js";import{t as p}from"./triangle-alert-DyO_Fk2w.js";import{Nt as m,ht as h}from"./app-Bpx12Pl3.js";var g=[`role`],_={class:`min-w-0 flex-1`},v={key:0,class:`mb-2 font-semibold`},y={__name:`Box`,props:{block:{type:Object,required:!0}},setup(y){let b=e(`pagebuilder:list`),x={info:{icon:f,class:`border-sky-200 bg-sky-50 text-sky-950 dark:border-sky-900 dark:bg-sky-950/40 dark:text-sky-100`,iconClass:`text-sky-600 dark:text-sky-400`},note:{icon:m,class:`border-amber-200 bg-amber-50 text-amber-950 dark:border-amber-900 dark:bg-amber-950/40 dark:text-amber-100`,iconClass:`text-amber-600 dark:text-amber-400`},warning:{icon:p,class:`border-red-200 bg-red-50 text-red-950 dark:border-red-900 dark:bg-red-950/40 dark:text-red-100`,iconClass:`text-red-600 dark:text-red-400`},success:{icon:d,class:`border-emerald-200 bg-emerald-50 text-emerald-950 dark:border-emerald-900 dark:bg-emerald-950/40 dark:text-emerald-100`,iconClass:`text-emerald-600 dark:text-emerald-400`},neutral:{icon:u,class:`border-border bg-muted text-foreground`,iconClass:`text-muted-foreground`},highlight:{icon:h,class:`border-brand-200 bg-brand-soft text-foreground`,iconClass:`text-brand-text`}};return(e,u)=>(a(),i(`aside`,{class:n([`pb-box flex gap-3 rounded-lg border p-4 @xl:p-5`,x[y.block.data.variant]?.class]),role:y.block.data.variant===`warning`?`alert`:`note`},[y.block.data.show_icon?(a(),s(c(x[y.block.data.variant]?.icon),{key:0,class:n([`mt-0.5 size-5 shrink-0`,x[y.block.data.variant]?.iconClass])},null,8,[`class`])):l(``,!0),r(`div`,_,[y.block.data.title?(a(),i(`p`,v,o(y.block.data.title),1)):l(``,!0),(a(),s(c(t(b)),{item:y.block.items[0]},null,8,[`item`]))])],10,g))}};export{y as default};
|
||||
File diff suppressed because one or more lines are too long
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue