mirror of
https://github.com/pelican-dev/panel.git
synced 2025-05-20 09:54:44 +02:00
Make sure roles always use web
guard name (#690)
This commit is contained in:
parent
3f9c1dbc3c
commit
7a447b04d5
@ -6,7 +6,6 @@ use App\Enums\RolePermissionModels;
|
|||||||
use App\Enums\RolePermissionPrefixes;
|
use App\Enums\RolePermissionPrefixes;
|
||||||
use App\Filament\Resources\RoleResource\Pages;
|
use App\Filament\Resources\RoleResource\Pages;
|
||||||
use App\Models\Role;
|
use App\Models\Role;
|
||||||
use Filament\Facades\Filament;
|
|
||||||
use Filament\Forms\Components\Actions\Action;
|
use Filament\Forms\Components\Actions\Action;
|
||||||
use Filament\Forms\Components\CheckboxList;
|
use Filament\Forms\Components\CheckboxList;
|
||||||
use Filament\Forms\Components\Component;
|
use Filament\Forms\Components\Component;
|
||||||
@ -71,7 +70,7 @@ class RoleResource extends Resource
|
|||||||
->disabled(fn (Get $get) => $get('name') === Role::ROOT_ADMIN),
|
->disabled(fn (Get $get) => $get('name') === Role::ROOT_ADMIN),
|
||||||
TextInput::make('guard_name')
|
TextInput::make('guard_name')
|
||||||
->label('Guard Name')
|
->label('Guard Name')
|
||||||
->default(Filament::getCurrentPanel()?->getAuthGuard() ?? '')
|
->default(Role::DEFAULT_GUARD_NAME)
|
||||||
->nullable()
|
->nullable()
|
||||||
->hidden(),
|
->hidden(),
|
||||||
Fieldset::make('Permissions')
|
Fieldset::make('Permissions')
|
||||||
|
@ -19,6 +19,8 @@ class Role extends BaseRole
|
|||||||
|
|
||||||
public const ROOT_ADMIN = 'Root Admin';
|
public const ROOT_ADMIN = 'Root Admin';
|
||||||
|
|
||||||
|
public const DEFAULT_GUARD_NAME = 'web';
|
||||||
|
|
||||||
public const MODEL_SPECIFIC_PERMISSIONS = [
|
public const MODEL_SPECIFIC_PERMISSIONS = [
|
||||||
'egg' => [
|
'egg' => [
|
||||||
'import',
|
'import',
|
||||||
@ -41,7 +43,7 @@ class Role extends BaseRole
|
|||||||
public static function getRootAdmin(): self
|
public static function getRootAdmin(): self
|
||||||
{
|
{
|
||||||
/** @var self $role */
|
/** @var self $role */
|
||||||
$role = self::findOrCreate(self::ROOT_ADMIN);
|
$role = self::findOrCreate(self::ROOT_ADMIN, self::DEFAULT_GUARD_NAME);
|
||||||
|
|
||||||
return $role;
|
return $role;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user