#13273 closed enhancement (wontfix)
Workflow graph generation for apache frontend.
Reported by: | Owned by: | Jun Omae | |
---|---|---|---|
Priority: | normal | Component: | TracWorkflowAdminPlugin |
Severity: | normal | Keywords: | |
Cc: | Trac Release: |
Description
Hi,
I wonder if it will be posible to incorporate incorporate attached patch. It allows to generate workflow diagram in directory hosted by apache.
Best, Michał
Attachments (1)
Change History (6)
Changed 7 years ago by
Attachment: | patch.diff added |
---|
comment:1 Changed 7 years ago by
Resolution: | → wontfix |
---|---|
Status: | new → closed |
comment:2 Changed 7 years ago by
Environment.get_htdocs_dir
is available since Trac 1.0.11. The patch would break compatibility with Trac 1.0.10 or early.
comment:3 Changed 7 years ago by
Hi,
thanks for reply.
Patch will only be activated if in trac.ini you will configure it. For me it is:
[workflow-admin] diagram_path_enable = true diagram_path = /var/www/vhost_site/htdocs/site
I agree, that /tmp
isn't the best choice. I should have leave it empty.
In my enviroment diagram image was created by trac user with with 0600 permisions. Thus change to 0664. I have apache runing on apache user and WSGI on trac user so apache process cannot get access to diagram file. Even Alias or RewriteRule won't help me with this.
I'm quite new to trac but in my environment get_htdocs_dir
is pointing to trac project location and I'm not sure that I would like to expose this location to apache.
Diagram file will be regenerated as result of workflow changes so using trac-admin ... deploy ... seams impractical.
Thanks, Michał
comment:4 Changed 7 years ago by
I think what you need is os.chmod(tmp, 0664)
rather than diagram_path
option.
comment:5 Changed 7 years ago by
The image files are created with 0600 permission because using tempfile.mkstemp
.
Could you please try the following patch? umask
value would be respected after the changes.
-
workflowadmin/tracworkflowadmin/web_ui.py
diff --git a/workflowadmin/tracworkflowadmin/web_ui.py b/workflowadmin/tracworkflowadmin/web_ui.py index 52186ad00..9db6e5251 100644
a b import glob 5 5 import inspect 6 6 import os 7 7 import re 8 import shutil 8 9 import time 9 10 from cStringIO import StringIO 10 11 from pkg_resources import resource_filename, parse_version … … class TracWorkflowAdminModule(Component): 487 488 finally: 488 489 proc.stdin.close() 489 490 proc.wait() 490 except:491 os.remove(tmp)492 raise493 else:494 491 try: 495 492 os.remove(path) 496 493 except: 497 494 pass 498 os.rename(tmp, path) 495 shutil.copyfile(tmp, path) 496 finally: 497 try: 498 os.remove(tmp) 499 except: 500 pass 499 501 500 502 _default_workflow = ( 501 503 ('leave', 'new,assigned,accepted,reopened,closed -> *'),
You should use
RewriteRule
orAlias
rather than the patch.Also, default of
diagram_path
should not be/tmp
. That is pretty insecure.