Add a code-only (not changeable via UI) "demo mode" flag that Drupal CMS can set and that future XB MRs can use to constrain XB functionality

Created on 17 December 2024, about 1 month ago

Overview

Drupal CMS (formerly known as Starshot) 1.0 will be released in mid January. We'd like it to include a way for people to enable a "demo version" of Experience Builder. This demo version will be highly constrained. For example, it won't include the ability for people to save. It probably will be limited to editing a single, pre-created by Drupal CMS, Page entity. It will be limited to a small set of curated SDCs. Etc.

To enable this, we'd like this issue to define a "demo mode" flag. Follow up issues will use this flag to constrain the things in XB that we want this flag to constrain.

This flag can be defined as a config setting, a settings.php setting, a service container parameter, a submodule that's either installed or uninstalled, or any other implementation that achieves the following:

  • Drupal CMS needs to be able to set it via a recipe. A recipe can install config but can't execute code directly. However, it can install a module which can execute code.
  • It should be relatively hard for a user of Drupal CMS to unset it. It doesn't necessarily need to be impossible: for example, config can be changed via the config import/export UI, hidden modules can be enabled/disabled via Drush, etc., but we want to make it so that any Drupal CMS user who figures out how to unset it is sufficiently advanced that they can also handle the consequences of using an unconstrained version of XB.

Proposed resolution

User interface changes

✨ Feature request
Status

Active

Version

0.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States effulgentsia

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @effulgentsia
  • πŸ‡§πŸ‡ͺBelgium wim leers Ghent πŸ‡§πŸ‡ͺπŸ‡ͺπŸ‡Ί

    AFAICT a settings.php setting is impossible, because that'd then mean that everybody working on XB would have to set that πŸ˜…

    Based on the requirements in the issue summary, I think the following implementation would make sense:

    • container parameter
    • set by a hidden module
    • which is installed by a recipe

    Tried it and … nope, any already-installed module appears at /admin/modules/uninstall, even if it gains a hidden: true flag. That also means that the hidden submodule choice is equally simple to undo.

    So then … I think still doing what I propose above, but labeling the module or something like that would be reasonable? (Perhaps even without the scary/silly suffix.)

  • πŸ‡ΊπŸ‡ΈUnited States effulgentsia

    I wonder if it would be sensible for a recipe to be able to set a container parameter?

  • πŸ‡§πŸ‡ͺBelgium wim leers Ghent πŸ‡§πŸ‡ͺπŸ‡ͺπŸ‡Ί

    #3: How could it? Recipes can only install config or perform config actions. A container parameter is outside the realm of config.

    Or … is my head so far in baby/diaper/poop land that the poop has affected my thinking? πŸ€£πŸ’©

  • πŸ‡ΊπŸ‡ΈUnited States effulgentsia

    For #3, I was thinking what if the Recipe system could read something from a recipe's yml file and use that to set something in the database that would affect the container parameter. But, I think that's incorrect as you point out. However, instead of setting a container parameter, it could perhaps set state?

    Alternatively, what if "demo mode" is actually the default, and instead there's "canary mode"? In this case, Drupal CMS wouldn't need to set anything, and XB could ship with a hidden xb_canary module that can be enabled via Drush, if you want to unlock XB's full functionality?

  • πŸ‡¬πŸ‡§United Kingdom longwave UK

    > Recipes can only install config or perform config actions.

    So let's just use config? We don't have to provide UI, and in a future version of XB when we want to remove the flag, we can force-remove the config via an update hook.

  • I followed the discussions on this issue and thought of trying to implement it the config ways.Attaching the patch(which is just a POC) for what i tried to disable the preview button for now.

    Any one has any thoughts on this approach?

  • πŸ‡ΊπŸ‡ΈUnited States effulgentsia

    Thanks, @utkarsh_33! I agree with #6. Let's just go with what's simplest which is config. Although it means someone could use the config import UI to change it, they could also use that UI to install a hidden module, so I don't think it's worth us jumping through hoops to do something different than config for this.

    #7 looks pretty good. Only thing is as far as I know, default isn't supported as a config schema instruction. The way to provide default config is to include a config/install/experience_builder.settings.yml file.

  • Pipeline finished with Failed
    15 days ago
    Total: 739s
    #386897
  • Pipeline finished with Success
    15 days ago
    Total: 751s
    #386929
  • πŸ‡§πŸ‡ͺBelgium wim leers Ghent πŸ‡§πŸ‡ͺπŸ‡ͺπŸ‡Ί

    MR reviewed β€” looks very close!

    #6++ β€” as long as there's no UI, it's probably sufficiently difficult to undo. We could rename it to be more obscure/scary, something like demo_mode_drupal_cms_only_do_not_change? πŸ˜…

    Are there other obvious things that should be behind this flag? We don't need to get them all in this issue/MR, but if there's any obvious ones, we can get 'em done here.

  • Addressed the latest feedbacks.Marking it NR again.

  • Pipeline finished with Success
    14 days ago
    Total: 759s
    #388071
  • πŸ‡§πŸ‡ͺBelgium wim leers Ghent πŸ‡§πŸ‡ͺπŸ‡ͺπŸ‡Ί

    LGTM β€” letting @effulgentsia decide if this is ready to merge, or whether he'd like to make the setting name less obvious/more scary πŸ‘» as described in #10.

  • πŸ‡¬πŸ‡§United Kingdom longwave UK

    Tiny naming nit on the MR, otherwise this also looks good to me. Personally I prefer the simple naming and don't think we need any "scary" key name in config here.

  • πŸ‡§πŸ‡ͺBelgium wim leers Ghent πŸ‡§πŸ‡ͺπŸ‡ͺπŸ‡Ί

    @longwave WFM. @effulgentsia can still change it in a trivial follow-up if he feels strongly.

    Still needs sign-off from either @jessebaker, @hooroomoo, @balintbrews or @bnjmnm.

  • Pipeline finished with Skipped
    14 days ago
    #388271
  • πŸ‡§πŸ‡ͺBelgium wim leers Ghent πŸ‡§πŸ‡ͺπŸ‡ͺπŸ‡Ί
  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024