diff --git a/includes/admin.inc b/includes/admin.inc
index 22e5bc95..0c1f36ef 100644
--- a/includes/admin.inc
+++ b/includes/admin.inc
@@ -2744,6 +2744,11 @@ function views_ui_standard_display_dropdown(&$form, &$form_state, $section) {
return;
}
+ $defaultable_sections = $current_display->handler->defaultable_sections($section);
+ if (!empty($defaultable_sections)) {
+ $section = array_shift($defaultable_sections);
+ }
+
// Determine whether any other displays have overrides for this section.
$section_overrides = FALSE;
$section_defaulted = $current_display->handler->is_defaulted($section);
diff --git a/plugins/views_plugin_display.inc b/plugins/views_plugin_display.inc
index fd8de19e..e8f66a6b 100644
--- a/plugins/views_plugin_display.inc
+++ b/plugins/views_plugin_display.inc
@@ -2600,7 +2600,12 @@ class views_plugin_display extends views_plugin {
* If override/revert was clicked, perform the proper toggle.
*/
public function options_override($form, &$form_state) {
- $this->set_override($form_state['section']);
+ $section = $form_state['section'];
+ $defaultable_sections = $this->defaultable_sections($section);
+ if (!empty($defaultable_sections)) {
+ $section = array_shift($defaultable_sections);
+ }
+ $this->set_override($section);
}
/**
diff --git a/tests/views_ui.test b/tests/views_ui.test
index 8a7e0e16..e00298a8 100644
--- a/tests/views_ui.test
+++ b/tests/views_ui.test
@@ -1037,4 +1037,73 @@ class ViewsUIWizardOverrideDisplaysTestCase extends ViewsUIWizardHelper {
$this->assertText($view['page[title]']);
}
+ /**
+ * Test multiple overridden page displays with different permissions.
+ */
+ function testPageDisplaysWithDifferentPermissions() {
+ // Create a basic view with no displays.
+ $view['human_name'] = $this->randomName(16);
+ $view['name'] = strtolower($this->randomName(16));
+ $view['page[create]'] = FALSE;
+ $view['block[create]'] = FALSE;
+
+ $this->drupalPost('admin/structure/views/add', $view, t('Continue & edit'));
+
+ // Add 4 page displays. Using different permissions for each one.
+ $displays = array(
+ 'page_1' => 'administer modules',
+ 'page_2' => 'administer nodes',
+ 'page_3' => 'access content',
+ 'page_4' => 'bypass node access',
+ );
+
+ foreach ($displays as $display => $permission) {
+ // Add a new Page, Set it permissions to 'administer modules'.
+ $edit = array();
+ $this->drupalPost("admin/structure/views/view/{$view['name']}/edit", $edit, t('Add Page'));
+
+ $edit = array(
+ 'path' => "my-path",
+ );
+ $this->drupalPost("admin/structure/views/nojs/display/{$view['name']}/$display/path", $edit, t('Apply'));
+
+ $edit = array(
+ 'override[dropdown]' => $display,
+ 'access_options[perm]' => $permission,
+ );
+ $this->drupalPost("admin/structure/views/nojs/display/{$view['name']}/$display/access_options", $edit, t('Apply'));
+ }
+
+ // Save all the displays.
+ $this->drupalPost("admin/structure/views/view/{$view['name']}/edit/page_4", array(), t('Save'));
+
+ foreach ($displays as $display => $permission) {
+ $this->drupalGet("admin/structure/views/nojs/display/{$view['name']}/$display/access_options");
+ // Check the permissions are the same after save all the displays.
+ $this->assertOptionSelected('edit-access-options-perm', $permission);
+ }
+
+ // Now set page_1, page_2, and page_4 to defaults
+ foreach (array('page_1', 'page_2', 'page_4') as $display) {
+ $edit = array(
+ 'override[dropdown]' => 'default',
+ 'access_options[perm]' => 'administer nodes',
+ );
+ $this->drupalPost("admin/structure/views/nojs/display/{$view['name']}/$display/access_options", $edit, t('Apply'));
+ }
+
+ // Save all the displays
+ $this->drupalPost("admin/structure/views/view/{$view['name']}/edit/page_4", array(), t('Save'));
+
+ // Finally check that only 'page_3' have a different permission assigned.
+ foreach (array('page_1', 'page_2', 'page_3', 'page_4') as $display) {
+ $this->drupalGet("admin/structure/views/nojs/display/{$view['name']}/$display/access_options");
+ $permission = 'administer nodes';
+ if ($display == 'page_3') {
+ $permission = 'access content';
+ }
+ $this->assertOptionSelected('edit-access-options-perm', $permission);
+ }
+ }
+
}
diff --git a/views.install b/views.install
index 92c7abc1..a1e57426 100644
--- a/views.install
+++ b/views.install
@@ -648,3 +648,15 @@ function views_update_7302() {
db_drop_field('cache_views_data', 'headers');
}
}
+
+/**
+ * Show a recommendation to the user to check the configuration of their views'
+ * access control settings.
+ *
+ * @see https://www.drupal.org/project/views/issues/1174588
+ */
+function views_update_7303() {
+ return t("Previously when changing access settings on a view display it could unexpectedly change the setting on other non-overridden displays of that view.
+ This issue has now been fixed, however it is recommended that you check all your views' access settings under 'Page settings > Access' are correct.
+ If any views have 'Permissions' set for 'All displays' and 'View published content' set for 'This page (override)', change them so that they are both set to the same option.");
+}