@@ -166,6 +166,20 @@ final class SupplierPayables
|
||||
}, fn (int $id) => $this->document($u, $id), self::historyEnabled() ? fn (int $id) => $this->paymentHistory($u, $id) : null);
|
||||
}
|
||||
|
||||
/** Native financial positions with read authorization only; commands are forbidden. */
|
||||
public function readEngine(User $user): Payables
|
||||
{
|
||||
$context = $this->readContext($user);
|
||||
|
||||
return new Payables(DB::connection(), $user->id, $context['person'], $context['scope'], function (string $action) use ($user, $context) {
|
||||
if ($action !== 'view') {
|
||||
throw new \LogicException('A composição de consulta não executa comandos financeiros.');
|
||||
}
|
||||
$fresh = $this->readContext($user);
|
||||
abort_unless($fresh['scope'] === $context['scope'] && $fresh['person'] === $context['person'], 409, 'Identidade/contexto alterado; reabra a consulta.');
|
||||
}, fn (int $id) => $this->document($user, $id), self::historyEnabled() ? fn (int $id) => $this->paymentHistory($user, $id) : null);
|
||||
}
|
||||
|
||||
/** @param array<string,mixed> $options
|
||||
* @return array<string,mixed>
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user