mirror of
https://github.com/jez500/pricebuddy.git
synced 2026-11-24 19:58:13 +01:00
feat: add Role enum (Admin/User) feat: add role column to users, backfill existing to admin feat: cast user role to enum and add isAdmin helper feat: user factory defaults to User role with admin() state feat: add UserPolicy (admin manages all, users manage self) feat: restrict AppSettingsPage to admins feat: admin-only role select on user form with role-based resource access test: prove non-admins cannot escalate role; guard global search Add canGloballySearch() to UserResource so the user list is never surfaced in Filament global search for non-admins (defense-in-depth alongside the broad canAccess() needed for self-edit). Commit the adversarial escalation regression tests that prove both fillForm and raw data.role injection cannot persist a role change for a non-admin. feat: seed test@test.com as admin, another@test.com as user
32 lines
692 B
PHP
32 lines
692 B
PHP
<?php
|
|
|
|
namespace Database\Seeders;
|
|
|
|
use App\Enums\Role;
|
|
use App\Models\User;
|
|
use Illuminate\Database\Seeder;
|
|
use Illuminate\Support\Facades\Hash;
|
|
|
|
class UserSeeder extends Seeder
|
|
{
|
|
/**
|
|
* Run the database seeds.
|
|
*/
|
|
public function run(): void
|
|
{
|
|
User::factory()->create([
|
|
'name' => 'Test User',
|
|
'email' => 'test@test.com',
|
|
'password' => Hash::make('password'),
|
|
'role' => Role::Admin,
|
|
]);
|
|
|
|
User::factory()->create([
|
|
'name' => 'Another User',
|
|
'email' => 'another@test.com',
|
|
'password' => Hash::make('password'),
|
|
'role' => Role::User,
|
|
]);
|
|
}
|
|
}
|