M3 Integration fixes

This commit is contained in:
Mark Gregory
2026-09-21 10:59:32 +01:00
parent b849dd766b
commit 8f66223767
9 changed files with 22 additions and 68 deletions
@@ -11,15 +11,10 @@ use Modules\M3\Services\PostgresProgramBridge;
class UserControlController extends Controller
{
private const AUTH_FAILURE_MESSAGE = 'Could not connect due to wrong user or password.';
private const DATABASE_NOT_FOUND_MESSAGE = 'Database not found. Try WRKRDBDIRE to check.';
private const CONNECTION_ERROR_PREFIX = 'Could not connect. Error: ';
private const PROGRAM_ERROR_PREFIX = 'Error calling program. Code: ';
private const MESSAGE_SEPARATOR = ' Msg: ';
public static function index(Request $request)
{
@@ -176,19 +171,7 @@ class UserControlController extends Controller
} catch (\Throwable $e) {
// Determine reason for failure.
// Probably database authentication error or invalid or unreachable database.
$code = $e->getCode();
$msg = $e->getMessage();
switch ($code) {
case 8001:
// "Authorization failure on distributed database connection attempt"
// Usually means a wrong DB2 user or password
break;
case 42705:
break;
default:
break;
}
return self::programBridgeConnectionError($e);
}
// Add LIB
@@ -250,19 +233,7 @@ class UserControlController extends Controller
try {
$conn = app(PostgresProgramBridge::class);
} catch (\Throwable $e) {
$code = $e->getCode();
$msg = $e->getMessage();
switch ($code) {
case 8001:
// "Authorization failure on distributed database connection attempt"
// Usually means a wrong DB2 user or password
break;
case 42705:
break;
default:
break;
}
return self::programBridgeConnectionError($e);
}
$result = $conn->CLCommand('QSYS/CHGUSRPRF USRPRF(' . $request->R428US_PWD . ') PASSWORD(' . $request->NEW_PASSWORD . ') STATUS(*ENABLED) PWDEXP(*NO)');