-
-
Notifications
You must be signed in to change notification settings - Fork 529
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
Make “root” a reserved (restricted) key for Contexts #16475
Conversation
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## 3.x #16475 +/- ##
=========================================
Coverage 21.57% 21.57%
- Complexity 10564 10566 +2
=========================================
Files 561 561
Lines 31932 31938 +6
=========================================
+ Hits 6890 6892 +2
- Misses 25042 25046 +4 ☔ View full report in Codecov by Sentry. |
While |
Yeah, while it may or may not be needed technically, it'd be a good idea. I'll make a small update to account for casing later today... |
4d2f0dc
to
5e3fcff
Compare
Thank you @smg6511. |
Adds "root" to already protected set of keys ("mgr" and "web")
Use new base class constant in canRemove conditional instead of hard-coded inline array
Ensure reserved key comparison is not case sensitive
5e3fcff
to
4f58af1
Compare
### What does it do? 1. Prevents "root" from being specified as a Context key. 2. Slightly refactors the `Create->beforeSave() `error testing conditional to use a `switch` statement so only relevant code will execute in that block. 3. Additionally, in the second commit, leverages the newly-added `RESERVED_KEYS` constant (in the `modContext` base class) in the Context processor `GetList` class. ### Why is it needed? The keyword "root" is used as the default id for all trees in the core. As such, attempting to create a Context with that key results in errors in the rendering of the Resources tree. ### How to test Attempt to create a new Context with the key "root." You should receive an error message indicating the key is reserved. ### Related issue(s)/PR(s) Resolves #16457
What does it do?
Create->beforeSave()
error testing conditional to use aswitch
statement so only relevant code will execute in that block.RESERVED_KEYS
constant (in themodContext
base class) in the Context processorGetList
class.Why is it needed?
The keyword "root" is used as the default id for all trees in the core. As such, attempting to create a Context with that key results in errors in the rendering of the Resources tree.
How to test
Attempt to create a new Context with the key "root." You should receive an error message indicating the key is reserved.
Related issue(s)/PR(s)
Resolves #16457