- Issue created by @holo96
- Status changed to Needs review
3 months ago 1:18pm 13 May 2025 - π·πΈSerbia holo96
I guess I am only one needing this :)
I've updated forkI am willing to improve it based on maintainers feedback.
- πΊπΈUnited States trackleft2 Tucson, AZ πΊπΈ
Thank you for your inquiry, I've updated the issue summary. I welcome a merge request
- πΊπΈUnited States trackleft2 Tucson, AZ πΊπΈ
I've set a release target for π± Draft: Release Plan for Environment Indicator Minor Release 5.0.0-beta1 Active
- π·πΈSerbia holo96
Updated merge request to match newest additions
Updated README - Merge request !134Draft: Resolve #3495410 "Unrestriced access 5.0.x" β (Open) created by trackleft2
- πΊπΈUnited States trackleft2 Tucson, AZ πΊπΈ
Hi @holo96,
In light of β¨ Performance Improvements Active , I think we should take a slightly different approach.
Rather than putting hasAccess() on the service, Iβd propose a new helper in environment_indicator.module that calls less heavy functions like this:
/** * Check if user has access to environment indicator. * * This function checks both the traditional permission and the new * unrestricted access setting. * * @return \Drupal\Core\Session\AccountProxyInterface|false * The current user account if access is granted, FALSE otherwise. */ function _environment_indicator_has_access() { $account = \Drupal::currentUser(); // Check if unrestricted access is enabled in settings.php. if (Settings::get('environment_indicator_unrestricted_access', FALSE)) { return $account; } // Fall back to traditional permission check. if ($account->hasPermission('access environment indicator')) { return $account; } return FALSE; }
See https://git.drupalcode.org/project/environment_indicator/-/merge_request...
Additionally, I think we should find a way to let users know that they have this setting set in settings.php.
From my perspective, site admins will likely not remember they have this setting set in settings.php and will begin pulling their hair out.
I think we should add a notice on the `/admin/config/development/environment-indicator` page if the setting is enabled.
Additionally, I think we should add some PHPUnit tests so we can feel confident about the feature functioning as expected in future updates.