Initial commit: Pireon Admin — headless admin panel and public API
Laravel 13 + Filament 5 admin panel and REST API for a non-profit developer collective, backed by the Pireon OAuth identity server. The public site is a separate, server-rendered application consuming /api/public/v1. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
41
app/Policies/MissingUrlPolicy.php
Normal file
41
app/Policies/MissingUrlPolicy.php
Normal file
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Policies;
|
||||
|
||||
use App\Models\MissingUrl;
|
||||
use App\Models\User;
|
||||
|
||||
/**
|
||||
* Gated by the redirect permissions rather than a set of its own.
|
||||
*
|
||||
* Reading this list and writing redirects are the same job — the list exists
|
||||
* only to decide which addresses deserve a rule — and a permission nobody
|
||||
* remembers to grant is a screen nobody can open. Whoever may fix a broken
|
||||
* link may see which links are broken.
|
||||
*/
|
||||
class MissingUrlPolicy extends ResourcePolicy
|
||||
{
|
||||
protected function resource(): string
|
||||
{
|
||||
return 'redirects';
|
||||
}
|
||||
|
||||
/**
|
||||
* Nobody files one of these by hand: they arrive from the frontend.
|
||||
*/
|
||||
public function create(User $user): bool
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Turning a report into a redirect is creating a redirect, so it asks for
|
||||
* the permission that actually describes it.
|
||||
*/
|
||||
public function redirect(User $user, MissingUrl $missingUrl): bool
|
||||
{
|
||||
return $user->can('redirects.create');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user