verbb / workflow

A Craft CMS plugin to create a workflow for publishing entries.
Other
140 stars 27 forks source link

Internal Server Error when trying to edit the settings in staging or production environment #181

Closed romainpoirier closed 1 year ago

romainpoirier commented 1 year ago

Describe the bug

When in a staging or production environment, trying to edit the settings in /admin/workflow/settings result in an Internal Server Error: [web.ERROR] [yii\base\NotSupportedException] Changes to the project config are not possible while in read-only mode

It would be cleaner to hide these settings to the users instead of thrown the error on submit (which require inspecting the logs using the FTP, and is not the most convenient way).

Steps to reproduce

  1. In a staging or production environment, try to edit the settings
  2. Get the Internal Server Error

Craft CMS version

4.3.5

Plugin version

2.0.3

Multi-site?

No response

Additional context

No response

engram-design commented 1 year ago

This is correct behaviour, you can't edit settings of Craft or any plugin with allowAdminChanges = false. What's more, you shouldn't be able to access the Settings page to then access the Workflow settings page unless you have that set to true.

Or, do you mean you're navigating to that page manually and trying to edit those settings? That's really the only case we're not handling. To get the fix early, change your verbb/workflow requirement in composer.json to:

"require": {
  "verbb/workflow": "dev-craft-4 as 2.0.3",
  "...": "..."
}

Then run composer update.

romainpoirier commented 1 year ago

Or, do you mean you're navigating to that page manually and trying to edit those settings?

Thank you, I can't replicate it anymore, but yes (before the update) I am still able to get in the settings URLs when switching the URL from my local env to staging env. That's should be the way I was accessing to it, and getting the submit error instead of getting a restricted access error.

I'll test your early fix, and will let you know if that doesn't work for me. Thank you!

engram-design commented 1 year ago

Fixed in 2.0.4