[Bug 23237] New: Plugin allow [% INCLUDE %] from template
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23237 Bug ID: 23237 Summary: Plugin allow [% INCLUDE %] from template Change sponsored?: --- Product: Koha Version: master Hardware: All OS: All Status: NEW Severity: enhancement Priority: P5 - low Component: Architecture, internals, and plumbing Assignee: koha-bugs@lists.koha-community.org Reporter: frederic@tamil.fr QA Contact: testopia@bugs.koha-community.org
From a plugin template it is useful to be able to include other templates with [% INCLUDE %] directives. But TT module is used by Koha with absolute paths. Relative paths are forbidden for security reasons. A new param [% PLUGIN_DIR %] allow plugin templates to know where to find plugin home directory.
-- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23237 --- Comment #1 from Frédéric Demians <frederic@tamil.fr> --- Created attachment 91128 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=91128&action=edit Bug 23237 Plugin allow [% INCLUDE %] from template
From a plugin template it is useful to be able to include other templates with [% INCLUDE %] directives. But TT module is used by Koha with absolute paths. Relative paths are forbidden for security reasons. A new param [% PLUGIN_DIR %] allow plugin templates to know where to find plugin home directory.
How to test: 1. Install kitchen-sink plugin. 2. Find tool-step1.tt file, and add this at the begining of the file: [% INCLUDE "$PLUGIN_DIR/header.tt" %] It ask to include a template header.tt which doesn't exit. 3. Run kitchen-sink plugin tool. You must have this error message: Template process failed: file error - _path to plugin directory_/Koha/Plugin/Com/ByWaterSolutions/KitchenSink/header.tt: not found quod erat demonstrandum -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23237 Frédéric Demians <frederic@tamil.fr> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |Needs Signoff -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23237 Maryse Simard <maryse.simard@inlibro.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #91128|0 |1 is obsolete| | --- Comment #2 from Maryse Simard <maryse.simard@inlibro.com> --- Created attachment 91374 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=91374&action=edit Bug 23237 Plugin allow [% INCLUDE %] from template
From a plugin template it is useful to be able to include other templates with [% INCLUDE %] directives. But TT module is used by Koha with absolute paths. Relative paths are forbidden for security reasons. A new param [% PLUGIN_DIR %] allow plugin templates to know where to find plugin home directory.
How to test: 1. Install kitchen-sink plugin. 2. Find tool-step1.tt file, and add this at the begining of the file: [% INCLUDE "$PLUGIN_DIR/header.tt" %] It ask to include a template header.tt which doesn't exit. 3. Run kitchen-sink plugin tool. You must have this error message: Template process failed: file error - _path to plugin directory_/Koha/Plugin/Com/ByWaterSolutions/KitchenSink/header.tt: not found quod erat demonstrandum Signed-off-by: Maryse Simard <maryse.simard@inlibro.com> -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23237 Maryse Simard <maryse.simard@inlibro.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |maryse.simard@inlibro.com Status|Needs Signoff |Signed Off -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23237 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|koha-bugs@lists.koha-commun |frederic@tamil.fr |ity.org | CC| |katrin.fischer@bsz-bw.de -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23237 Nick Clemens <nick@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Passed QA -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23237 --- Comment #3 from Nick Clemens <nick@bywatersolutions.com> --- Created attachment 91875 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=91875&action=edit Bug 23237: Plugin allow [% INCLUDE %] from template
From a plugin template it is useful to be able to include other templates with [% INCLUDE %] directives. But TT module is used by Koha with absolute paths. Relative paths are forbidden for security reasons. A new param [% PLUGIN_DIR %] allow plugin templates to know where to find plugin home directory.
How to test: 1. Install kitchen-sink plugin. 2. Find tool-step1.tt file, and add this at the begining of the file: [% INCLUDE "$PLUGIN_DIR/header.tt" %] It ask to include a template header.tt which doesn't exit. 3. Run kitchen-sink plugin tool. You must have this error message: Template process failed: file error - _path to plugin directory_/Koha/Plugin/Com/ByWaterSolutions/KitchenSink/header.tt: not found quod erat demonstrandum Signed-off-by: Maryse Simard <maryse.simard@inlibro.com> Signed-off-by: Nick Clemens <nick@bywatersolutions.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23237 --- Comment #4 from Nick Clemens <nick@bywatersolutions.com> --- Created attachment 91876 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=91876&action=edit Bug 23237: Fix POD and typos Signed-off-by: Nick Clemens <nick@bywatersolutions.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23237 Nick Clemens <nick@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- QA Contact|testopia@bugs.koha-communit |nick@bywatersolutions.com |y.org | CC| |nick@bywatersolutions.com -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23237 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Version(s)| |19.11.00 released in| | Status|Passed QA |Pushed to master -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23237 --- Comment #5 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Nice work! Pushed to master for 19.11.00 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23237 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |martin.renvoize@ptfs-europe | |.com Attachment #91374|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23237 --- Comment #6 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Nice work! Pushed to master for 19.11.00 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23237 Fridolin SOMERS <fridolin.somers@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |fridolin.somers@biblibre.co | |m Status|Pushed to master |Pushed to stable Version(s)|19.11.00 |19.11.00,19.05.03 released in| | --- Comment #7 from Fridolin SOMERS <fridolin.somers@biblibre.com> --- Nice enhancement. I choose to backport so than Koha Plugins can already be developed/updated with this. Pushed to 19.05.x for 19.05.03 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23237 Lucas Gass <lucas@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |lucas@bywatersolutions.com Status|Pushed to stable |Pushed to oldstable --- Comment #8 from Lucas Gass <lucas@bywatersolutions.com> --- following Fridolin's lead and backporting this enhancement to 18.11.x for 18.11.10 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23237 --- Comment #9 from Lucas Gass <lucas@bywatersolutions.com> --- this patchset made me unable to prove t/db_dependent/Koha/REST/Plugin/PluginRoutes.t in 18.11.x, since this is an enhancement i am choosing to revert the patch set in 18.11.x -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23237 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Component|Architecture, internals, |Plugin architecture |and plumbing | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23237 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|Plugin allow [% INCLUDE %] |Add support for [% INCLUDE |from template |%] in plugin templates Severity|enhancement |new feature -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23237 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Text to go in the| |From a plugin template it release notes| |is useful to be able to | |include other templates | |with [% INCLUDE %] | |directives. But the TT | |module is used by Koha with | |absolute paths. Relative | |paths are forbidden for | |security reasons. A new | |param [% PLUGIN_DIR %] | |allow plugin templates to | |know where to find plugin | |home directory. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23237 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Text to go in the|From a plugin template it |From a plugin template it release notes|is useful to be able to |is useful to include other |include other templates |templates with [% INCLUDE |with [% INCLUDE %] |%] directives. But the TT |directives. But the TT |module is used by Koha with |module is used by Koha with |absolute paths. Relative |absolute paths. Relative |paths are forbidden for |paths are forbidden for |security reasons. A new |security reasons. A new |param [% PLUGIN_DIR %] |param [% PLUGIN_DIR %] |allows plugin templates to |allow plugin templates to |know where to find plugin |know where to find plugin |home directory. |home directory. | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23237 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Text to go in the|From a plugin template it |From a plugin template it release notes|is useful to include other |is useful to include other |templates with [% INCLUDE |templates with [% INCLUDE |%] directives. But the TT |%] directives. But the TT |module is used by Koha with |module is used by Koha with |absolute paths. Relative |absolute paths. Relative |paths are forbidden for |paths are forbidden for |security reasons. A new |security reasons. A new |param [% PLUGIN_DIR %] |param [% PLUGIN_DIR %] |allows plugin templates to |allows plugin templates to |know where to find plugin |know where to find the |home directory. |plugin home directory. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23237 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Text to go in the|From a plugin template it |The new feature allows release notes|is useful to include other |plugin authors to use |templates with [% INCLUDE |template `[% INCLUDE %]` |%] directives. But the TT |directives in their |module is used by Koha with |templates. It does so by |absolute paths. Relative |introducing a new variable, |paths are forbidden for |`PLUGIN_DIR`, allowing the |security reasons. A new |template engine to locate |param [% PLUGIN_DIR %] |the includes. |allows plugin templates to | |know where to find the |**Usage**: |plugin home directory. |`[% INCLUDE | |"$PLUGIN_DIR/header.tt" %]` -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23237 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Text to go in the|The new feature allows |The new feature allows release notes|plugin authors to use |plugin authors to use |template `[% INCLUDE %]` |template `[% INCLUDE %]` |directives in their |directives in their |templates. It does so by |templates. It does so by |introducing a new variable, |introducing a new variable, |`PLUGIN_DIR`, allowing the |`PLUGIN_DIR`, allowing the |template engine to locate |template engine to locate |the includes. |the includes. | | |**Usage**: |**Usage**: |`[% INCLUDE |`[% INCLUDE |"$PLUGIN_DIR/header.tt" %]` |"$PLUGIN_DIR/header.tt" %]` | | | |**Warning**: Care should | |be taken when installing | |any plugins and only | |plugins you trust should be | |used. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23237 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |tomascohen@gmail.com --- Comment #10 from Tomás Cohen Arazi <tomascohen@gmail.com> --- I think the get_plugin_dir method is not quite correct as there can be more than one plugins_dir entry. bundle_dir should be used instead. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23237 --- Comment #11 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Any further thoughts regarding Tomas's comment Frederic? -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23237 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |additional_work_needed -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23237 --- Comment #12 from Frédéric Demians <frederic@tamil.fr> --- (In reply to Martin Renvoize from comment #11)
Any further thoughts regarding Tomas's comment Frederic?
Thomas is right. I implemented this before Thomas added bundle_dir() method. I will submit a patch to use Thomas method instead of mine get_plugin_dir() method. bundle_dir() is available in 19.11 and after. So the new patch must not be backported to 19.05 and 18.11. As it is the usage of new template parameter PLUGIN_DIR will be OK in 18.11 and 19.05 as soon as plugins_dir parameter is unique in koha-conf.xml. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23237 --- Comment #13 from Frédéric Demians <frederic@tamil.fr> --- Created attachment 97862 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=97862&action=edit Bug 23237: Fix PLUGIN_DIR parameter in master/19.11 Method get_plugin_dir() is not correct when plugin_dirs parameter is repeated in koha-conf.xml. A new method bundle_path() must be used instead. bundle_dir() is available in 19.11 and after. So the new patch must not be backported to 19.05 and 18.11. As it is the usage of the new template parameter PLUGIN_DIR will be OK in 18.11 and 19.05 as soon as plugins_dir parameter is unique in koha-conf.xml. Thanks Thomas -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23237 Frédéric Demians <frederic@tamil.fr> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #91875|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23237 Frédéric Demians <frederic@tamil.fr> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #91876|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23237 --- Comment #14 from Frédéric Demians <frederic@tamil.fr> --- See bug 26803 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23237 Jonathan Druart <jonathan.druart@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |26803 Keywords|additional_work_needed | CC| |jonathan.druart@bugs.koha-c | |ommunity.org Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=26803 [Bug 26803] Fix PLUGIN_DIR when plugin_dirs is multivalued -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23237 David Cook <dcook@prosentient.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |dcook@prosentient.com.au -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org