A lot of things.

This commit is contained in:
2026-05-27 21:24:44 +02:00
parent d02baa89d6
commit c68c4d18b5
3 changed files with 86 additions and 0 deletions

View File

@@ -0,0 +1,39 @@
<?php
namespace App\Policies;
use App\Models\Entry;
use App\Auth\XenForoUser as User;
use Illuminate\Auth\Access\Response;
class EntryPolicy
{
public function view(User $user): bool
{
if( $user->_can( 'romhackplaza', 'view' ) )
return true;
return false;
}
public function create(User $user, ?Entry $entry = null ): bool
{
return $user->_can( 'romhackplaza', 'canSubmitEntry' );
}
/**
* Determine whether the user can update the model.
*/
public function update(User $user, Entry $entry): bool
{
if( $user->_can('romhackplaza', 'canEditOthersEntries') )
return true;
if( $user->_can( 'romhackplaza', 'canEditMyEntries' ) && $entry->user_id === $user->user_id )
return true;
return false;
}
}