Open binoclard opened 1 year ago
Just run into this as well. Set a default
protection scheme and then tried to override the default for a specific collection, but the default one takes priority.
If there's interest in changing this behaviour it might make sense for v4, since it could be breaking.
This could be added at any time with an additional config option to swap the behavior. We wouldn't need to wait for a breaking release. (Especially after v4 since breaking releases are planned to only be once a year)
Something like:
// config/statamic/protect.php
'precedence' => 'default', // or 'content'
Oh yeah good point, just make it configurable! 🤦♂️
Quickly looking at it, it should be simple to change.
In here, you should be able to switch the order of the default/data protection depending on the new config option.
I wonder if it could be a decent feature, that the protect scheme has some king of "order of precedence": Site > Collection > Entry So if a global protect scheme is set, it could still be overridden at a more specific level.
My question comes from my current project, where it makes sense to set up a site-wide protection with password, but I still would like to exclude some limited pages. Currently, if I understand things correctly, the only option is to define a protect scheme for each and all Collections/Entries, except the ones I would like to be less restricted.
So I think it could be nice to be able to specify "protect: null" at the entry level to exclude it, or to be able to set 'logged_in" as the default, but 'password' for selected items, or vice-versa.
Hope it makes sense, and that others might find it useful.