HifiPlanet-Website/hifi/api/src/Support/Permissions.php
Maaxxs e234a2435d Add photo gallery feature (brand -> project -> photos drill-down)
Mirrors the old site's Bildergalerie structure: a brand tile grid at
/galerie, project tiles within a brand, and a photo grid with a
lightbox for each project. Backed by new gallery_brands/gallery_projects/
gallery_photos tables and admin CRUD pages, gated by a new gallery.manage
permission.

Also fixes a real bug found while testing photo uploads: Apache's
mod_dir was redirecting POST /api/uploads to /api/uploads/ (a trailing
slash) because api/uploads/ exists as a real directory, silently
dropping the multipart body on every image upload across the whole
app. Fixed via DirectorySlash Off in .htaccess.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-06 17:04:46 +02:00

31 lines
1.1 KiB
PHP

<?php
namespace App\Support;
class Permissions
{
public const CATALOG = [
'brands.manage' => 'Marken verwalten',
'models.manage' => 'Modelle verwalten',
'packages.manage' => 'Pakete, Produkte & Upgrades verwalten',
'services.manage' => 'Leistungen verwalten',
'gallery.manage' => 'Bildergalerie verwalten',
'contact.manage' => 'Kontaktanfragen ansehen & bearbeiten',
'contact.delete' => 'Kontaktanfragen löschen',
'users.manage' => 'Benutzer verwalten',
'permission_groups.manage' => 'Berechtigungsgruppen verwalten',
'settings.manage' => 'Systemeinstellungen (Export/Import/Zurücksetzen) verwalten',
'maintenance.bypass' => 'Wartungsmodus umgehen (Inhalte trotzdem sehen)',
];
public static function isValid(string $permission): bool
{
return isset(self::CATALOG[$permission]);
}
/** @return string[] */
public static function sanitizeList(array $permissions): array
{
return array_values(array_intersect(array_unique($permissions), array_keys(self::CATALOG)));
}
}