From be47884ee0a9fa7061775e4de588215654718db9 Mon Sep 17 00:00:00 2001 From: Andras Bacsai <5845193+andrasbacsai@users.noreply.github.com> Date: Mon, 25 Aug 2025 11:33:27 +0200 Subject: [PATCH] feat(docs): expand authorization documentation for custom Alpine.js components; include manual protection patterns and implementation guidelines --- .cursor/rules/security-patterns.mdc | 153 ++++++++++++++++++++++++++++ 1 file changed, 153 insertions(+) diff --git a/.cursor/rules/security-patterns.mdc b/.cursor/rules/security-patterns.mdc index 104dbd71b..a7ab2ad69 100644 --- a/.cursor/rules/security-patterns.mdc +++ b/.cursor/rules/security-patterns.mdc @@ -227,6 +227,159 @@ public function __construct( - New authorization parameters are optional - Legacy @can/@else patterns still function but are discouraged +### Custom Component Authorization Patterns + +When dealing with **custom Alpine.js components** or complex UI elements that don't use the standard `x-forms.*` components, manual authorization protection is required since the automatic `canGate` system only applies to enhanced form components. + +#### Common Custom Components Requiring Manual Protection + +**⚠️ Custom Components That Need Manual Authorization:** +- Custom dropdowns/selects with Alpine.js +- Complex form widgets with JavaScript interactions +- Multi-step wizards or dynamic forms +- Third-party component integrations +- Custom date/time pickers +- File upload components with drag-and-drop + +#### Manual Authorization Pattern + +**✅ Proper Manual Authorization:** +```html + +
File upload restricted
+ @if($currentFile) +Current: {{ $currentFile }}
+ @endif +