Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

11.0.0 #732

Merged
merged 1 commit into from
Oct 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 23 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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 <section>. (#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
-------------------------------------------------------------------------------
Expand Down
16 changes: 12 additions & 4 deletions src/EventSubscriber/EventSubscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/**
Expand Down Expand Up @@ -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()
) {
Expand All @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion stanford_profile.info.yml
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Loading