Files
headroom/backend/app/Policies/AllocationPolicy.php
Santhosh Janardhanan 3324c4f156 feat(allocation): implement resource allocation feature
- Add AllocationController with CRUD + bulk endpoints
- Add AllocationValidationService for capacity/estimate validation
- Add AllocationMatrixService for optimized matrix queries
- Add AllocationPolicy for authorization
- Add AllocationResource for API responses
- Add frontend allocationService and matrix UI
- Add E2E tests for allocation matrix (20 tests)
- Add unit tests for validation service and policies
- Fix month format conversion (YYYY-MM to YYYY-MM-01)
2026-02-25 16:28:47 -05:00

50 lines
1.1 KiB
PHP

<?php
namespace App\Policies;
use App\Models\Allocation;
use App\Models\User;
class AllocationPolicy
{
/**
* Determine whether the user can view any allocations.
*/
public function viewAny(User $user): bool
{
return true;
}
/**
* Determine whether the user can view a specific allocation.
*/
public function view(User $user, Allocation $allocation): bool
{
return true;
}
/**
* Determine whether the user can create allocations.
*/
public function create(User $user): bool
{
return in_array($user->role, ['superuser', 'manager']);
}
/**
* Determine whether the user can update allocations.
*/
public function update(User $user, Allocation $allocation): bool
{
return in_array($user->role, ['superuser', 'manager']);
}
/**
* Determine whether the user can delete allocations.
*/
public function delete(User $user, Allocation $allocation): bool
{
return in_array($user->role, ['superuser', 'manager']);
}
}