M3 Integration fixes

This commit is contained in:
Mark Gregory
2026-09-21 10:14:57 +01:00
parent 4af997c465
commit 6d60cbff84
5853 changed files with 79032 additions and 1825 deletions
+36
View File
@@ -0,0 +1,36 @@
<?php
if (! function_exists('m3_user')) {
/**
* Return the current Core username in the format expected by the legacy M3 data.
* M3 previously depended on PHP Basic Auth and read PHP_AUTH_USER directly.
*/
function m3_user(): string
{
$user = auth()->user();
$value = $user?->username
?? $user?->user_name
?? $user?->name
?? $user?->email
?? request()->server('PHP_AUTH_USER')
?? '';
if (str_contains((string) $value, '@')) {
$value = strstr((string) $value, '@', true) ?: $value;
}
return strtoupper(trim((string) $value));
}
}
if (! function_exists('m3_legacy_password')) {
/**
* Passwords are intentionally unavailable in Core. PostgreSQL access uses
* Laravel's configured connection and never reuses a user's login password.
*/
function m3_legacy_password(): string
{
return '';
}
}