Feat: TestPolicy для управления правами доступа к тестам

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
This commit is contained in:
mirivlad 2026-03-26 13:48:42 +08:00
parent 8ab423607c
commit eeb0628e51
2 changed files with 67 additions and 0 deletions

66
app/Policies/TestPolicy.php Executable file
View File

@ -0,0 +1,66 @@
<?php
namespace App\Policies;
use App\Models\Test;
use App\Models\User;
use Illuminate\Auth\Access\Response;
class TestPolicy
{
/**
* Determine whether the user can view any models.
*/
public function viewAny(User $user): bool
{
return false;
}
/**
* Determine whether the user can view the model.
*/
public function view(User $user, Test $test): bool
{
return false;
}
/**
* Determine whether the user can create models.
*/
public function create(User $user): bool
{
return false;
}
/**
* Determine whether the user can update the model.
*/
public function update(User $user, Test $test): bool
{
return false;
}
/**
* Determine whether the user can delete the model.
*/
public function delete(User $user, Test $test): bool
{
return false;
}
/**
* Determine whether the user can restore the model.
*/
public function restore(User $user, Test $test): bool
{
return false;
}
/**
* Determine whether the user can permanently delete the model.
*/
public function forceDelete(User $user, Test $test): bool
{
return false;
}
}

View File

@ -22,6 +22,7 @@ class AuthServiceProvider extends ServiceProvider
protected $policies = [
CourseCategory::class => CourseCategoryPolicy::class,
Course::class => CoursePolicy::class,
Test::class => TestPolicy::class,
Organization::class => OrganizationPolicy::class,
Group::class => GroupPolicy::class,
User::class => UserPolicy::class,