Migration complete
This commit is contained in:
36
app/Policies/EntryReviewPolicy.php
Normal file
36
app/Policies/EntryReviewPolicy.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace App\Policies;
|
||||
|
||||
use App\Models\Entry;
|
||||
use App\Models\EntryReview;
|
||||
use App\Models\User;
|
||||
|
||||
class EntryReviewPolicy
|
||||
{
|
||||
public function viewAny(\App\Auth\XenForoUser $user): bool
|
||||
{
|
||||
if( $user->_can( 'romhackplaza', 'view' ) )
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public function create(\App\Auth\XenForoUser $user, ?EntryReview $review = null ): bool
|
||||
{
|
||||
return $user->_can( 'romhackplaza', 'canSubmitEntry' );
|
||||
}
|
||||
|
||||
public function update(\App\Auth\XenForoUser $user, ?EntryReview $review = null ): bool
|
||||
{
|
||||
// Staff editors
|
||||
if( $user->_can('romhackplaza', 'canEditOthersEntries') )
|
||||
return true;
|
||||
|
||||
// Author.
|
||||
if( $user->_can( 'romhackplaza', 'canEditMyEntries' ) && $review->user_id === $user->user_id )
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user