Commit Graph

48 Commits

Author SHA1 Message Date
vk
0c64fe55d7 Kleine Bilder anzeigen (vibe-kanban 9bcfc693)
Die Ladezeiten der Bilder ist zu hoch, weil die Original geladen werden.
Bei /association/project-support lade in der Übersicht und in der Einzel-Ansicht /association/project-support/badgebox-for-nostr-manage-your-badges nur die Conversions der Bilder, also die kleinere Versionen.
2026-02-12 22:53:56 +01:00
vk
d1b9dad35e [P2 Security] Laravel Authorization Policies für ProjectProposal, Vote, Election (vibe-kanban 85007440)
## Security Audit: Fehlende zentralisierte Autorisierung

### Problem
Die Anwendung hat **keine Laravel Policy-Klassen**. Autorisierungslogik ist verstreut in:

- **Blade Templates:** Inline `@if`-Checks gegen `config('einundzwanzig.config.current_board')`
- **Livewire Trait:** `app/Livewire/Traits/WithNostrAuth.php` setzt `$isAllowed` und `$canEdit` Booleans
- **Component-Mount-Methoden:** z.B. in `project-support/form/create.blade.php` (Zeile 41-47)

Die Board-Member-Autorisierung funktioniert über einen Vergleich mit hartkodierten npubs in `config/einundzwanzig/config.php`:
```php
'current_board' => [
    'npub1pt0kw36...', 'npub1gvqkjc...', // etc.
]
```

**Probleme:**
- Keine zentrale Stelle für Berechtigungsprüfungen
- Autorisierung kann leicht vergessen werden wenn neue Endpoints hinzukommen
- Board-Member-Check wird an vielen Stellen dupliziert
- Livewire-Actions können ggf. direkt aufgerufen werden ohne UI-seitige Prüfung

### Lösung

**1. Laravel Policies erstellen:**

```bash
php artisan make:policy ProjectProposalPolicy --model=ProjectProposal --no-interaction
php artisan make:policy VotePolicy --model=Vote --no-interaction
php artisan make:policy ElectionPolicy --model=Election --no-interaction
```

**2. Policy-Methoden implementieren:**

Für `ProjectProposalPolicy`:
- `viewAny()` – Jeder darf die Liste sehen
- `view()` – Jeder darf ein Proposal sehen
- `create()` – Nur authentifizierte User mit `association_status > 1` und bezahlter Mitgliedschaft im aktuellen Jahr
- `update()` – Nur der Ersteller ODER Board-Members
- `delete()` – Nur Board-Members
- `accept()` – Nur Board-Members (custom method für `accepted`-Flag)

Für `VotePolicy`:
- `create()` – Authentifizierte User, die noch nicht für dieses Proposal abgestimmt haben
- `update()` / `delete()` – Nur der eigene Vote

Für `ElectionPolicy`:
- `viewAny()` / `view()` – Jeder
- `create()` / `update()` / `delete()` – Nur Board-Members
- `vote()` – Authentifizierte Mitglieder mit gültigem Status

**3. Auth-Checks in der Nostr-Auth-Architektur:**

Die App nutzt eine Custom NostrAuth (`app/Support/NostrAuth.php`, `app/Auth/NostrUser.php`). Die Policies müssen mit `NostrUser` funktionieren. Prüfe ob `NostrUser` das `Authenticatable` Interface korrekt implementiert, damit `$this->authorize()` und `Gate::allows()` in Livewire-Components funktionieren.

**4. Policies in Livewire-Components nutzen:**

Ersetze die inline-Checks in den Components durch Policy-Aufrufe:
```php
// Vorher (verstreut in Blade/Component):
if (in_array($this->currentPleb->npub, config('einundzwanzig.config.current_board'), true)) { ... }

// Nachher (zentralisiert):
$this->authorize('update', $projectProposal);
```

