Commit 93edf6ae authored by Chris Shantz's avatar Chris Shantz
Browse files

Merge branch '1.0.x' into prod/1.0.x

parents b7fce624 99288cbc
langcode: en
status: true
dependencies: { }
id: uw_lbb_catalog_search
block_id: uw_cbl_catalog_search
category: uw_bc_searches
label: 'Catalog search'
weight: -1
image_path: images/layout_builder_browser/catalogsearch.svg
image_path_base: 'theme:uw_fdsu_theme_resp'
image_alt: 'Catalog search'
icon_base_uri: 'public://media-icons/generic'
iframe_domain: ''
oembed_providers_url: 'https://oembed.com/providers.json'
standalone_url: false
recursive_render_depth: '100'
langcode: en
status: true
dependencies:
module:
- ctools
- taxonomy
id: service_categories_path_pattern
label: 'Service categories path pattern'
type: 'canonical_entities:taxonomy_term'
pattern: 'services/categories/[term:name]'
selection_criteria:
d2892f43-4f34-40e5-9f34-c7524a1e4b42:
id: 'entity_bundle:taxonomy_term'
bundles:
uw_vocab_service_categories: uw_vocab_service_categories
negate: false
context_mapping:
taxonomy_term: taxonomy_term
uuid: d2892f43-4f34-40e5-9f34-c7524a1e4b42
selection_logic: and
weight: 5
relationships: { }
langcode: en
status: true
dependencies:
module:
- ctools
- taxonomy
id: service_tags_path_pattern
label: 'Service tags path pattern'
type: 'canonical_entities:taxonomy_term'
pattern: 'services/tags/[term:name]'
selection_criteria:
9453876f-1845-480e-9311-92449e7d639c:
id: 'entity_bundle:taxonomy_term'
bundles:
uw_vocab_service_tags: uw_vocab_service_tags
negate: false
context_mapping:
taxonomy_term: taxonomy_term
uuid: 9453876f-1845-480e-9311-92449e7d639c
selection_logic: and
weight: 6
relationships: { }
...@@ -27,37 +27,38 @@ class UwNodeAccessCheck implements AccessInterface { ...@@ -27,37 +27,38 @@ class UwNodeAccessCheck implements AccessInterface {
* The access result. * The access result.
*/ */
public function access(RouteMatchInterface $route_match, AccountInterface $account): AccessResult { public function access(RouteMatchInterface $route_match, AccountInterface $account): AccessResult {
$route_name = $route_match->getRouteName(); switch ($route_match->getRouteName()) {
// Menu link edit pages.
// Menu link edit pages. case 'menu_ui.link_edit':
if ($route_name === 'menu_ui.link_edit') { $menu_link_plugin = $route_match->getParameter('menu_link_plugin');
$menu_link_plugin = $route_match->getParameter('menu_link_plugin'); // Only those with permission may edit home page menu entry.
// Only those with permission may edit home page menu entry. if ($menu_link_plugin->getPluginId() === 'uw_base_profile.front_page') {
if ($menu_link_plugin->getPluginId() === 'uw_base_profile.front_page') { return $account->hasPermission('bypass home page protection') ? AccessResult::allowed() : AccessResult::forbidden();
return $account->hasPermission('bypass home page protection') ? AccessResult::allowed() : AccessResult::forbidden(); }
}
else {
// Otherwise, default to access set in menu_admin_per_menu. // Otherwise, default to access set in menu_admin_per_menu.
$menu_admin_per_menu = new MenuAdminPerMenuAccess(); $menu_admin_per_menu = new MenuAdminPerMenuAccess();
return $menu_admin_per_menu->menuLinkAccess($account, $menu_link_plugin); return $menu_admin_per_menu->menuLinkAccess($account, $menu_link_plugin);
}
}
// Node delete pages. // Node delete pages.
if ($route_name === 'entity.node.delete_form') { case 'entity.node.delete_form':
$node = $route_match->getParameter('node'); $node = $route_match->getParameter('node');
// Only those with permission may delete the home page. // Only those with permission may delete the home page.
if ($node && UWService::nodeIsHomePage((int) $node->id())) { if ($node && UWService::nodeIsHomePage((int) $node->id())) {
return $account->hasPermission('bypass home page protection') ? AccessResult::allowed() : AccessResult::forbidden(); return $account->hasPermission('bypass home page protection') ? AccessResult::allowed() : AccessResult::forbidden();
} }
else {
return AccessResult::allowed(); return AccessResult::allowed();
}
}
// Dashboard config: admin/config/dashboards/dashboardssettings. // Dashboard config: admin/config/dashboards/dashboardssettings.
if ($route_name === 'dashboards.dashboards_settings_form') { case 'dashboards.dashboards_settings_form':
return $account->hasPermission('access dashboard config') ? AccessResult::allowed() : AccessResult::forbidden(); return $account->hasPermission('access dashboard config') ? AccessResult::allowed() : AccessResult::forbidden();
// Menu link add, edit, and delete pages.
case 'entity.menu.add_link_form':
case 'entity.menu_link_content.canonical':
case 'entity.menu_link_content.edit_form':
case 'entity.menu_link_content.delete_form':
return $account->hasPermission('administer menu') ? AccessResult::allowed() : AccessResult::forbidden();
} }
// Get the node object, which is in the route match variable. // Get the node object, which is in the route match variable.
......
...@@ -24,6 +24,16 @@ class UwNodeAccessRouteSubscriber extends RouteSubscriberBase { ...@@ -24,6 +24,16 @@ class UwNodeAccessRouteSubscriber extends RouteSubscriberBase {
'entity.node.delete_form', 'entity.node.delete_form',
// Menu link edit pages. // Menu link edit pages.
'menu_ui.link_edit', 'menu_ui.link_edit',
// Menu link add page.
// Path admin/structure/menu/manage/{menu}/add.
'entity.menu.add_link_form',
// Menu link edit page.
// Path admin/structure/menu/item/{menu_link_content}/edit.
'entity.menu_link_content.canonical',
'entity.menu_link_content.edit_form',
// Menu link delete page.
// Path admin/structure/menu/item/{menu_link_content}/delete.
'entity.menu_link_content.delete_form',
]; ];
foreach ($access_route_names as $route_name) { foreach ($access_route_names as $route_name) {
if ($route = $collection->get($route_name)) { if ($route = $collection->get($route_name)) {
......
...@@ -417,7 +417,11 @@ class UWService implements UWServiceInterface { ...@@ -417,7 +417,11 @@ class UWService implements UWServiceInterface {
if (!empty($tabs)) { if (!empty($tabs)) {
foreach ($data as $key => $field) { foreach ($data as $key => $field) {
if (in_array($key, $tabs)) { if (in_array($key, $tabs)) {
$tags[$key] = $this->uwGetTermsFromEntityField($node->$field, 'tags'); $tags_to_add = $this->uwGetTermsFromEntityField($node->$field, 'tags');
if (!empty($tags_to_add)) {
$tags[$key] = $this->uwGetTermsFromEntityField($node->$field, 'tags');
}
} }
} }
} }
...@@ -428,6 +432,7 @@ class UWService implements UWServiceInterface { ...@@ -428,6 +432,7 @@ class UWService implements UWServiceInterface {
case 'tags': case 'tags':
$tags = []; $tags = [];
foreach ($data as $field) { foreach ($data as $field) {
$tags_to_add = $this->uwGetTermsFromEntityField($node->$field, 'tags');
$tags = array_merge($tags, $this->uwGetTermsFromEntityField($node->$field, 'tags')); $tags = array_merge($tags, $this->uwGetTermsFromEntityField($node->$field, 'tags'));
} }
$node_data[$index] = [$tags]; $node_data[$index] = [$tags];
......
...@@ -9,6 +9,7 @@ use Drupal\Component\Utility\Html; ...@@ -9,6 +9,7 @@ use Drupal\Component\Utility\Html;
use Drupal\Core\Access\AccessResult; use Drupal\Core\Access\AccessResult;
use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Form\FormStateInterface; use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Render\Element;
use Drupal\Core\Session\AccountInterface; use Drupal\Core\Session\AccountInterface;
use Drupal\Core\Url; use Drupal\Core\Url;
use Drupal\media_library\MediaLibraryState; use Drupal\media_library\MediaLibraryState;
...@@ -470,11 +471,18 @@ function uw_cfg_common_form_node_uw_ct_web_page_edit_form_alter(array &$form, Fo ...@@ -470,11 +471,18 @@ function uw_cfg_common_form_node_uw_ct_web_page_edit_form_alter(array &$form, Fo
/** /**
* Implements hook_form_FORM_ID_alter(). * Implements hook_form_FORM_ID_alter().
* *
* Menu edit form: admin/structure/menu/manage/main. * Menu edit form: admin/structure/menu/manage/{menu}.
*
* Prevent certain changes to the home page.
*/ */
function uw_cfg_common_form_menu_edit_form_alter(array &$form, FormStateInterface $form_state, string $form_id): void { function uw_cfg_common_form_menu_edit_form_alter(array &$form, FormStateInterface $form_state, string $form_id): void {
// Hide links to menu edit and delete for non-admin.
if (!\Drupal::currentUser()->hasPermission('administer menu')) {
foreach (Element::children($form['links']['links']) as $element_key) {
$form['links']['links'][$element_key]['operations']['#access'] = FALSE;
}
}
// Prevent certain changes to the home page.
//
// No changes for those with access. // No changes for those with access.
if (\Drupal::currentUser()->hasPermission('bypass home page protection')) { if (\Drupal::currentUser()->hasPermission('bypass home page protection')) {
return; return;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment