[QGIS-Developer] PyQgis: custom form and enable (trusted) macro

enrico chiaradia enrico.chiaradia at yahoo.it
Thu Nov 12 05:40:11 PST 2020


Dear Devs,

I’m working to a new plugin for qgis 3.10 that use macro to customize 
attribute forms behaviour (e.g. openForm, etc…). For security reason, 
macros are not enabled by default in QGIS and so, each time you open the 
attribute table/form view, it asks to enable macro. That sounds boring 
for the final user…

I can manually resolve this modifying the option “enable macros” to “For 
this session only” or, by PyQgis, editing the QgsSettings, key 
“qgis/enableMacros” to “SessionOnly” and restore old configuration 
options after plugin unloads.

The problem is that, during the sessions, all the macros are enabled 
showing a security issue. Is there a way to run only trusted macros, for 
example stored under my plugin folder?

Many thanks

enrico

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20201112/8d1a5e4b/attachment-0001.html>


More information about the QGIS-Developer mailing list