### Betroffene Dateien
- **Neue Dateien:** `app/Policies/ProjectProposalPolicy.php`, `app/Policies/VotePolicy.php`, `app/Policies/ElectionPolicy.php`
- **Anpassen:** `app/Livewire/Traits/WithNostrAuth.php` – Board-Check in Policy auslagern
- **Anpassen:** Livewire-Components in `app/Livewire/Association/ProjectSupport/` – `$this->authorize()` nutzen
- **Anpassen:** Livewire-Components in `app/Livewire/Association/Election/` – `$this->authorize()` nutzen
- **Prüfen:** `app/Auth/NostrUser.php` – Kompatibilität mit Policy-System
- **Prüfen:** `config/einundzwanzig/config.php` – Board-Member-Liste wird weiterhin als Datenquelle genutzt

### Vorgehen
1. `search-docs` nutzen: `queries: ['policies', 'authorization', 'gates']` und `packages: ['laravel/framework']`
2. Prüfe wie `NostrUser` mit Laravel's Authorization-System zusammenspielt
3. Policies mit `php artisan make:policy` erstellen
4. Policy-Methoden implementieren (Board-Check-Logik zentralisieren)
5. Livewire-Components auf Policy-Aufrufe umstellen
6. Blade-Templates: `@can` / `@cannot` Directives nutzen statt inline `@if`
7. Pest Feature-Tests für jede Policy-Methode schreiben
8. `vendor/bin/pint --dirty` und `php artisan test --compact`

### Akzeptanzkriterien
- 3 Policy-Klassen existieren und sind registriert
- Board-Member-Check ist an EINER Stelle definiert (in Policy oder Helper)
- Livewire-Components nutzen `$this->authorize()` statt inline-Checks
- Blade-Templates nutzen `@can` / `@cannot` Directives
- Pest-Tests decken alle Policy-Methoden ab (allow & deny)
- Bestehende Funktionalität bleibt erhalten
2026-02-11 23:49:53 +01:00
HolgerHatGarKeineNode
10dac9d02b 🔒 Implement signed media URLs and migrate media storage to private disk
-  Introduce `getSignedMediaUrl` in models for temporary signed URLs
- 🗂️ Migrate media collections to private disk for added security
- 🔧 Add `media:move-to-private` command to streamline migration
- ⚙️ Update views and components to use signed media URLs
- ✏️ Adjust route `media.signed` for signed file access handling
2026-01-25 19:14:49 +01:00
HolgerHatGarKeineNode
d053a2c901 Update project card component: use flux:link for submitter's Nostr profile links and remove redundant link 2026-01-20 17:27:53 +01:00
HolgerHatGarKeineNode
7372b7f54f ✏️ Fix typo in project card component: correct "Anstragssteller" to "Antragssteller". 2026-01-20 17:24:46 +01:00
HolgerHatGarKeineNode
ad09b3804a Update project card component: simplify link styles, add applicant link, and improve badge usage 2026-01-20 17:22:22 +01:00
HolgerHatGarKeineNode
631e19b64a 🎨 Refactor project card component: adjust responsive layout, enhance button grouping, improve badge usage, and streamline footer structure for better readability and consistency. 2026-01-20 16:51:48 +01:00
HolgerHatGarKeineNode
4a425da923 🎨 Update color palette: replace gray with zinc across Blade templates for improved design consistency and accessibility.
🛠 Refactor forms: rename NostrAuth method for clarity and enhance Flux button usage for cleaner and reusable components.
 Add `WithNostrAuth` trait: refactor `show` template logic, streamline project-support handling, and improve layout readability.
