mirror of
https://github.com/HolgerHatGarKeineNode/einundzwanzig-app.git
synced 2026-06-11 02:50:29 +00:00
3a507cced2
- 🔍 Added `resolveInScope` method to `ResolvesEntities` for scoped entity resolution with stricter control. - 👥 Introduced `AddMeetupToMineTool` MCP tool for adding external meetups to "My Meetups." - 🛠️ Updated `ListMyMeetupsTool` and `ShowMyMeetupTool` to include both created and joined meetups. - 📚 Updated `Meetup` model with `associatedWith` scope for querying user-related meetups. - ✅ Expanded feature tests for meetup membership, creator permissions, and scoped tool usage. - 🛡️ Unified access checks across Livewire and APIs to restrict editing meetup details to creators or super-admins. - 🔗 Registered `AddMeetupToMineTool` in `EinundzwanzigServer`.
34 lines
989 B
PHP
34 lines
989 B
PHP
<?php
|
|
|
|
namespace App\Mcp\Tools\Meetup;
|
|
|
|
use App\Http\Resources\MeetupResource;
|
|
use App\Models\Meetup;
|
|
use Illuminate\Support\Facades\Gate;
|
|
use Laravel\Mcp\Request;
|
|
use Laravel\Mcp\Response;
|
|
use Laravel\Mcp\Server\Attributes\Description;
|
|
use Laravel\Mcp\Server\Tool;
|
|
use Laravel\Mcp\Server\Tools\Annotations\IsReadOnly;
|
|
|
|
#[IsReadOnly]
|
|
#[Description('Listet die Meetups des authentifizierten Nutzers (selbst erstellte UND beigetretene), alphabetisch sortiert.')]
|
|
class ListMyMeetupsTool extends Tool
|
|
{
|
|
public function handle(Request $request): Response
|
|
{
|
|
$user = $request->user();
|
|
|
|
if ($user === null || Gate::forUser($user)->denies('viewAny', Meetup::class)) {
|
|
return Response::error('Nicht authentifiziert.');
|
|
}
|
|
|
|
$meetups = Meetup::query()
|
|
->associatedWith($user->getAuthIdentifier())
|
|
->orderBy('name')
|
|
->get();
|
|
|
|
return Response::json(MeetupResource::collection($meetups)->resolve());
|
|
}
|
|
}
|