I am seeing errors caused by the core Drupal\contact\Access access check: our site uses a sitewide contact form with contact storage, but no users have personal contact forms enabled. However - because the administrator role inherits all permissions - administrators still see a tab for a non-existent contact form. If you click it, you generate an error (in the contact_storage module). Resolving that error with the patch in https://www.drupal.org/project/contact_storage/issues/3055176 causes error further down the stack:
The website encountered an unexpected error. Please try again later.</br></br><em class="placeholder">Drupal\Component\Plugin\Exception\PluginNotFoundException</em>: The "entity:contact_message:personal" plugin does not exist. in <em class="placeholder">Drupal\Core\Plugin\DefaultPluginManager->doGetDefinition()</em> (line <em class="placeholder">52</em> of <em class="placeholder">core/lib/Drupal/Component/Plugin/Discovery/DiscoveryTrait.php</em>). <pre class="backtrace">Drupal\Core\Plugin\DefaultPluginManager->getDefinition('entity:contact_message:personal') (Line: 287)
Drupal\Core\TypedData\TypedDataManager->getCanonicalRepresentation(Object) (Line: 138)
Drupal\Core\TypedData\Validation\RecursiveContextualValidator->validateNode(Object, NULL, 1) (Line: 99)
Drupal\Core\TypedData\Validation\RecursiveContextualValidator->validate(Object, NULL, NULL) (Line: 90)
Drupal\Core\TypedData\Validation\RecursiveValidator->validate(Object) (Line: 131)
Drupal\Core\TypedData\TypedData->validate() (Line: 488)
Drupal\Core\Entity\ContentEntityBase->validate() (Line: 192)
Drupal\Core\Entity\ContentEntityForm->validateForm(Array, Object) (Line: 194)
Drupal\contact\MessageForm->validateForm(Array, Object)
call_user_func_array(Array, Array) (Line: 82)
Drupal\Core\Form\FormValidator->executeValidateHandlers(Array, Object) (Line: 275)
Drupal\Core\Form\FormValidator->doValidateForm(Array, Object, 'contact_message_personal_form') (Line: 118)
Drupal\Core\Form\FormValidator->validateForm('contact_message_personal_form', Array, Object) (Line: 575)
Drupal\Core\Form\FormBuilder->processForm('contact_message_personal_form', Array, Object) (Line: 318)
Drupal\Core\Form\FormBuilder->buildForm('contact_message_personal_form', Object) (Line: 48)
Drupal\Core\Entity\EntityFormBuilder->getForm(Object) (Line: 117)
Drupal\contact\Controller\ContactController->contactPersonalPage(Object)
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 582)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 124)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 151)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 68)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 57)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 99)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 78)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 52)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 696)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)The core Access seems to deliberately check for the permission (with a comment "User administrators should always have access to personal contact forms.") BEFORE it checks if the contact page is enabled. I'm not sure I understand the logic of this, as either administrators or the users themselves have decided that the users should NOT have a contact form.
Comments
Comment #2
mrdalesmith commentedComment #3
jibranComment #4
avpadernoComment #8
larowlanI think this was resolved by #602234: Don't allow admin users to access their own contact form