22 lines
614 B
PHP
22 lines
614 B
PHP
<?php
|
|
|
|
namespace App\Services;
|
|
|
|
use App\Models\User;
|
|
|
|
/** Existing internal administration; does not establish an institutional mandate. */
|
|
final class EducationAccess
|
|
{
|
|
public function allows(User $actor): bool
|
|
{
|
|
return $actor->hasVerifiedEmail() && ! app(PortalProfileAccess::class)->has($actor, 'auditor')
|
|
&& ($actor->can('manage-portal') || app(ScopedPortalAdministration::class)->administrative($actor));
|
|
}
|
|
|
|
public function authorize(User $actor): void
|
|
{
|
|
abort_unless(config('education.enabled'), 404);
|
|
abort_unless($this->allows($actor), 403);
|
|
}
|
|
}
|