fix: complete InvesteMoz validation and error corrections
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Services;
|
||||
|
||||
use App\Models\Opportunity;
|
||||
use App\Models\User;
|
||||
use Illuminate\Contracts\Encryption\DecryptException;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
@@ -26,7 +27,6 @@ class PortalSuperusers
|
||||
return $plain;
|
||||
}
|
||||
|
||||
|
||||
public function validateBootstrapHolder(User $user): void
|
||||
{
|
||||
abort_unless($user->hasVerifiedEmail() && $user->two_factor_secret && $user->two_factor_confirmed_at, 422, 'Conta confirmada com MFA necessário.');
|
||||
@@ -44,7 +44,9 @@ class PortalSuperusers
|
||||
{
|
||||
abort_unless(config('portal_profiles.bootstrap_authorized') === true, 403);
|
||||
abort_unless($first->id !== $second->id && $confirmer->id === $second->id, 403, 'Confirmação pelo segundo titular, distinta do pedido.');
|
||||
foreach ([$first, $second] as $user) $this->validateBootstrapHolder($user);
|
||||
foreach ([$first, $second] as $user) {
|
||||
$this->validateBootstrapHolder($user);
|
||||
}
|
||||
abort_unless($this->access->mfa($confirmer), 403);
|
||||
DB::transaction(function () use ($first, $second, $confirmer, $approvalId) {
|
||||
DB::select('SELECT pg_advisory_xact_lock(101026, 40001)');
|
||||
@@ -123,7 +125,7 @@ class PortalSuperusers
|
||||
$this->administration->administrative($actor);
|
||||
abort_unless(in_array($action, ['view', 'create', 'edit', 'validate', 'publish', 'archive'], true) && mb_strlen($reason) >= 20 && mb_strlen($reason) <= 1000, 422);
|
||||
if ($action === 'view') {
|
||||
$record = $recordId === null ? null : \App\Models\Opportunity::find($recordId);
|
||||
$record = $recordId === null ? null : Opportunity::find($recordId);
|
||||
abort_unless($record && $this->access->hasOperationalReadScope($actor, $record) && ! $this->access->has($actor, 'auditor'), 403, 'A consulta exige perfil operacional com âmbito válido; a elevação não o substitui.');
|
||||
}
|
||||
$id = (string) Str::uuid();
|
||||
|
||||
Reference in New Issue
Block a user