2026-01-20 14:58:02 +01:00
HolgerHatGarKeineNode
a6c8fb6435 Refactor project-support forms: add admin-only fields, improve Flux form components, and enhance layout for consistency. 🛠️ Remove redundant NostrAuth methods and streamline authorization logic. 2026-01-20 00:49:28 +01:00
HolgerHatGarKeineNode
714de411a6 🛠️ Refactor delete confirmation logic with projectToDelete property, enhance project voting features in Livewire, and update Blade templates for consistency and improved UX. 2026-01-19 23:40:42 +01:00
HolgerHatGarKeineNode
c5793872af 🛠️ Refactor Blade templates: improve HTML structure, standardize indentation, and enhance readability in layouts and component definitions. 2026-01-19 22:14:49 +01:00
HolgerHatGarKeineNode
bf31b9f001 Integrate Flux modals for member acceptance and rejection actions, refactor related Livewire methods, and improve Blade table structure for consistency and UX. 2026-01-18 23:28:27 +01:00
HolgerHatGarKeineNode
7db9c04505 🛠️ Refactor Blade templates: improve formatting, streamline HTML structure, and update modal implementation for better maintainability. 2026-01-18 21:11:36 +01:00
HolgerHatGarKeineNode
18f8dd99e3 🚀 Integrate Flux modals and toasts into Blade templates, refactor delete confirmation logic, and replace deprecated WireUI notifications for improved UX. 2026-01-18 20:47:12 +01:00
HolgerHatGarKeineNode
b090336c4f 🛠️ Refactor migrations, models, configs, and Blade files to apply consistent formatting, remove unnecessary lines, and improve readability. 2026-01-18 19:50:04 +01:00
HolgerHatGarKeineNode
a4aad6ebb6 🗑️ Remove deprecated and unused layouts, components, and assets; update dependencies and integrate TailwindCSS v4 for improved consistency. 2026-01-18 19:18:51 +01:00
HolgerHatGarKeineNode
6ea8d7c546 🗑️ Remove unused postcss.config.js and streamline sidebar navigation with updated Blade components
 Add `:currentRoute` prop bindings and update Tailwind configuration for enhanced theme customization
2026-01-18 17:54:11 +01:00
HolgerHatGarKeineNode
ddb79476ca 🛠️ Update window.nostr.min.js with optimized logic and improved syntax for better performance and readability 2026-01-18 17:42:01 +01:00
HolgerHatGarKeineNode
0694a2d837 Add Livewire Flux components and new tests for project proposal and editing forms 2026-01-18 15:19:00 +01:00
HolgerHatGarKeineNode
30e78711c9 Add reusable Blade components for inputs and layouts: FilePond, navigation groups, and notification buttons 2026-01-18 13:23:20 +01:00
HolgerHatGarKeineNode
22c8ad3588 🗑️ Remove unused Blade templates and components across navigation, layouts, and details, streamlining unused sections like admin, association, courses, events, and dark-mode toggle. 2026-01-18 01:45:02 +01:00
HolgerHatGarKeineNode
00216409b4 🗑️ Remove unused Livewire components and Blade views related to elections, member management, changelog, project support, and meetups. 2026-01-18 01:33:24 +01:00
HolgerHatGarKeineNode
a1dd16cf65 🛠️ Add safe navigation operator to handle potential null profiles in project card component 2026-01-06 21:07:25 +01:00
HolgerHatGarKeineNode
eb7d090ad3 🛠️ Handle null profile gracefully in project card component 2026-01-06 21:05:10 +01:00
user
9c1cea5868 🔒 Add Nostr authentication support with custom guard and user provider
🛠️ Integrate Nostr auth across relevant components and views
📦 Update config, routes, and service provider for Nostr auth
2025-11-20 23:10:20 +01:00
user
aff3f32c9b Remove nostr-login dependency and update lockfile. 2025-11-20 21:01:08 +01:00
fsociety
14a216325d 🔄 chore(deps): update multiple dependencies in yarn.lock to latest versions for improved compatibility 2025-06-04 17:33:30 +02:00
fsociety
0b5b6cc9ad 🎉 update(deps): bump dependencies for email-validator, pretty-package-versions, and others to latest versions
🔒 refactor(auth): streamline access control logic in election and project support forms

 add(styles): include partial styles for better layout management

🚀 feat(layout): integrate new styles partial into main layout for consistent design

