Implement leadership-based permissions for Meetup management

- 🔒 Restrict event creation, editing, and deletion to Meetup leaders (`is_leader`) and creators for consistency across APIs, frontend, and MCP.
-  Add new APIs for leader delegation: assign/remove Meetup leaders via `meetup_user.is_leader`.
- 🛠️ Replace loose member checks with specific leadership checks in policies, controllers, and views.
- 🧪 Add exhaustive tests to ensure only eligible leaders execute critical actions (e.g., event creation/edit, Meetup updates).
- 🔄 Refactor pivot relationships and models (`leadByMe`, `isLeader`) for explicit leadership handling.
-  Introduce artisan command `meetups:promote-existing-leaders` to transition legacy data.
This commit is contained in:
HolgerHatGarKeineNode
2026-06-16 22:04:34 +02:00
parent 39af153f52
commit 9f8fda294a
26 changed files with 691 additions and 70 deletions
@@ -23,7 +23,7 @@ class extends Component {
public function deleteEvent(MeetupEvent $event): void
{
if ($this->meetup->belongsToMe) {
if ($this->meetup->leadByMe) {
$event->delete();
$this->dispatch('event-deleted');
Flux::modals()->close();
@@ -231,7 +231,7 @@ class extends Component {
<div class="mt-16">
<div class="flex flex-col sm:flex-row items-center sm:space-x-4 space-y-4 sm:space-y-0 mb-6">
<flux:heading size="xl">{{ __('Kommende Veranstaltungen') }}</flux:heading>
@if(auth()->user() && auth()->user()->meetups()->find($meetup->id)?->exists)
@if($meetup->leadByMe)
<flux:button :href="route_with_country('meetups.events.create', ['meetup' => $meetup])"
variant="primary" icon="calendar">
{{ __('Neues Event erstellen') }}
@@ -281,7 +281,7 @@ class extends Component {
>
{{ __('Öffnen/RSVP') }}
</flux:button>
@if($meetup->belongsToMe)
@if($meetup->leadByMe)
<flux:button
:href="route_with_country('meetups.events.edit', ['meetup' => $meetup, 'event' => $event])"
size="xs"
@@ -332,7 +332,7 @@ class extends Component {
@else
<div class="mt-16">
<div class="flex items-center space-x-4 mb-6">
@if(auth()->user() && auth()->user()->meetups()->find($meetup->id)?->exists)
@if($meetup->leadByMe)
<flux:button :href="route_with_country('meetups.events.create', ['meetup' => $meetup])"
variant="primary" icon="calendar">
{{ __('Neues Event erstellen') }}