Protect recordings per user, seed a demo login on container start, and bind-mount the app with Vite HMR for local Compose development.
58 lines
1.2 KiB
PHP
58 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace App\Policies;
|
|
|
|
use App\Models\Recording;
|
|
use App\Models\User;
|
|
|
|
class RecordingPolicy
|
|
{
|
|
/**
|
|
* Determine whether the user can view any models.
|
|
*/
|
|
public function viewAny(User $user): bool
|
|
{
|
|
return true;
|
|
}
|
|
|
|
/**
|
|
* Determine whether the user can view the model.
|
|
*/
|
|
public function view(User $user, Recording $recording): bool
|
|
{
|
|
return $recording->user_id === $user->id;
|
|
}
|
|
|
|
/**
|
|
* Determine whether the user can create models.
|
|
*/
|
|
public function create(User $user): bool
|
|
{
|
|
return true;
|
|
}
|
|
|
|
/**
|
|
* Determine whether the user can update the model.
|
|
*/
|
|
public function update(User $user, Recording $recording): bool
|
|
{
|
|
return $recording->user_id === $user->id;
|
|
}
|
|
|
|
/**
|
|
* Determine whether the user can delete the model.
|
|
*/
|
|
public function delete(User $user, Recording $recording): bool
|
|
{
|
|
return $recording->user_id === $user->id;
|
|
}
|
|
|
|
/**
|
|
* Determine whether the user can start or stop transcription.
|
|
*/
|
|
public function transcribe(User $user, Recording $recording): bool
|
|
{
|
|
return $recording->user_id === $user->id;
|
|
}
|
|
}
|