Closed felix-caboff closed 4 months ago
Hey @felix-caboff, the project name displayed by Ghostwriter is the client name + the assessment type so you can assemble that in the report title configuration. Do you mean you want to include the codename?
When you say you want all variables available, do you mean the values under the project
key available in the templates?
Yes please on the whole of the project key.
I second @felix-caboff. Having access to the reporting context when constructing the filename would be very helpful.
One thing I have wondered though is whether it would be better located with the template (if only as an optional field that can be used to override the global) as opposed to the overall installation. In the end the filename is something that mostly affects the report as a final product so one could argue that the structure of the filename would better be placed with the other information that shapes the report (i.e., the template).
Let me give you one more peculiar example where this has become relevant to us:
{{company}}
company
to the new one, it messes up the old filenames. If I leave it as is it messes up the new reports.Actually this has given me an even wilder idea: having the ability to overwrite system globals in the template (e.g. redefining variables per template) might be a rather handy feature.
Sorry, for hijacking your issue @felix-caboff . It felt on topic :)
@er4z0r That's something that may be possible with via the new custom fields feature coming in v4.1 (See PR #346). We're looking at reports now, but we could potentially extend custom fields to templates too. Then a check like "if a field named report_filename
exists, use that instead of the global value" could be a thing.
Allowing global options to be overridden by templates has been in the backlog for a long time.
I don't know if all report context can be made accessible as a filename, especially once custom fields are in the mix, but we'll see about expanding what is available. Many of the values from the project
key are very doable.
This looks like this may have been completed in recent release: https://github.com/GhostManager/Ghostwriter/releases/tag/v4.2.0
This issue has been labeled as stale
because it has been open for 30 days with no activity.
We have not yet upgraded (busy couple of months!). Can anyone confirm that the above is now resolved in the above release. I read the release note of "Added support for using Jinja2 in the report filename template configured under the Global Report Configuration inside the admin panel" as being exactly what this issue requested.
Yes, report filename templates have full use of Jinja2 templating now. This applies to the global report filenames and the newer filename overrides for individual templates.
Awesome! Closing...
Is your feature request related to a problem? Please describe. I am required to format the filename of the output reports in a particular way and this includes the project name. At the moment this field is not available. Instead only the following are:
Describe the solution you'd like It would be ideal if all the variables that are available in the report are also available in the filename within the global report options. This gives the greatest level of flexibility. There may also be mileage is attempting to rationalise the naming convention too.