You are here: Foswiki>Tasks Web>Item14685 (28 Mar 2022, MichaelDaum)Edit Attach

Item14685: permissions read from the wrong topic

Priority: Urgent
Current State: Closed
Released In: 2.1.7
Target Release: patch
Applies To: Extension
Component: NatEditPlugin
Branches: Release02x01 master
Reported By: MichaelDaum
Waiting For:
Last Change By: MichaelDaum
When the templatetopic url parameter is set to the empty string will preferences be read from the WebHome topic of the current web. Below the problematic code in edit.natedit.tmpl.

%QUERY{"'%URLPARAM{"templatetopic" default="%WEB%.%TOPIC%"}%'/preferences[name='ALLOWTOPICCHANGE'].value" }%


It will then be executed as:

%QUERY{"''/preferences[name='ALLOWTOPICCHANGE'].value" }%

Result: AdminUser

and not as this:

%QUERY{"preferences[name='ALLOWTOPICCHANGE'].value" }%


Here is a patch to be tested:

diff --git a/NatEditPlugin/templates/edit.natedit.tmpl b/NatEditPlugin/templates/edit.natedit.tmpl
index aa28c3320..304be15c7 100644
--- a/NatEditPlugin/templates/edit.natedit.tmpl
+++ b/NatEditPlugin/templates/edit.natedit.tmpl
@@ -92,7 +92,10 @@
-  "'%URLPARAM{"templatetopic" default="%WEB%.%TOPIC%"}%'/preferences[name='%name%'].value"
+  "%IF{"$'URLPARAM{templatetopic}'=''"
+    then="preferences[name='%name%'].value"
+    else="'%URLPARAM{"templatetopic"}%'/preferences[name='%name%'].value"
+  }%"

-- MichaelDaum - 24 Apr 2018

I've tested locally. Seems to work fine, and still copies permissions when a template has them. Applied it to, and verified that the problem is fixed.

-- GeorgeClark - 25 Apr 2018
Topic revision: r5 - 28 Mar 2022, MichaelDaum
The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License    Legal Imprint    Privacy Policy