Topic-level Preferences Settings
Many people would like to see topic-level preferences (that override
WebPreferences settings) implemented in TWiki.
Some plugins have added some of this functionality.
TopicVarsPlugin allows adding new settings but cannot override existing ones.
SpreadSheetPlugin can allow some minimal variable use within tables.
Doing this is a simple one-line change in
PrefsDotPm, but there has been some debate over whether this is secure and has good performance. Currently the line that would make this change is present but commented out in
TWikiAlphaRelease, so that people who are aware of the potential issues but wish to use the plugin anyway are able to do so.
Summary of the debate so far...
- Security: allowing any topic to override settings could be a security hole. For example, say someone reset
ALLOWWEBMANAGE in a new topic with a web creation form. Now anyone can create webs.
- Rebuttal: the existing
FINALPREFERENCES mechanism can be used to deal with this problem.
- Performance: this change might negatively impact the performance of TWiki.
- Rebuttal: TWiki already reads 13 topics for a some requests, and will always read several of them. Adding one more topic read (for a topic that is being read elsewhere anyway) should have minimal impact.
- Evaluation order: should topic preferences override user settings?
- My opinion: Make it a Web-level setting. This could be done easily (not in current implementation), and would resolve the issue nicely. -- WM
Contributors:
--
ArthurClemens - 11 Jan 2004 (original proposal)
--
PeterThoeny - 12 Jan 2004
--
SamHasler - 12 Jan 2004
-- MS - 14 Jan 2004
--
WalterMundt - 14 Feb 2004
Update: I've added support for this with settings, as I describe in my last comment above!
TWikiAlphaRelease now has two new preference flags you can set:
-
READTOPICPREFS: If you set this, topic preferences will be read, and will override any web- or site-level preferences not set as FINALPREFERENCES. By default, user preferences will override topic preferences.
-
TOPICOVERRIDESUSER: If you set this also, topic preferences will override user preferences. The user can in turn override this behavior by setting further FINALPREFERENCES in his or her user topic.
--
WalterMundt - 19 Feb 2004
Purpose
One purpose I have for this functionality of overriding variables is to define a site-level
CSS definition, and to let Webs and topics override this style in
WebPreferences and topics. (There are
arguments for and against this functionality, but I am not going to be patronizing, and let TWiki masters and users decide for themselves).
- A very simple example how this can be used in a legitimate way is the way Wikipedia separates doc pages
from actual content: these pages simply get a yellow background.
Example
A twikimaster can define a global variable in TWikiPreferences, or leave it empty:
A webmaster can set the style of his department:
The user can write in some topic:
The variable %STYLETOPIC% then is read and used in twiki.tmpl, to write the <style></style>
--
ArthurClemens - 15 Jan 2004
Discussion
I just updated TWiki.org with the latest code. Test:
- Set WIKIWEBLIST = This web list pref setting is defined in this topic
And this works after adding the settings to the
TWikiPreferences. Thanks Walter
--
PeterThoeny - 21 Feb 2004