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, 5 days 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

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.

Production build 0.71.5 2024