Problem/Motivation
The group permissions tab is crashing if more than one group is available
Steps to reproduce
- 1. Install group_permissions in Drupal 9.2.0
- 2. Create a group type
- 3. Create a new group -> group permissions tab work well
- 4. Create a second group -> group permissions tabs crashed
An Error ist thrown in the validate funtion of the UniqueReferenceFieldValidator.php
/modules/contrib/group_permissions/src/Plugin/Validation/Constraint/UniqueReferenceFieldValidator.php
Proposed resolution
The problem seems the query inside the validate function (maybe there are parameters missing). Change the SQL-query so the function validates correctly
Error: Call to undefined method Drupal\Core\Entity\ContentEntityType::getLowercaseLabel() in Drupal\group_permissions\Plugin\Validation\Constraint\UniqueReferenceFieldValidator->validate() (Zeile 44 in /home/www/example_site/apps/intranet/web/modules/contrib/group_permissions/src/Plugin/Validation/Constraint/UniqueReferenceFieldValidator.php)
#0 /home/www/example_site/apps/intranet/web/core/lib/Drupal/Core/TypedData/Validation/RecursiveContextualValidator.php(196): Drupal\group_permissions\Plugin\Validation\Constraint\UniqueReferenceFieldValidator->validate()
#1 /home/www/example_site/apps/intranet/web/core/lib/Drupal/Core/TypedData/Validation/RecursiveContextualValidator.php(148): Drupal\Core\TypedData\Validation\RecursiveContextualValidator->validateConstraints()
#2 /home/www/example_site/apps/intranet/web/core/lib/Drupal/Core/TypedData/Validation/RecursiveContextualValidator.php(158): Drupal\Core\TypedData\Validation\RecursiveContextualValidator->validateNode()
#3 /home/www/example_site/apps/intranet/web/core/lib/Drupal/Core/TypedData/Validation/RecursiveContextualValidator.php(100): Drupal\Core\TypedData\Validation\RecursiveContextualValidator->validateNode()
#4 /home/www/example_site/apps/intranet/web/core/lib/Drupal/Core/TypedData/Validation/RecursiveValidator.php(90): Drupal\Core\TypedData\Validation\RecursiveContextualValidator->validate()
#5 /home/www/example_site/apps/intranet/web/core/lib/Drupal/Core/TypedData/TypedData.php(132): Drupal\Core\TypedData\Validation\RecursiveValidator->validate()
#6 /home/www/example_site/apps/intranet/web/core/lib/Drupal/Core/Entity/ContentEntityBase.php(489): Drupal\Core\TypedData\TypedData->validate()
#7 /home/www/example_site/apps/intranet/web/modules/contrib/group_permissions/src/Form/GroupPermissionsForm.php(126): Drupal\Core\Entity\ContentEntityBase->validate()
#8 [internal function]: Drupal\group_permissions\Form\GroupPermissionsForm->buildForm()
#9 /home/www/example_site/apps/intranet/web/core/lib/Drupal/Core/Form/FormBuilder.php(532): call_user_func_array()
#10 /home/www/example_site/apps/intranet/web/core/lib/Drupal/Core/Form/FormBuilder.php(278): Drupal\Core\Form\FormBuilder->retrieveForm()
#11 /home/www/example_site/apps/intranet/web/core/lib/Drupal/Core/Controller/FormController.php(73): Drupal\Core\Form\FormBuilder->buildForm()
#12 [internal function]: Drupal\Core\Controller\FormController->getContentResult()
#13 /home/www/example_site/apps/intranet/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array()
#14 /home/www/example_site/apps/intranet/web/core/lib/Drupal/Core/Render/Renderer.php(578): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#15 /home/www/example_site/apps/intranet/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(124): Drupal\Core\Render\Renderer->executeInRenderContext()
#16 /home/www/example_site/apps/intranet/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(97): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext()
#17 /home/www/example_site/apps/intranet/vendor/symfony/http-kernel/HttpKernel.php(158): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#18 /home/www/example_site/apps/intranet/vendor/symfony/http-kernel/HttpKernel.php(80): Symfony\Component\HttpKernel\HttpKernel->handleRaw()
#19 /home/www/example_site/apps/intranet/web/core/lib/Drupal/Core/StackMiddleware/Session.php(57): Symfony\Component\HttpKernel\HttpKernel->handle()
#20 /home/www/example_site/apps/intranet/web/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(47): Drupal\Core\StackMiddleware\Session->handle()
#21 /home/www/example_site/apps/intranet/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(106): Drupal\Core\StackMiddleware\KernelPreHandle->handle()
#22 /home/www/example_site/apps/intranet/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(85): Drupal\page_cache\StackMiddleware\PageCache->pass()
#23 /home/www/example_site/apps/intranet/web/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(47): Drupal\page_cache\StackMiddleware\PageCache->handle()
#24 /home/www/example_site/apps/intranet/web/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(52): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle()
#25 /home/www/example_site/apps/intranet/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle()
#26 /home/www/example_site/apps/intranet/web/core/lib/Drupal/Core/DrupalKernel.php(716): Stack\StackedHttpKernel->handle()
#27 /home/www/example_site/apps/intranet/web/index.php(19): Drupal\Core\DrupalKernel->handle()
#28 {main}
Issue fork group_permissions-3221828
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
martinelkb commentedComment #3
martinelkb commentedComment #7
lobsterr commentedThank you for your contribution