feat: registration form fields, section preferences, tag sync & schema updates
Implement EAV system for dynamic event-specific registration fields with organisation-level templates, person section preferences with priority ranking, and TagSyncService for deferred tag_picker sync. New tables: registration_field_templates, registration_form_fields, person_field_values, person_section_preferences. New columns: persons.remarks, events.registration_show_section_preferences, events.registration_show_availability. 58 tests, 126 assertions — all 432 tests pass (zero regressions). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
53
api/app/Policies/RegistrationFieldTemplatePolicy.php
Normal file
53
api/app/Policies/RegistrationFieldTemplatePolicy.php
Normal file
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Policies;
|
||||
|
||||
use App\Models\Organisation;
|
||||
use App\Models\RegistrationFieldTemplate;
|
||||
use App\Models\User;
|
||||
|
||||
final class RegistrationFieldTemplatePolicy
|
||||
{
|
||||
public function viewAny(User $user, Organisation $organisation): bool
|
||||
{
|
||||
return $user->hasRole('super_admin')
|
||||
|| $organisation->users()->where('user_id', $user->id)->exists();
|
||||
}
|
||||
|
||||
public function create(User $user, Organisation $organisation): bool
|
||||
{
|
||||
return $this->canManageOrganisation($user, $organisation);
|
||||
}
|
||||
|
||||
public function update(User $user, RegistrationFieldTemplate $template, Organisation $organisation): bool
|
||||
{
|
||||
if ($template->organisation_id !== $organisation->id) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return $this->canManageOrganisation($user, $organisation);
|
||||
}
|
||||
|
||||
public function delete(User $user, RegistrationFieldTemplate $template, Organisation $organisation): bool
|
||||
{
|
||||
if ($template->organisation_id !== $organisation->id) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return $this->canManageOrganisation($user, $organisation);
|
||||
}
|
||||
|
||||
private function canManageOrganisation(User $user, Organisation $organisation): bool
|
||||
{
|
||||
if ($user->hasRole('super_admin')) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return $organisation->users()
|
||||
->where('user_id', $user->id)
|
||||
->wherePivot('role', 'org_admin')
|
||||
->exists();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user