diff --git a/core/modules/taxonomy/src/TermForm.php b/core/modules/taxonomy/src/TermForm.php index d5966ccf017918673b7dc67ab2c37e25d40137bb..ee84dd6995f9e29016deefdc979643bc650fc01e 100644 --- a/core/modules/taxonomy/src/TermForm.php +++ b/core/modules/taxonomy/src/TermForm.php @@ -109,6 +109,7 @@ protected function actions(array $form, FormStateInterface $form_state) { '#value' => $this->t('Save and go to list'), '#weight' => 20, '#submit' => array_merge($element['submit']['#submit'], ['::overview']), + '#access' => $this->currentUser()->hasPermission('access taxonomy overview'), ]; } diff --git a/core/modules/taxonomy/tests/src/Functional/TermTest.php b/core/modules/taxonomy/tests/src/Functional/TermTest.php index 98fa1b65e546761c758b46eb0e355b5ceebc6d40..26137071ab561adf1ea81f3de46b3a31ce279c16 100644 --- a/core/modules/taxonomy/tests/src/Functional/TermTest.php +++ b/core/modules/taxonomy/tests/src/Functional/TermTest.php @@ -56,6 +56,7 @@ protected function setUp(): void { $this->drupalLogin($this->drupalCreateUser([ 'administer taxonomy', + 'access taxonomy overview', 'bypass node access', ])); $this->vocabulary = $this->createVocabulary(); @@ -437,6 +438,15 @@ public function testTermInterface() { // parameter is present. $this->drupalGet('admin/structure/taxonomy/manage/' . $this->vocabulary->id() . '/add', ['query' => ['destination' => 'node/add']]); $this->assertSession()->pageTextNotContains('Save and go to list'); + + // Validate that "Save and go to list" doesn't exist when missing permission + // 'access taxonomy overview'. + $this->drupalLogin($this->drupalCreateUser([ + 'administer taxonomy', + 'bypass node access', + ])); + $this->drupalGet('admin/structure/taxonomy/manage/' . $this->vocabulary->id() . '/add'); + $this->assertSession()->pageTextNotContains('Save and go to list'); } /**