-
Notifications
You must be signed in to change notification settings - Fork 73
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Restore default whitelist all get static strategy #225
Comments
Thanks for opening your first issue in this repo. Any chance you could help us fixing this? |
I can confirm the behaviour as observed by @muuk-iO. The data patch uses a hardcoded whitelist while the restore feature uses an entry list injected through DI. This should be merged into one source of default entries. |
@rikwillems makes sense. That would also mean the Patch classes need to filter/extract the values that need to be updated. Otherwise, db conflicts might be the result. |
The patch is only executed once, during first install. Any database errors are already handled (ignored) through a try/catch in the patch. But, the patch does insert the right whitelist type. I'll try to align this behaviour with the "restore defaults" feature. |
Exactly, that's the problem ;) If we want to add more default items to the whitepages list and a merchant has already installed a previous version of the module, then the newly added items won't get added to the database. Thus, we would need an additional patch file. |
@shochdoerfer @muuk-iO What do you expect that a "restore defaults" button would do? Currently it goes through existing entries and skips those, then adds non-existing entries to the whitelist table. But, you could argue that a "restore defaults" button would truncate the whitelist table and add all defaults. Also, the check for existing entries is only for Moving forward I would suggest to actually restore the defaults. So truncate the whitelist table and restore whitelist entries from the Adding to the whitelist during a module update is debatable as it changes behaviour. It at lease would require separate patch files per version. We can't work from a default list here as merchants can also remove entries that would be re-added if we execute the default list during an upgrade. I believe we can think of a lot of interesting scenarios here. |
@rikwillems I agree with your proposed way to restore the defaults. That makes the most sense, I guess. That would also imply that we have to work with multiple patch files in the future when we need/want to add new URLs to the whitelist. |
@shochdoerfer I have a working setup ready and will create a concept PR for that. |
…nstall & restore defaults
Just published v5.3.0 with a fix. |
When you remove the default whitelists in the admin and restore them with the restore button, all the whitelist will be added with the static strategy.
Preconditions
Remove some or all whitelists with the regex strategy.
Magento Version : EE 2.4.5-p1
Force Login Module Version : 5.1.0
Steps to reproduce
Expected result
Actual result
The text was updated successfully, but these errors were encountered: