security: round 2 — multi-tenancy isolation (OrganisationScope, scoped validation, boundary checks)
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -21,13 +21,16 @@ final class PortalMeController extends Controller
|
||||
{
|
||||
public function index(PortalMeRequest $request): JsonResponse
|
||||
{
|
||||
$event = Event::findOrFail($request->validated('event_id'));
|
||||
$event = Event::withoutGlobalScope(\App\Models\Scopes\OrganisationScope::class)
|
||||
->findOrFail($request->validated('event_id'));
|
||||
|
||||
if ($event->isSubEvent()) {
|
||||
$event = $event->parent;
|
||||
}
|
||||
|
||||
$person = Person::where('user_id', $request->user()->id)
|
||||
// Verify user has a person record for this event (scopes access)
|
||||
$person = Person::withoutGlobalScope(\App\Models\Scopes\OrganisationScope::class)
|
||||
->where('user_id', $request->user()->id)
|
||||
->where('event_id', $event->id)
|
||||
->with([
|
||||
'crowdType',
|
||||
@@ -95,13 +98,16 @@ final class PortalMeController extends Controller
|
||||
|
||||
$user = $request->user();
|
||||
|
||||
$event = Event::findOrFail($validated['event_id']);
|
||||
$event = Event::withoutGlobalScope(\App\Models\Scopes\OrganisationScope::class)
|
||||
->findOrFail($validated['event_id']);
|
||||
|
||||
if ($event->isSubEvent()) {
|
||||
$event = $event->parent;
|
||||
}
|
||||
|
||||
$person = Person::where('user_id', $user->id)
|
||||
// Verify user has a person record for this event (scopes access)
|
||||
$person = Person::withoutGlobalScope(\App\Models\Scopes\OrganisationScope::class)
|
||||
->where('user_id', $user->id)
|
||||
->where('event_id', $event->id)
|
||||
->firstOrFail();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user