Entrega dashboard e correccoes transversais preservando Ofertas instalado
tests / ci (push) Waiting to run
tests / ci (push) Waiting to run
This commit is contained in:
@@ -47,6 +47,16 @@ class VirtualDesk
|
||||
return $case->organization_id ? $this->represents($actor, $case->organization_id, $write) : (int) $case->user_id === $actor->id;
|
||||
}
|
||||
|
||||
/** The same effective membership used by dossier access; identity does not depend on country configuration.
|
||||
* @return list<array<string,mixed>>
|
||||
*/
|
||||
public function representedOrganizations(User $actor): array
|
||||
{
|
||||
return array_values(DB::table('memberships as m')->join('organizations as o', 'o.id', '=', 'm.organization_id')->where('m.user_id', $actor->id)
|
||||
->whereNull('m.deleted_at')->whereNull('o.deleted_at')->get(['o.id', 'o.name', 'o.version_no', ...(Schema::hasColumn('organizations', 'incorporation_country_code') ? ['o.incorporation_country_code'] : [])])
|
||||
->unique('id')->map(fn ($row) => ['id' => $row->id, 'name' => $row->name, 'version' => $row->version_no, 'country' => $row->incorporation_country_code ?? null])->values()->all());
|
||||
}
|
||||
|
||||
public function case(User $actor, string $id, bool $write = false, bool $lock = false): \stdClass
|
||||
{
|
||||
$case = DB::table('desk_cases')->where('id', $id)->when($lock, fn ($q) => $q->lockForUpdate())->first();
|
||||
|
||||
Reference in New Issue
Block a user