82 lines
2.5 KiB
PHP
82 lines
2.5 KiB
PHP
<?php
|
|
|
|
namespace App\Policies;
|
|
|
|
use App\Models\VarietyVariation;
|
|
use App\Models\User;
|
|
|
|
class VarietyVariationPolicy
|
|
{
|
|
/**
|
|
* Determine whether the user can view any variety variations.
|
|
*/
|
|
public function viewAny(User $user): bool
|
|
{
|
|
// All authenticated users can view variety variations
|
|
return true;
|
|
}
|
|
|
|
/**
|
|
* Determine whether the user can view the variety variation.
|
|
*/
|
|
public function view(User $user, VarietyVariation $varietyVariation): bool
|
|
{
|
|
// All authenticated users can view individual variety variations
|
|
return true;
|
|
}
|
|
|
|
/**
|
|
* Determine whether the user can create variety variations.
|
|
*/
|
|
public function create(User $user): bool
|
|
{
|
|
// TODO: Implement role-based authorization
|
|
// Only administrators and winemakers should be able to create variety variations
|
|
// Example: return $user->hasRole(['admin', 'winemaker']);
|
|
return true;
|
|
}
|
|
|
|
/**
|
|
* Determine whether the user can update the variety variation.
|
|
*/
|
|
public function update(User $user, VarietyVariation $varietyVariation): bool
|
|
{
|
|
// TODO: Implement role-based authorization
|
|
// Only administrators and winemakers should be able to update variety variations
|
|
// Example: return $user->hasRole(['admin', 'winemaker']);
|
|
return true;
|
|
}
|
|
|
|
/**
|
|
* Determine whether the user can delete the variety variation.
|
|
*/
|
|
public function delete(User $user, VarietyVariation $varietyVariation): bool
|
|
{
|
|
// TODO: Implement role-based authorization
|
|
// Only administrators should be able to delete variety variations
|
|
// Example: return $user->hasRole('admin');
|
|
return true;
|
|
}
|
|
|
|
/**
|
|
* Determine whether the user can restore the variety variation.
|
|
*/
|
|
public function restore(User $user, VarietyVariation $varietyVariation): bool
|
|
{
|
|
// TODO: Implement role-based authorization
|
|
// Only administrators should be able to restore variety variations
|
|
// Example: return $user->hasRole('admin');
|
|
return true;
|
|
}
|
|
|
|
/**
|
|
* Determine whether the user can permanently delete the variety variation.
|
|
*/
|
|
public function forceDelete(User $user, VarietyVariation $varietyVariation): bool
|
|
{
|
|
// TODO: Implement role-based authorization
|
|
// Only administrators should be able to force delete variety variations
|
|
// Example: return $user->hasRole('admin');
|
|
return true;
|
|
}
|
|
}
|