Skip to content
Snippets Groups Projects

fix(term): Restore term click and edit AJAX functionality

Closes #3505219

Merge request reports

Code Quality is loading
Test summary results are being parsed

Closed by Klaus PurerKlaus Purer 5 months ago (Mar 3, 2025 3:00pm UTC)

Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • Klaus Purer added 1 commit

    added 1 commit

    • a68deb0d - prevent fatal errors when term was removed

    Compare with previous version

  • added 1 commit

    • d2af6077 - - Fixes AJAX functionality with media libraries

    Compare with previous version

  • Klaus Purer
  • Klaus Purer
  • Klaus Purer
  • Klaus Purer
  • Klaus Purer
  • Klaus Purer
  • Klaus Purer
  • added 1 commit

    • b89bb42d - check if the taxonomy term exist

    Compare with previous version

  • Tor F. Jacobsen added 2 commits

    added 2 commits

    Compare with previous version

  • added 1 commit

    Compare with previous version

  • added 1 commit

    Compare with previous version

  • added 1 commit

    Compare with previous version

  • added 1 commit

    Compare with previous version

  • added 1 commit

    Compare with previous version

  • added 1 commit

    Compare with previous version

  • added 1 commit

    Compare with previous version

  • added 1 commit

    • 29fa8688 - change term edit form ajax path

    Compare with previous version

  • Klaus Purer
  • Klaus Purer
  • Tor F. Jacobsen added 2 commits

    added 2 commits

    • ab08a7f7 - add taxonomy ajax edit form route to TaxonomyManagerAccessCheck
    • 21270cf0 - use Drupal.url

    Compare with previous version

  • Author Developer

    Thanks, looks good to me!

    I need to do some testing in our project now.

  • Klaus Purer approved this merge request

    approved this merge request

  • Tor F. Jacobsen added 2 commits

    added 2 commits

    • 06485502 - redirect to the taxonomy manager vocabulary page
    • 6771ae25 - remove unused taxonomyTermSubmitHandler function

    Compare with previous version

  • Tor F. Jacobsen reset approvals from @klausi by pushing to the branch

    reset approvals from @klausi by pushing to the branch

  • Tor F. Jacobsen
  • Tor F. Jacobsen
  • Klaus Purer
  • Klaus Purer
  • Author Developer

    just minor coding standard comments

  • Klaus Purer approved this merge request

    approved this merge request

  • added 1 commit

    Compare with previous version

  • Tor F. Jacobsen reset approvals from @klausi by pushing to the branch

    reset approvals from @klausi by pushing to the branch

  • added 1 commit

    • 0948badc - Attach user permissions to drupalSettings for use in JavaScript to avoid...

    Compare with previous version

  • added 1 commit

    • b4c470cd - Only load the form if the user has permission to edit terms

    Compare with previous version

  • added 1 commit

    • 2ff19f72 - make sure that the deleteButton is only used if it exist

    Compare with previous version

  • added 1 commit

    Compare with previous version

  • added 1 commit

    • 9236b0ad - make sure that the deleteButton is only used if it exist

    Compare with previous version

  • Klaus Purer resolved all threads

    resolved all threads

  • 288 $form['load-term-data'] = [
    289 '#type' => 'textfield',
    290 ];
    284 291
    285 /**
    286 * {@inheritdoc}
    287 */
    288 public function taxonomyTermSubmitHandler(array &$form, FormStateInterface $form_state) {
    289 $tid = $form_state->getValue(['search_terms']);
    290 $url = Url::fromRoute('entity.taxonomy_term.edit_form', [
    291 'taxonomy_term' => $tid,
    292 ]);
    293 $form_state->setRedirectUrl($url);
    292 // Attach user permissions to drupalSettings for use in JavaScript.
    293 $form['#attached']['drupalSettings']['taxonomy_manager']['permissions'] = [
    294 'can_edit_terms' => $current_user->hasPermission('edit terms in ' . $taxonomy_vocabulary->id()),
    • Author Developer

      do we need this? I can only open the taxonomy manager if I either have "administer taxonomy" or "edit terms in ..." permission. So all users that can access the term tree already have edit permissions? Or am I missing something?

    • Author Developer

      ah, I see that taxonomy manager checks _entity_create_access for the overview page, which is a little bit wrong ... it should probably check term edit access.

      Not sure if this is worth reporting as security issue, I don't really care?

      Anyway, we also need to check the permission "administer taxonomy" here to be in sync with taxonomy core.

    • Thank you, I fixed that! We do have some users who doesn't have permissions to edit a term but does have access to the taxonomy manager in order to use the tree to browse the terms in a vocabulary.

      But something definitely doesn't seem right about the permissions. Like you said it uses _entity_create_access for the page but when it lazy loads the nested terms in the tree it uses the 'access taxonomy manager list' permissions that seems wrong to me.

    • Tor F. Jacobsen changed this line in version 22 of the diff

      changed this line in version 22 of the diff

    • Please register or sign in to reply
  • added 1 commit

    • 57330cad - add administer taxonomy permission

    Compare with previous version

  • 89 89 _title: 'Edit taxonomy term'
    90 90 requirements:
    91 91 _taxonomy_manager_access_check: 'TRUE'
    92
    93 taxonomy_manager.term_form:
    94 path: '/ajax/taxonomy_manager/term/{tid}/edit'
    95 defaults:
    96 _controller: '\Drupal\taxonomy_manager\Form\TaxonomyManagerForm::termDataCallback'
    97 _title: ''
  • Klaus Purer approved this merge request

    approved this merge request

  • added 1 commit

    • 6f1ec281 - add missing title to term edit form

    Compare with previous version

  • Tor F. Jacobsen reset approvals from @klausi by pushing to the branch

    reset approvals from @klausi by pushing to the branch

  • Author Developer

    merged manually because of broken pipelines.

  • closed

  • Please register or sign in to reply
    Loading