Many Drupal contrib modules have inverse "feature flag" implementations vis-a-vis a killswitch variable added to settings.local.php to disable a feature:
// Killswitch setting. $settings['disable_captcha'] = TRUE; // Config override. $config['google_analytics.settings']['account'] = '';
However, the Drupal 8 version of CAPTCHA does not yet have the
disable_captcha killswitch that existed in Drupal 7 (see related issue #2836076).
The module does have another kind of killswitch via a Drupal permission
skip CAPTCHA. This got me wondering:
Is it possible to dynamically add a permission to the current site visitor—both anonymous or authenticated users—at runtime for a specific environment without affecting the standard roles & permissions store so that configuration management/sync is not adversely affected by the environment-specific permission?
Ideally this logic would be located in settings.local.php to avoid the following risks and technical debt
- the chance that unintended environments would be affected, and
- to have to copy/paste/commit solutions to this problem in every client project only to have to later remove that code once the proper killswitch solution in issue #2836076 lands.