Scope staff Care queries to the organization owner_ref.
Deploy Ladill Care / deploy (push) Successful in 1m11s
Deploy Ladill Care / deploy (push) Successful in 1m11s
Demo doctors were querying their own public_id, so branches/patients/queues looked empty even though the Pro tenant had data. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -12,7 +12,17 @@ use Illuminate\Http\Request;
|
||||
|
||||
trait ScopesToAccount
|
||||
{
|
||||
/**
|
||||
* Tenant data owner — always the organization owner_ref.
|
||||
* Staff members must read/write the employer's records, not their own public_id.
|
||||
*/
|
||||
protected function ownerRef(Request $request): string
|
||||
{
|
||||
return (string) $this->organization($request)->owner_ref;
|
||||
}
|
||||
|
||||
/** Acting user (audit / created_by), distinct from the tenant owner. */
|
||||
protected function actorRef(Request $request): string
|
||||
{
|
||||
return (string) $request->user()->public_id;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user