I am using Webform on D10 with CKE5. A user noticed that they are no longer able to edit the "Form open message" (and similar) filed and instead see the error message "This field has been disabled because you do not have sufficient permissions to edit it." The user in question has a fairly high level of permission on the site.
After some digging, it seems that this notice appears when a user does not have permissions to use a text format. In the Webform settings if I change the "Element text format" from "Default" to one of my custom text formats, this error message goes away.
I've read that there is now a "webform_default" text format that is meant to be used only in Webform and is not accessible anywhere else. It seems like what is happening is this user does not have permissions to use that. I have gone through the various Webform permissions available, and none of them seem to make this error go away. This leads me to believe that there is a bug in Webform.
| Comment | File | Size | Author |
|---|---|---|---|
| #19 | webform-post-update-skip-when-format-is-missing-3404493-18.patch | 1.18 KB | berdir |
| Screenshot 2023-11-27 at 5.12.17 PM.png | 86.34 KB | srdtwc |
Issue fork webform-3404493
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
jrockowitz commentedAre you able to replicate the issue using a plain vanilla instance of Drupal?
I am willing to bet that the updated configuration for the new webform_default filter was not properly exported.
You should compare the configuration on a working plain vanilla instance of Drupal to your instance of Drupal.
Comment #3
berdirWe are seeing this as well.
Interestingly, something seems to have changed, a new install on 6.2 seems to correctly grant authenticated the permission for that format, while updated sites do not. And on 6.2.0-beta6 that we have some sites on, neither seems to work, new install nor update. The site with 6.2 is also on Drupal core 10.2, not sure if that's involved.
The roles property is special, it only is used at install time and set in \Drupal\filter\Entity\FilterFormat::postSave(). The problem is that you use the low-level config storage API to write that config directly, bypassing config entity hooks and other processing.
Config imports must go through the config entity api layer, there's a special API for it, which looks a bit like this:
(copy pasted together from some helper functions in our install profile).
Plus extra logic when updating, but I guess you don't need that with the delete approach.
Comment #4
berdirAh, I realized that I was looking the code between beta6 or so and 6.2.0 does mostly use that API (except using createFromStorage()), but that didn't account for sites that were already using a broken beta version.
We're working on a patch that adds a new post update to make sure this also works for these sites. 6.2.0-beta6 was out there for long time, still has 20k installs and I imagine a lot of the 40k 6.2.0 installs updated from beta.
Comment #5
mathilde_dumond commentedI tried my hand at a patch.
I could update from beta7 to 6.2.0 and have the correct permissions set.
Comment #6
mathilde_dumond commentedComment #7
berdiryou can also use grant_permissions(), then the argument is a bit easier and don't need '=> TRUE').
Comment #9
berdirWe tested this on our projects.
Comment #11
jrockowitz commentedComment #12
jrockowitz commentedComment #13
ammaletu commentedI just updated to webforms module version 6.2.1, and now our deploy process stops at the first step, with the database updates:
> [notice] Update started: webform_post_update_authenticated_user_permission
> [error] Adding non-existent permissions to a role is not allowed. The incorrect permissions are "use text format webform_default".
> [error] Update failed: webform_post_update_authenticated_user_permission
[error] Update aborted by: webform_post_update_authenticated_user_permission
[error] Finished performing updates.
Any ideas how to get this working?
I checked and the new webform text format does not exist. Whose job would it have been to create it? We are on Drupal 10.1.7, but are still using CKEditor 4.
Comment #14
berdirfrom which version did you update? The text format should have been created by another post update. post updates don't have a dependency, so maybe this one did run first?
We could harden the post update to check if the text format exists before trying to add the permission?
Comment #15
daltyn commentedRunning into the same issue as #13. tried using 6.2.1 and 6.2.x-dev
Comment #16
dafydd owenWe also ran into this issue and like Berdir mentions we think the updates are applying in an order that prevents the new permission assignment from completing correctly.
Commenting out;
in /modules/contrib/webform/webform.post_update.php does allow the updates to proceed.
We then ran the updates again with that final update available and it applied cleanly.
Comment #17
jrockowitz commentedLet's reopen this and make the needed changes. Then, I will tag a new release.
Comment #19
berdirOk, I think post updates are alphabetically sorted, so sites updating from 6.1 will reliably run this one first.
We could rename, but we really only care about this one for sites that did intermediate updates to/from 6.2 beta versions, so I think it's fine if we just add a check on the text format existing, if not, we can safely skip as the improved other function will now actually assign the permission.
Created a MR for this and also as a patch, to apply it with composer if necessary.
Comment #20
alex.skrypnyk@berdir
Thank you for adding the patch. I can confirm that the patch fixes the issue. We have several upgrade test (based on
UpdatePathTestBase) that started to fail and this patch has resolved issues.@jrockowitz
Is there any chance to get this release soon so that we do not have to drag this patch through projects.
Comment #22
jrockowitz commentedI tagged a new release.
@berdir thank you
Comment #24
mchamps commentedAfter updating to Webform lastest version : composer require 'drupal/webform:^6.2'
When I run drush updb I get the following error:
I'm running
Drupal version : 10.1.7
Drush version : 12.4.3.0
PHP version : 8.1.22
Cheers
Thanks
Comment #25
berdirNo idea what those errors mean. Run drush with -vvv or so to see backtraces and more details.
Comment #26
mchamps commenteddrush updb -vvv
[preflight] Redispatch to site-local Drush: '/home/clients/b1fb8301c36d715ffc1f2723d230ea52/sites/uat/vendor/drush/drush/drush'.
[preflight] Config paths: /home/clients/b1fb8301c36d715ffc1f2723d230ea52/sites/uat/vendor/drush/drush/drush.yml
[preflight] Alias paths: /home/clients/b1fb8301c36d715ffc1f2723d230ea52/sites/uat/web/drush/sites,/home/clients/b1fb8301c36d715ffc1f2723d230ea52/sites/uat/drush/sites
[preflight] Commandfile search paths: /home/clients/b1fb8301c36d715ffc1f2723d230ea52/sites/uat/vendor/drush/drush/src
[info] Starting bootstrap to full [0.38 sec, 9.67 MB]
[info] Drush bootstrap phase 5 [0.38 sec, 9.67 MB]
[info] Try to validate bootstrap phase 5 [0.38 sec, 9.67 MB]
[info] Try to validate bootstrap phase 5 [0.38 sec, 9.67 MB]
[info] Try to bootstrap at phase 5 [0.38 sec, 9.67 MB]
[info] Drush bootstrap phase: bootstrapDrupalRoot() [0.38 sec, 9.67 MB]
[info] Change working directory to /home/clients/-----/sites/uat/web [0.38 sec, 9.67 MB]
[info] Initialized Drupal 10.1.7 root directory at /home/clients/-----/sites/uat/web [0.38 sec, 9.72 MB]
[info] Try to validate bootstrap phase 5 [0.38 sec, 9.72 MB]
[info] Try to bootstrap at phase 5 [0.38 sec, 10.16 MB]
[info] Drush bootstrap phase: bootstrapDrupalSite() [0.38 sec, 10.16 MB]
[debug] Could not find a Drush config file at sites/default/drush.yml. [0.39 sec, 10.33 MB]
[info] Initialized Drupal site default at sites/default [0.39 sec, 10.33 MB]
[info] Try to validate bootstrap phase 5 [0.39 sec, 10.33 MB]
[info] Try to bootstrap at phase 5 [0.39 sec, 10.33 MB]
[info] Drush bootstrap phase: bootstrapDrupalConfiguration() [0.39 sec, 10.33 MB]
[info] Try to validate bootstrap phase 5 [0.39 sec, 10.58 MB]
[info] Try to bootstrap at phase 5 [0.4 sec, 11.16 MB]
[info] Drush bootstrap phase: bootstrapDrupalDatabase() [0.4 sec, 11.16 MB]
[info] Successfully connected to the Drupal database. [0.4 sec, 11.16 MB]
[info] Try to validate bootstrap phase 5 [0.4 sec, 11.16 MB]
[info] Try to bootstrap at phase 5 [0.4 sec, 11.16 MB]
[info] Drush bootstrap phase: bootstrapDrupalFull() [0.4 sec, 11.16 MB]
[debug] Start bootstrap of the Drupal Kernel. [0.4 sec, 11.16 MB]
[debug] Get container builder [0.46 sec, 13.54 MB]
[debug] Finished bootstrap of the Drupal Kernel. [0.74 sec, 29.67 MB]
[debug] Loading drupal module drush commands & etc. [0.74 sec, 29.67 MB]
[debug] Found drush.services.yml for image_effects Drush commands [0.75 sec, 29.91 MB]
[debug] Found drush.services.yml for simple_sitemap Drush commands [0.75 sec, 29.91 MB]
[debug] Found drush.services.yml for token Drush commands [0.75 sec, 29.91 MB]
[debug] Found drush.services.yml for typed_data Drush commands [0.75 sec, 29.91 MB]
[debug] Found drush.services.yml for webform Drush commands [0.75 sec, 29.91 MB]
[debug] Found drush.services.yml for webform_scheduled_email Drush commands [0.75 sec, 29.91 MB]
[debug] Add a commandfile class: Drush\Drupal\Commands\sql\SanitizeCommands [1.01 sec, 45.74 MB]
[debug] Add a commandfile class: Drush\Drupal\Commands\sql\SanitizeCommentsCommands [1.01 sec, 45.75 MB]
[debug] Add a commandfile class: Drush\Drupal\Commands\sql\SanitizeSessionsCommands [1.01 sec, 45.75 MB]
[debug] Add a commandfile class: Drush\Drupal\Commands\sql\SanitizeUserFieldsCommands [1.01 sec, 45.75 MB]
[debug] Add a commandfile class: Drush\Drupal\Commands\sql\SanitizeUserTableCommands [1.01 sec, 45.76 MB]
[debug] Add a commandfile class: Drupal\advagg\Commands\AdvaggCommands [1.01 sec, 45.76 MB]
[debug] Add a commandfile class: Drupal\colorbox\Commands\ColorboxCommands [1.01 sec, 45.78 MB]
[debug] Add a commandfile class: Drupal\image_effects\Commands\ImageEffectsCommands [1.01 sec, 45.78 MB]
[debug] Add a commandfile class: Drupal\simple_sitemap\Commands\SimpleSitemapCommands [1.01 sec, 45.79 MB]
[debug] Add a commandfile class: Drupal\smart_date\Commands\SmartDateDrushCommands [1.01 sec, 45.8 MB]
[debug] Add a commandfile class: Drupal\token\Commands\TokenCommands [1.01 sec, 45.8 MB]
[debug] Add a commandfile class: Drupal\typed_data\Commands\TypedDataCommands [1.01 sec, 45.81 MB]
[debug] Add a commandfile class: Drupal\upgrade_status\Commands\UpgradeStatusCommands [1.01 sec, 45.82 MB]
[debug] Add a commandfile class: Drupal\webform\Commands\WebformSubmissionCommands [1.01 sec, 45.83 MB]
[debug] Add a commandfile class: Drupal\webform\Commands\WebformLibrariesCommands [1.02 sec, 45.86 MB]
[debug] Add a commandfile class: Drupal\webform\Commands\WebformUtilityCommands [1.02 sec, 45.88 MB]
[debug] Add a commandfile class: Drupal\webform\Commands\WebformDocumentationCommands [1.02 sec, 45.88 MB]
[debug] Add a commandfile class: Drupal\webform\Commands\WebformDevelCommands [1.02 sec, 45.89 MB]
[debug] Add a commandfile class: Drupal\webform\Commands\WebformSanitizeSubmissionsCommands [1.02 sec, 45.9 MB]
[debug] Add a commandfile class: Drupal\webform_scheduled_email\Commands\WebformScheduledEmailCommands [1.02 sec, 45.9 MB]
[debug] Add a commandfile class: Drupal\pathauto\Commands\PathautoCommands [1.02 sec, 45.9 MB]
[info] Executing: /home/clients/-----/sites/uat/vendor/bin/drush updatedb:status --verbose --strict=0 --uri=default [1.23 sec, 53.75 MB]
--------- ---------------------- ------------- -----------------------------
Module Update ID Type Description
--------- ---------------------- ------------- -----------------------------
webform authenticated_user_p post-update Issue #3404493:
ermission webform_default permission.
--------- ---------------------- ------------- -----------------------------
Do you wish to run the specified pending updates? (yes/no) [yes]:
> y
In BatchStorage.php line 157:
[Exception]
Serialization of 'Closure' is not allowed
Exception trace:
at /home/clients/-----/sites/uat/web/core/lib/Drupal/Core/Batch/BatchStorage.php:157
serialize() at /home/clients/-----/sites/uat/web/core/lib/Drupal/Core/Batch/BatchStorage.php:157
Drupal\Core\Batch\BatchStorage->doCreate() at /home/clients/-----/sites/uat/web/core/lib/Drupal/Core/Batch/BatchStorage.php:141
Drupal\Core\Batch\BatchStorage->create() at /home/clients/-----/sites/uat/web/core/lib/Drupal/Core/ProxyClass/Batch/BatchStorage.php:107
Drupal\Core\ProxyClass\Batch\BatchStorage->create() at /home/clients/-----/sites/uat/vendor/drush/drush/includes/batch.inc:146
_drush_backend_batch_process() at /home/clients/-----/sites/uat/vendor/drush/drush/includes/batch.inc:55
drush_backend_batch_process() at /home/clients/-----/sites/uat/vendor/drush/drush/src/Commands/core/UpdateDBCommands.php:410
Drush\Commands\core\UpdateDBCommands->updateBatch() at /home/clients/-----/sites/uat/vendor/drush/drush/src/Commands/core/UpdateDBCommands.php:73
Drush\Commands\core\UpdateDBCommands->updatedb() at n/a:n/a
call_user_func_array() at /home/clients/-----/sites/uat/vendor/consolidation/annotated-command/src/CommandProcessor.php:276
Consolidation\AnnotatedCommand\CommandProcessor->runCommandCallback() at /home/clients/-----/sites/uat/vendor/consolidation/annotated-command/src/CommandProcessor.php:212
Consolidation\AnnotatedCommand\CommandProcessor->validateRunAndAlter() at /home/clients/-----/sites/uat/vendor/consolidation/annotated-command/src/CommandProcessor.php:176
Consolidation\AnnotatedCommand\CommandProcessor->process() at /home/clients/-----/sites/uat/vendor/consolidation/annotated-command/src/AnnotatedCommand.php:391
Consolidation\AnnotatedCommand\AnnotatedCommand->execute() at /home/clients/-----/sites/uat/vendor/symfony/console/Command/Command.php:326
Symfony\Component\Console\Command\Command->run() at /home/clients/-----/sites/uat/vendor/symfony/console/Application.php:1081
Symfony\Component\Console\Application->doRunCommand() at /home/clients/-----/sites/uat/vendor/symfony/console/Application.php:320
Symfony\Component\Console\Application->doRun() at /home/clients/-----/sites/uat/vendor/symfony/console/Application.php:174
Symfony\Component\Console\Application->run() at /home/clients/-----/sites/uat/vendor/drush/drush/src/Runtime/Runtime.php:110
Drush\Runtime\Runtime->doRun() at /home/clients/-----/sites/uat/vendor/drush/drush/src/Runtime/Runtime.php:40
Drush\Runtime\Runtime->run() at /home/clients/-----/sites/uat/vendor/drush/drush/drush.php:139
require() at /home/clients/-----/sites/uat/vendor/drush/drush/drush:4
Comment #28
jbuttler commentedI am experiencing a similar error when trying to edit settings on content type fields. I applied the patch successfully, but I still receive this error:
RuntimeException: Adding non-existent permissions to a role is not allowed. The incorrect permissions are "use text format webform_default". in Drupal\user\Entity\Role->calculateDependencies() (line 210 of /var/www/html/web/core/modules/user/src/Entity/Role.php).
Severity Error
Hostname 172.31.13.98
Operations
Backtrace
#0 /var/www/html/web/core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php(328): Drupal\user\Entity\Role->calculateDependencies()
#1 /var/www/html/web/core/modules/user/src/Entity/Role.php(182): Drupal\Core\Config\Entity\ConfigEntityBase->preSave()
#2 /var/www/html/web/core/lib/Drupal/Core/Entity/EntityStorageBase.php(528): Drupal\user\Entity\Role->preSave()
#3 /var/www/html/web/core/lib/Drupal/Core/Entity/EntityStorageBase.php(483): Drupal\Core\Entity\EntityStorageBase->doPreSave()
#4 /var/www/html/web/core/lib/Drupal/Core/Config/Entity/ConfigEntityStorage.php(257): Drupal\Core\Entity\EntityStorageBase->save()
#5 /var/www/html/web/core/lib/Drupal/Core/Entity/EntityBase.php(354): Drupal\Core\Config\Entity\ConfigEntityStorage->save()
#6 /var/www/html/web/core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php(617): Drupal\Core\Entity\EntityBase->save()
#7 /var/www/html/web/modules/contrib/field_permissions/src/Plugin/FieldPermissionType/CustomAccess.php(91): Drupal\Core\Config\Entity\ConfigEntityBase->save()
#8 /var/www/html/web/modules/contrib/field_permissions/field_permissions.module(178): Drupal\field_permissions\Plugin\FieldPermissionType\CustomAccess->submitAdminForm()
#9 [internal function]: field_permissions_field_config_edit_form_submit()
#10 /var/www/html/web/core/lib/Drupal/Core/Form/FormSubmitter.php(129): call_user_func_array()
#11 /var/www/html/web/core/lib/Drupal/Core/Form/FormSubmitter.php(67): Drupal\Core\Form\FormSubmitter->executeSubmitHandlers()
#12 /var/www/html/web/core/lib/Drupal/Core/Form/FormBuilder.php(597): Drupal\Core\Form\FormSubmitter->doSubmitForm()
#13 /var/www/html/web/core/lib/Drupal/Core/Form/FormBuilder.php(326): Drupal\Core\Form\FormBuilder->processForm()
#14 /var/www/html/web/core/lib/Drupal/Core/Controller/FormController.php(73): Drupal\Core\Form\FormBuilder->buildForm()
#15 /var/www/html/web/core/modules/layout_builder/src/Controller/LayoutBuilderHtmlEntityFormController.php(39): Drupal\Core\Controller\FormController->getContentResult()
#16 [internal function]: Drupal\layout_builder\Controller\LayoutBuilderHtmlEntityFormController->getContentResult()
#17 /var/www/html/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array()
#18 /var/www/html/web/core/lib/Drupal/Core/Render/Renderer.php(638): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#19 /var/www/html/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(121): Drupal\Core\Render\Renderer->executeInRenderContext()
#20 /var/www/html/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(97): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext()
#21 /var/www/html/vendor/symfony/http-kernel/HttpKernel.php(181): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#22 /var/www/html/vendor/symfony/http-kernel/HttpKernel.php(76): Symfony\Component\HttpKernel\HttpKernel->handleRaw()
#23 /var/www/html/web/core/lib/Drupal/Core/StackMiddleware/Session.php(53): Symfony\Component\HttpKernel\HttpKernel->handle()
#24 /var/www/html/web/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(48): Drupal\Core\StackMiddleware\Session->handle()
#25 /var/www/html/web/core/lib/Drupal/Core/StackMiddleware/ContentLength.php(28): Drupal\Core\StackMiddleware\KernelPreHandle->handle()
#26 /var/www/html/web/core/modules/big_pipe/src/StackMiddleware/ContentLength.php(32): Drupal\Core\StackMiddleware\ContentLength->handle()
#27 /var/www/html/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(116): Drupal\big_pipe\StackMiddleware\ContentLength->handle()
#28 /var/www/html/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(90): Drupal\page_cache\StackMiddleware\PageCache->pass()
#29 /var/www/html/web/modules/contrib/advban/src/AdvbanMiddleware.php(57): Drupal\page_cache\StackMiddleware\PageCache->handle()
#30 /var/www/html/web/core/modules/ban/src/BanMiddleware.php(50): Drupal\advban\AdvbanMiddleware->handle()
#31 /var/www/html/web/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(48): Drupal\ban\BanMiddleware->handle()
#32 /var/www/html/web/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(51): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle()
#33 /var/www/html/web/core/lib/Drupal/Core/StackMiddleware/AjaxPageState.php(36): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle()
#34 /var/www/html/web/core/lib/Drupal/Core/StackMiddleware/StackedHttpKernel.php(51): Drupal\Core\StackMiddleware\AjaxPageState->handle()
#35 /var/www/html/web/core/lib/Drupal/Core/DrupalKernel.php(741): Drupal\Core\StackMiddleware\StackedHttpKernel->handle()
#36 /var/www/html/web/index.php(19): Drupal\Core\DrupalKernel->handle()
#37 {main}
Comment #29
jbuttler commentedUpdate:
I was able to fix my issue using the patch in #11 at https://www.drupal.org/project/drupal/issues/3358586
Comment #30
emerham commented@jbuttler,
I am also experiencing similar issues, and even though that patch does help save permission form I am unable to make any changes to any Webform Elements or emails I get "Error message Text format field is required. " Are you able to make changes to your Webform? If I manually delete the Text Filter Format webform_default I can make changes. Also this removes the permission from being set so I cannot use the format.
Comment #31
jbuttler commentedIt appears the patch did not completely solve the issue.
I found the solution for my site on a very old issue at https://www.drupal.org/project/drupal/issues/2502637 comment #60:
"It is possible to reenable disabled text formats with the configuration manager:
go to /admin/config/development/configuration/single/export
choose Text format as the Configuration type
choose the disabled text format as Configuration Name
copy the configuration
go to /admin/config/development/configuration/single/import
again choose Text format as the Configuration type
paste the configuration
change "status" from false to true
click on import
Voilá, the text format is available again. This is working but not user friendly :("
After following these instructions, webforms are working for my site again.
Comment #32
emerham commentedIt seems that if you do any re-arraging of text formats it will update the disabled formats and take it back away from permissions.
Comment #33
solomon.yifru commentedHi @jrockowitz,
I tried all the patch in this blog, and also try to update to webform:^6.3@beta but it looks like nothing is working. the 6.3@beta require me to install bootstrap3, when I run composer require for bootstrap3, it will add it to composer file but not be downloaded to the contrib folder.
whenever I try to update my text formatter I got the following error:
Comment #34
phjou@emerham It seems like this is exactly what is happening for me. I just rearranged the priority of my text formats and got that error.
Comment #35
weareronin commentedSame for me. After re-arranging the order, it seems the status of thetext format "webform_default" was set to false (for a reason I don't know). I've just reset the status to "true" and imported the config and that seems to do the trick.