Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Afform - Require Authx #23767

Merged
merged 1 commit into from
Jul 20, 2022
Merged

Afform - Require Authx #23767

merged 1 commit into from
Jul 20, 2022

Conversation

colemanw
Copy link
Member

Overview

Form Builder (Afform) depends on functionality provided by the Authx extension. This adds it as a requirement.

Before

Afform doesn't require Authx but if you don't install it, email tokens won't work, and neither will form submissions in some cases.

After

Required.

@civibot
Copy link

civibot bot commented Jun 11, 2022

(Standard links)

@civibot civibot bot added the master label Jun 11, 2022
@totten
Copy link
Member

totten commented Jun 13, 2022

What happens if you have (say) CiviCRM 5.48 with authx=disabled and afform=enabled then upgrade to this?

@colemanw
Copy link
Member Author

This is what happens:
image

@totten
Copy link
Member

totten commented Jul 20, 2022

OK, so I ran through a few upgrade paths from 5.45 (starting with various permutations of afform={on,off}, authx={on,off} and CiviGrant={on,off}). Basically, they were OK, but I have few notes.

  1. In the case where we need the status-message (eg you start with startVer=5.45, afform=on, authx=off, CiviGrant=off; then see "Form Core... missing dependency..."), I did see the status-message. 👍 However, the page-footer incorrectly reported "System Status: Ok". Investigated and split off Status Check - Report the overall status (accurately) #24027.

  2. An interesting scenario: startVer=5.45, afform=off, authx=off, CiviGrant=on It will enable civigrant and then (transitively) enable both afform and authx. I wasn't thinking about CiviGrant (initially), so I didn't expect this, but it's an appropriate outcome. 👍 (I would guess that an upgrade from 5.47 or newer wouldn't be quite as clever -- it would just get the same status warning as above.)

  3. However, there were some quirks in that scenario. I did a few trials (eg with CLI and with web UI) and noted quirks along the way:

    • With CLI: The system-status wouldn't render until I ran cv ext:upgrade-db. (But I think this is a pre-existing issue; not relevant to this PR.)

    • With web UI: After finishing the upgrade, the dashboard showed a warning:

      Warning: in_array() expects parameter 2 to be array, null given in Civi\Afform\StatusChecks::hook_civicrm_check() (line 53 of /Users/totten/bknix/build/dmaster/web/sites/all/modules/civicrm/ext/afform/core/Civi/Afform/StatusChecks.php).

    • With web UI: Again, the system-status wouldn't render until I ran ext upgrade via civicrm/admin/extensions. (Same as above.) But after running the update, the system-status showed an unexpected warnings:

      Email token support has been configured for 1 form(s). This requires JWT authentication, authx_auto_cred does not include JWT.

      But this warning clears up after another system flush.

    • I think these last two warnings are the same problem: the default values for authx_* settings aren't initially loading, so they appear as NULL. Any assertions about authx_* settings then get (temporarily) weird/unexpected data. But once you reload metadata, the defaults get cleared up.

  4. In one pass at r-run, I seemed to get stuck in a condition where the system-status wouldn't render, and cv ext:upgrade-db wouldn't execute. (There was a managed-entity conflict blocking it.) However, I haven't been able to reproduce it since. It could've been a mistake/fluke in my testing. But if anyone else gets it, then maybe it merits a closer look.

I'll fire a new Jenkins run and give it "merge ready" because I don't think these issues are the fault of this patch. However, I'm not really certain about (3) -- the authx_* settings could be a new issue.

@totten
Copy link
Member

totten commented Jul 20, 2022

jenkins, test this please

@totten totten added the merge ready PR will be merged after a few days if there are no objections label Jul 20, 2022
@totten
Copy link
Member

totten commented Jul 20, 2022

FWIW, when I combined this with #24030, it seemed to resolve the issues under (3).

@totten totten merged commit 6ebfc7f into civicrm:master Jul 20, 2022
@colemanw colemanw deleted the afformRequireAuthx branch July 21, 2022 00:25
@colemanw
Copy link
Member Author

@totten that looks good.
FYI I think simply displaying a system status warning is fine in this case because the Afform dependency on AuthX is "soft" (i.e. doesn't cause a crash if missing). However, if we were to introduce a harder dependency, then the site might not even be functional enough to see a system status message. Something to ponder for the future...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
master merge ready PR will be merged after a few days if there are no objections
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants