Skip to content

Sessie 16 januari 2026: Profile Permission Errors & UI Fix

Context

Critical regressions in profile editing and admin UI surfaced during ticket system stabilization. Admin permissions page returned 500 errors, profile overview broke, and user51 couldn't edit customer profile due to redirect issues.

Problemen

Profile Entity Bundle Errors

  • /admin/people/permissions returned 500 internal server error
  • /admin/people/profiles crashed with "call to getDisplayLabel() on null"
  • Cause: orphan profile entities with missing bundle (bundle=null)
  • Blocked admin from managing permissions via UI

Profile Edit Redirect Loop

  • User51 redirected from /klantgegevens/edit to /customer/add
  • User72 could edit profile normally
  • ProfileViewController::edit only loaded active (status=1) profiles
  • User51 had no active profile, triggering unwanted redirect
  • Inconsistent UX across users

PDF Download Access Issues

  • Assignees with accepted tickets couldn't download PDF
  • Access control needed refinement for email-based lookup
  • Theme preprocess errors during PDF generation

Oplossingen

Orphan Profile Diagnosis

Read-only audit queries prepared:

-- List all profile bundles
SELECT DISTINCT type FROM profile_field_data;

-- Find orphan profiles (bundle=null)
SELECT profile_id, uid, status, created 
FROM profile_field_data 
WHERE type IS NULL OR type = '';

Approach: identify scope before applying targeted cleanup or bundle recreation.

ProfileViewController Edit Patch

Modified ProfileViewController::edit method to prevent redirect: - Remove redirect logic for missing active profiles - Allow inline profile creation on edit route - Consistent behavior for all users on /klantgegevens/edit

File: web/modules/contrib/profile/src/Controller/ProfileViewController.php

Temporary Permission Grant via CLI

Unblocked user51 profile editing without using broken UI:

drush role:perm:add authenticated 'create own customer profile'
drush role:perm:add authenticated 'edit own customer profile'
drush cr

PDF Access & Theme Fixes

  • Updated TicketPdfController access logic for assignee email lookup
  • Fixed vg25_preprocess_commerce_license null entity handling
  • Improved Twig template for A4 layout and dynamic event data

Technische Details

Files Modified

  • ProfileViewController.php (profile module controller)
  • TicketPdfController.php (PDF download access)
  • vg25.theme (license preprocess)
  • commerce-license--vgbc-ticket.html.twig (PDF template)

Routes

  • vg_commerce.profile_edit.customer → ProfileViewController::edit
  • vg_commerce.ticket.pdf → TicketPdfController::downloadPdf

Database

  • Profile entities: profile_field_data table
  • Orphan records with null bundle identified as root cause

Status

  • PDF access issues: Resolved
  • Profile edit redirect: Patch prepared, pending apply
  • Orphan profile cleanup: Diagnostic phase, awaiting user decision
  • Permissions page 500: Linked to orphan profiles, fix pending

Volgende Stappen

  1. Apply ProfileViewController::edit patch
  2. Execute read-only profile audit
  3. Present cleanup options to user
  4. Restore admin permissions UI functionality
  5. Final PDF layout polish (ticket ID, logo positioning)