Modify

Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#13273 closed enhancement (wontfix)

Workflow graph generation for apache frontend.

Reported by: w1zdun@… 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)

patch.diff (2.4 KB) - added by w1zdun@… 7 years ago.

Download all attachments as: .zip

Change History (6)

Changed 7 years ago by w1zdun@…

Attachment: patch.diff added

comment:1 Changed 7 years ago by Jun Omae

Resolution: wontfix
Status: newclosed

You should use RewriteRule or Alias rather than the patch.

Also, default of diagram_path should not be /tmp. That is pretty insecure.

Last edited 7 years ago by Jun Omae (previous) (diff)

comment:2 Changed 7 years ago by Jun Omae

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 w1zdun@…

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ł

Last edited 7 years ago by Ryan J Ollos (previous) (diff)

comment:4 Changed 7 years ago by Jun Omae

I think what you need is os.chmod(tmp, 0664) rather than diagram_path option.

comment:5 Changed 7 years ago by Jun Omae

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 
    55import inspect
    66import os
    77import re
     8import shutil
    89import time
    910from cStringIO import StringIO
    1011from pkg_resources import resource_filename, parse_version
    class TracWorkflowAdminModule(Component): 
    487488            finally:
    488489                proc.stdin.close()
    489490                proc.wait()
    490         except:
    491             os.remove(tmp)
    492             raise
    493         else:
    494491            try:
    495492                os.remove(path)
    496493            except:
    497494                pass
    498             os.rename(tmp, path)
     495            shutil.copyfile(tmp, path)
     496        finally:
     497            try:
     498                os.remove(tmp)
     499            except:
     500                pass
    499501
    500502    _default_workflow = (
    501503        ('leave', 'new,assigned,accepted,reopened,closed -> *'),

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Jun Omae.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.