Standalone - Track logged-in user object
authorTim Otten <totten@civicrm.org>
Tue, 27 Jun 2023 08:49:36 +0000 (01:49 -0700)
committerTim Otten <totten@civicrm.org>
Thu, 29 Jun 2023 20:56:02 +0000 (13:56 -0700)
commitebad3d242b53dea4ae8bf85ef1574e5d871c142f
tree832f7c97159b56a3c881543415d37e60bbab4c36
parent468bbc73b9a2c546842955f7fc0cfec5fafc9c22
Standalone - Track logged-in user object

Overview
--------

This is a partial solution for running `E2E_Extern_CliRunnerTest::testPermissionLookup()` on Standalone.

Technical Details
-----------------

The test calls:

```
cv ev --user='admin' 'echo json_encode(CRM_Core_Config::singleton()->userPermissionClass->check("administer CiviCRM", 0));'
```

Internally, this command relies on `CRM_Core_BAO_UFMatch::synchronize()` by way of:

https://github.com/civicrm/cv/blob/59efd9ffefde8dc500643e048d37db90e0de11b7/src/Util/BootTrait.php#L213-L235

Calls to `UFMatch::synchronize($user)` are expected to pass in a user-record.

Before
------

Standalone logins record the active user-ID.

After
------

Standalone logins record the active user-ID and active user-record (which can be supplied to `UFMatch::synchronize()`).
CRM/Utils/System/Standalone.php
ext/standaloneusers/Civi/Authx/Standalone.php