Skip to content

Converting a contact person to a user account fails because it reads an email field the contact no longer has #1083

Description

@rubenvdlinde

What goes wrong

Turning a contact person into a Nextcloud user account fails for every contact created through the current form, on both the manual "Convert to User" button and the automatic path. Both read an email field that the contact person schema no longer has.

Evidence, re-read at c9760e0

  • The contactPerson schema (lib/Settings/softwarecatalogus_register.json, slug at :1788) has only contactsUid, notifications, organization, role, roles. There is no email or e-mailadres property; identity moved to Nextcloud Contacts through contactsUid.
  • Manual path: src/components/ContactpersonenList.vue:97 "Convert to User" posts to /api/contactpersonen/{id}/convert-to-user (appinfo/routes.php:171), handled by lib/Controller/ContactpersonenController.php:393 convertToUser(). It reads $contactData['email'] ?? $contactData['e-mailadres'] ?? '' (:448) and returns the validation error from validateEmailForUsername('') (:449-455), "No email address found on the contact person." (ContactPersonHandler.php:224-225), before any account is made. lib/Service/Stackiq/ContactPersonHandler.php:299 createUserAccount() reads the same two keys and returns null with "USER CREATION FAILED - NO EMAIL" when both are empty (:313-321).
  • Automatic path: lib/EventListener/StackiqEventListener.php:82 hands contacts to lib/Service/ContactpersoonService.php, which reads the same keys (:127, :141) and stops when the email is not usable (:142-143). Its own comment (:139) still says "Schema uses 'e-mailadres'".
  • Neither path looks the address up from Nextcloud Contacts through contactsUid (no contactsUid reference in either file).
  • Knock-on: the organisation hierarchy setup (ContactPersonHandler.php:646 first contact becomes organisation admin, HierarchyHandler.php:79 and :130) only runs after a successful conversion, so it does not run for these contacts either.

Why it matters

Organisations cannot give their contact persons a login, so a new supplier or municipality cannot get its first administrator through the app; only contacts carrying legacy imported data still convert.

Needs a live check

Code reading. Confirm with a contact created on OrganisatieDetail today and the Convert to User button.

Surfaced by the capability matrix in stackiq#1072 (merge 38b9938), rows org-contact-to-account and org-hierarchy.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

triageAwaiting triage

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions