Drupal 10 compatibility

Created on 24 January 2023, almost 2 years ago
Updated 21 November 2023, about 1 year ago

Problem/Motivation

Drupal 10 compatibility

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

πŸ“Œ Task
Status

RTBC

Version

1.0

Component

Vocabulary Permissions Per Role

Created by

πŸ‡§πŸ‡ͺBelgium waropd

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @waropd
  • πŸ‡§πŸ‡ͺBelgium waropd

    Remove core from info.yml

  • First commit to issue fork.
  • @ydbalaji opened merge request.
  • πŸ‡¦πŸ‡·Argentina dariogcode
     $names = taxonomy_vocabulary_get_names();
    

    isn't needed anymore, we can load all vocabulary with just

    $vocabularies = Vocabulary::loadMultiple();
    

    Patch attached.

  • I already used vppr in drupal 10 with patch.
    I had a serious problem:

    When you delete a vocabulary, drupal doesn't revoke permissions from vppr correctly.

    In my case it was very problematic:
    - My role webmaster has the permission "administer [vocabulary name] vocabulary terms"
    - I deleted vocabulary
    - Drupal outputs me:
    RuntimeException: Adding non-existent permissions to a role is not allowed. The incorrect permissions are "administer [vocabulary name] vocabulary terms", "view latest version". in Drupal\user\Entity\Role->calculateDependencies() (line 206 of /var/www/html/web/core/modules/user/src/Entity/Role.php).
    - The role webmaster was remove because dependency to the vocabulary

    I rollback but it can be fatal to another developer.

    In my case to avoid this, I use a revoke permission in a hook_vocabulary_delete :

     $permission = "administer ".$entity->id()." vocabulary terms"
     $roles = Role::loadMultiple();
        foreach ( $roles as $role ){
    
          if( $role->id() === 'administrator'){//not necessary for admin
            continue;
          }
        
            if( $role->hasPermission($permission)){
             
              $role = $role->revokePermission($permission);
              $role->save();
            }
          }
    
        
        }
    
  • πŸ‡©πŸ‡ͺGermany rgpublic DΓΌsseldorf πŸ‡©πŸ‡ͺ πŸ‡ͺπŸ‡Ί

    @Tichris59: But is this a new problem due to the patch? Or is this a general problem/bug with vppr. In the latter case, this should perhaps be files as a new bug, I guess...?

  • General problem with vprr, the permission are not correctly uninstalled when a vocabulary is delete, so we will have runtime exception.

  • Status changed to RTBC about 1 year ago
  • πŸ‡³πŸ‡±Netherlands jaapjan

    Let's mark this as RTBC and perhaps create a separate issue for #9?

    Patch from #8 is the most straight-forward approach to support D10.

    Would be great if a maintainer could take a look at this and create a D10 compatible release accordingly.

  • πŸ‡¬πŸ‡§United Kingdom robcarr Perthshire, Scotland

    Note that the patch at #3336179-8: Drupal 10 compatibility β†’ will only work against the DEV release, not the 8.x-1.2 version

  • πŸ‡ΊπŸ‡ΈUnited States todea

    Is this module still necessary in Drupal 10? Core seems to provide this functionality where you can allow roles to manage specific vocabularies.

Production build 0.71.5 2024