🆕 create(partials): add styles partial to manage CSS styles more effectively
2025-03-23 23:28:02 +01:00
fsociety
1bf8c66b35 🚀 feat(news): add news management with upload functionality and category selection in the association module 2024-10-25 15:02:23 +02:00
fsociety
e7fbcb8c11 🎨 feat(navigation): add admin section to sidebar with links for settings and members management 2024-10-25 11:28:35 +02:00
fsociety
05773cb5b3 🎉 feat(seo): add Laravel SEO package and create SEO migration for better site optimization. 2024-10-24 19:18:30 +02:00
fsociety
ef1d0fdf17 🎨 feat(project): enhance project support form with image upload and validation features.
🗃️ refactor(project): rename project support route for clarity and consistency.
🗑️ chore(project): implement delete confirmation for project proposals in the index view.
🔧 fix(editor): adjust initialization delay for SimpleMDE editor to improve responsiveness.
📸 fix(media): update fallback image URL in ProjectProposal model for better asset management.
2024-10-24 18:05:37 +02:00
fsociety
c6b3593341 🚀 feat(project-support): add project proposal form and listing pages with image uploads and voting functionality 2024-10-23 18:10:14 +02:00
fsociety
ce1cffc66a 🎨 style(navigation): reduce icon sizes in navigation components for better layout consistency
🔧 fix(ApplicationForm): change validation rule for reason to nullable string
📝 update(profile): simplify membership status messages and remove unnecessary fields
🎨 style(election): adjust import formatting for better readability
🎨 style(association): reduce icon sizes in association navigation links for consistency
2024-10-22 15:59:33 +02:00
fsociety
5e830a83a7 🚀 feat(profile): update video visibility based on user login state in profile page
🎨 style(app): reorder script includes for better organization in app layout

 feat(plebTable): implement confirmation dialogs for accepting and deleting entries in Pleb table
2024-10-07 12:49:47 +02:00
fsociety
1d5079bfa0 feat: handle logout events in nostr-login
This commit introduces handling for logout events in nostr-login across various pages. When a user logs out, the current public key and other related information are reset to null. The nostrLogin.js file has also been updated to dispatch a 'nostrLoggedOut' event when this occurs. Additionally, the nostr-login package has been added to the project dependencies.
2024-10-06 13:38:49 +02:00
fsociety
1bf9265f21 feat: update layout and fix conditional rendering in detail.blade.php 2024-09-30 16:07:43 +02:00
fsociety
b470532007 feat: update layout and fix conditional rendering in detail.blade.php 2024-09-30 16:06:48 +02:00
fsociety
65fb920150 feat: add payment tracking to user profiles
- Added a check to update the 'paid' status of a user's paymentEvents if the current year's payment has been made
- Updated the user profile view to display past payments
- Added 'paymentEvents' to the query in EinundzwanzigPlebTable.php to fetch the current year's payments
- Added a 'payment' column to the table in EinundzwanzigPlebTable.php to display the amount of the user's current year's payment
2024-09-30 15:22:33 +02:00
fsociety
e0a34d9376 feat: add QR code generator and Nostr event handling
- Added the `simplesoftwareio/simple-qrcode` package to the project
- Created a new JavaScript file `nostrZap.js` to handle Nostr events
- Added the `nostrZap` function to the Alpine.js data property in `app.js`
- Updated the `services.php` configuration file to include the `nostr` environment variable
- Created a new database migration to add a `payment_event` field to the `einundzwanzig_plebs` table
- Made adjustments in the `Election:year.blade.php` view file to handle potential null values
- Updated `composer.lock` and `package.json` with the new dependencies
2024-09-30 14:46:30 +02:00
fsociety
eb57a7a5fb feat: update icon for Impressum link in app layout 2024-09-29 22:54:45 +02:00
fsociety
07194f3c06 feat: add Impressum link to app layout and clean up imports in PlebTable 2024-09-29 22:53:28 +02:00
fsociety
1bd6860949 feat: update navigation labels in association layout 2024-09-29 22:44:28 +02:00
fsociety
64d710c3d6 feat: update README and add maintainer information
This commit updates the README file by removing previous Laravel content and adds information about maintainers in a new 'maintainers.yaml' file. It also includes a new "Issues/Feedback" link on the application's layout page.
2024-09-29 20:17:22 +02:00
fsociety
5ba881dd60 feat: add changelog view and navigation link
This commit introduces a new changelog view that fetches and displays the git commit history. It also adds a navigation link to this changelog in the application layout.
2024-09-29 19:44:40 +02:00
fsociety
c2f0014a8e add members table 2024-09-29 18:21:09 +02:00
fsociety
354680f702 voting system with nostr added 2024-09-29 01:02:04 +02:00
fsociety
a0ef037b2d first copies from portal 2024-09-04 19:37:46 +02:00