Skip to content

CmsBootstrap - Fix handling of --user on Standalone and Backdrop#283

Merged
totten merged 4 commits intocivicrm:masterfrom
totten:master-cmsboot-user
Jan 20, 2026
Merged

CmsBootstrap - Fix handling of --user on Standalone and Backdrop#283
totten merged 4 commits intocivicrm:masterfrom
totten:master-cmsboot-user

Conversation

@totten
Copy link
Member

@totten totten commented Jan 20, 2026

Consider commands like this:

cv url -L --user=admin civicrm/admin
cv http -L --user=admin civicrm/admin

This fixes bugs when running those on Standalone and Backdrop.

Before

The success depends on the bootstrap mechanism, e.g.

  • Older bootstrap (e.g. --level=full; Bootstrap.php) ==> 🟢
  • Newer bootstrap (e.g. --level=cms-full; CmsBootstrap.php) ==> 🔴

The failure shows a message like:

The "--login" option requires specifying an active user/contact ("--user=X").                                                                           

The message is confusing because you have already requested --user=admin... it's just that the --user option isn't working.

I believe the real problems are:

  • For Standalone, CmsBootstrap is trying to manipulate $loggedInUserId, and there seems to be some subtlety/brittleness in how this variable works.
  • For Backdrop, user_load() doesn't seem to work with those arguments.

After

  • For Standalone, switch to authx_login(), which has more core test-coverage.

    (Note: Ordinarily, I would hesitate about calling authx_* from a low-level class like CmsBootstrap, as we're not guaranteed to have authx everywhere. But Standalone, it should be guaranteed.)

  • For Backdrop, switch to user_load_by_name().

Comment

@totten totten changed the title CmsBootstrap - Fix handling of --user on Standalone CmsBootstrap - Fix handling of --user on Standalone and Backdrop Jan 20, 2026
@totten totten merged commit d877283 into civicrm:master Jan 20, 2026
1 check passed
@totten totten deleted the master-cmsboot-user branch January 20, 2026 06:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant