From 7f555a15a0f1aae54cab4a4bb7945aa18c09f5b7 Mon Sep 17 00:00:00 2001 From: pookmish Date: Fri, 20 Oct 2023 12:27:52 -0500 Subject: [PATCH] 11.0.0 --- CHANGELOG.md | 24 +++++++++++++++++++++++- src/EventSubscriber/EventSubscriber.php | 16 ++++++++++++---- stanford_profile.info.yml | 2 +- 3 files changed, 36 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e02f4b049..1425e9ddf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,29 @@ # Stanford Profile -10.1.2 +11.0.0 ------------------------------------------------------------------------------- +- Use h2 heading for global message +- D8CORE-6976: updated to newest decanter (#730) +- Update config ignore settings for latest module (#729) +- Update local footer config userguide links (#727) +- Added and configured autoprefixer for css compiler +- Updated search api config +- Fixed related policies to avoid self referencing +- SDSS-1007: Add support for global footer variant. (#724) +- Added su-masthead-inner class to masthead
. (#725) +- D8CORE-6895: updates for new Decanter and updating webpack (#710) +- D8CORE-6951 D10 Clean up admin toolbar (#723) +- D8CORE-6952: changed to list style none (#719) +- D8CORE-6953: Additional edits to the editing buttons (#722) +- Display field copy released a D10 version +- Lifecycle management contact fields +- D8CORE-6953: fixes to local task tabs (#720) +- D8CORE-6977 Switch to use CSHS instead of simple heiracry select (#721) +- D8CORE-6984 include policy content in sitemap +- D8CORE-3718 Minor a11y issues for decoupled main menu +- Updated user mail attribute value for samlauth +- Drupal 10 Config & test updates (#705) +- D10 Install 10.1.1 ------------------------------------------------------------------------------- diff --git a/src/EventSubscriber/EventSubscriber.php b/src/EventSubscriber/EventSubscriber.php index 0fceca2be..9dd576fd9 100644 --- a/src/EventSubscriber/EventSubscriber.php +++ b/src/EventSubscriber/EventSubscriber.php @@ -21,6 +21,7 @@ use Symfony\Component\EventDispatcher\EventSubscriberInterface; use Symfony\Component\HttpFoundation\RedirectResponse; use Symfony\Component\HttpKernel\Event\RequestEvent; +use Symfony\Component\HttpKernel\HttpKernelInterface; use Symfony\Component\HttpKernel\KernelEvents; /** @@ -116,6 +117,7 @@ public function onKernelRequest(RequestEvent $event) { $current_uri = $event->getRequest()->getRequestUri(); if ( + $event->getRequestType() == HttpKernelInterface::MAIN_REQUEST && $current_uri != '/admin/config/system/basic-site-settings' && self::redirectUser() ) { @@ -132,23 +134,29 @@ public function onKernelRequest(RequestEvent $event) { * Redirect the user. */ protected static function redirectUser() { + $current_user = \Drupal::currentUser(); $cache = \Drupal::cache(); - if ($cache_data = $cache->get('su_renew_site')) { + if ($cache_data = $cache->get('su_renew_site:' . $current_user->id())) { return $cache_data->data; } + /** @var \Drupal\Core\Routing\CurrentRouteMatch $route_match */ + $route_match = \Drupal::service('current_route_match'); + $name = $route_match->getCurrentRouteMatch()->getRouteName(); + /** @var \Drupal\config_pages\ConfigPagesLoaderServiceInterface $config_page_loader */ $config_page_loader = \Drupal::service('config_pages.loader'); $renewal_date = $config_page_loader->getValue('stanford_basic_site_settings', 'su_site_renewal_due', 0, 'value') ?: date(DateTimeItemInterface::DATETIME_STORAGE_FORMAT); // Check for config page edit access and ignore if the user is an // administrator. That way devs don't get forced into submitting the form. - $current_user = \Drupal::currentUser(); + $site_manager = $current_user->hasPermission('edit stanford_basic_site_settings config page entity') && !in_array('administrator', $current_user->getRoles()); + $ignore_routes = ['system.css_asset', 'system.js_asset']; // If the renewal date has passed, they should be redirected. - $needs_renewal = !getenv('CI') && $site_manager && (strtotime($renewal_date) - time() < 60 * 60 * 24); - $cache->set('su_renew_site', $needs_renewal, time() + 60 * 60 * 24); + $needs_renewal = !in_array($name, $ignore_routes) && !getenv('CI') && $site_manager && (strtotime($renewal_date) - time() < 60 * 60 * 24); + $cache->set('su_renew_site:' . $current_user->id(), $needs_renewal, time() + 60 * 60 * 24); return $needs_renewal; } diff --git a/stanford_profile.info.yml b/stanford_profile.info.yml index 248edc78d..c611fe219 100644 --- a/stanford_profile.info.yml +++ b/stanford_profile.info.yml @@ -1,6 +1,6 @@ name: 'Stanford Profile' description: 'Jumpstart Website Profile' -version: 10.1.2 +version: 11.0.0 type: profile project: Stanford core_version_requirement: ^9 || ^10