Enhance meetup association and permissions management

- 🔍 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`.
This commit is contained in:
HolgerHatGarKeineNode
2026-06-08 11:59:02 +02:00
parent dc2b828777
commit 3a507cced2
13 changed files with 260 additions and 56 deletions
@@ -54,6 +54,40 @@ trait ResolvesEntities
return $this->optionsError($owned, $label, $column);
}
/**
* Löst einen Datensatz per ID oder Name STRIKT innerhalb des übergebenen Scopes auf
* (der Scope ist zugleich die Autorisierung). Bei Mehrdeutigkeit oder fehlendem Treffer
* wird eine Auswahlliste der Einträge des Scopes zurückgegeben.
*/
protected function resolveInScope(Builder $scope, Request $request, string $label, string $nameParam, string $column = 'name'): Model|Response
{
$id = $request->get('id');
if ($this->present($id)) {
$byId = (clone $scope)->whereKey($id)->first();
if ($byId !== null) {
return $byId;
}
}
$name = $request->get($nameParam);
if ($this->present($name)) {
$matches = $this->matchByName(clone $scope, (string) $name, $column);
if ($matches->count() === 1) {
return $matches->first();
}
if ($matches->count() > 1) {
return Response::error("Mehrere {$label} passen zu \"{$name}\": ".$matches->pluck($column)->join('; ').'. Bitte den genauen Namen angeben.');
}
}
return $this->optionsError(clone $scope, $label, $column);
}
/**
* Löst einen Fremdschlüssel über den Namen auf und schreibt die ID in den Request,
* damit die nachgelagerte Validierung sie sieht. Gibt null zurück, wenn nichts zu tun