feat: consolidar desenvolvimentos do portal InvestMoz
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
<?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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user