Seebad 0.3 stays in this release. With a single landlord every host still reaches the default website. Co-authored-by: Cursor <cursoragent@cursor.com>
60 lines
1.6 KiB
PHP
60 lines
1.6 KiB
PHP
<?php
|
|
|
|
namespace App\Enums;
|
|
|
|
use Filament\Support\Contracts\HasDescription;
|
|
use Filament\Support\Contracts\HasLabel;
|
|
|
|
enum UserRole: string implements HasDescription, HasLabel
|
|
{
|
|
case Admin = 'admin';
|
|
case Rentals = 'rentals';
|
|
case Content = 'content';
|
|
|
|
public function getLabel(): string
|
|
{
|
|
return match ($this) {
|
|
self::Admin => 'Mandanten-Administrator',
|
|
self::Rentals => 'Vermietung',
|
|
self::Content => 'Inhalte',
|
|
};
|
|
}
|
|
|
|
public function getDescription(): string
|
|
{
|
|
return match ($this) {
|
|
self::Admin => 'Alles im eigenen Mandanten, inklusive Benutzerverwaltung',
|
|
self::Rentals => 'Buchungen, Gäste, Preise, Angebote und Bewertungen',
|
|
self::Content => 'Bilder, Texte, FAQ, Hinweise und Bewertungen',
|
|
};
|
|
}
|
|
|
|
public function grants(Permission $permission): bool
|
|
{
|
|
return in_array($permission, $this->permissions(), true);
|
|
}
|
|
|
|
/**
|
|
* Abilities inside the current landlord. The operator is not a role here.
|
|
*
|
|
* @return list<Permission>
|
|
*/
|
|
public function permissions(): array
|
|
{
|
|
return match ($this) {
|
|
self::Admin => Permission::cases(),
|
|
self::Rentals => [
|
|
Permission::Bookings,
|
|
Permission::Properties,
|
|
Permission::Guests,
|
|
Permission::Reviews,
|
|
Permission::Channels,
|
|
],
|
|
self::Content => [
|
|
Permission::Content,
|
|
Permission::Reviews,
|
|
],
|
|
};
|
|
}
|
|
}
|