Skip to content

Commit

Permalink
[CLOSES #69] Properly scope assets, honeypots, etc.
Browse files Browse the repository at this point in the history
  • Loading branch information
csavelief committed Sep 16, 2024
1 parent 4d31ecd commit 62ca9fc
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions app/Modules/AdversaryMeter/Traits/HasTenant.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,12 @@ protected static function booted()
$customerId = $user->customer_id;

if ($customerId) {
$users = User::select('id')
->whereRaw("(tenant_id IS NULL OR tenant_id = {$tenantId})")
->whereRaw("(customer_id IS NULL OR customer_id = {$customerId})");
$users = User::select('id')->where('tenant_id', $tenantId)->where('customer_id', $customerId);
} else {
$users = User::select('id')
->whereRaw("(tenant_id IS NULL OR tenant_id = {$tenantId})");
$users = User::select('id')->where('tenant_id', $tenantId);
}

$builder->whereNull('created_by')
->orWhereIn('created_by', $users);
$builder->whereIn('created_by', $users);
}
});
}
Expand Down

0 comments on commit 62ca9fc

Please sign in to comment.