Verified Commit 16da1ce8 authored by Lauri Timmanee's avatar Lauri Timmanee
Browse files

Issue #3347816 by mpp, AlexGreen, lauriii: Only show link to taxonomy overview when user has access

parent 15cde9a5
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -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'),
      ];
    }

+10 −0
Original line number Diff line number Diff line
@@ -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');
  }

  /**