Ticket #2667: TIME_VIEW_and_TIME_ADMIN.diff
| File TIME_VIEW_and_TIME_ADMIN.diff, 2.1 kB (added by fecht, 10 months ago) |
|---|
-
timingandestimationplugin/webui.py
old new 7 7 from usermanual import * 8 8 from trac.log import logger_factory 9 9 from trac.core import * 10 from trac.perm import IPermissionRequestor 10 11 from trac.web import IRequestHandler 11 12 from trac.util import Markup 12 13 from trac.web.chrome import add_stylesheet, add_script, \ … … 18 19 #get_statuses = api.get_statuses 19 20 20 21 class TimingEstimationAndBillingPage(Component): 21 implements(I NavigationContributor, IRequestHandler, ITemplateProvider)22 implements(IPermissionRequestor, INavigationContributor, IRequestHandler, ITemplateProvider) 22 23 23 24 def __init__(self): 24 25 pass … … 38 39 """ 39 40 dbhelper.execute_non_query(sql, when, now, strwhen) 40 41 41 42 43 42 44 43 # IPermissionRequestor methods 44 def get_permission_actions(self): 45 return ["TIME_VIEW", ("TIME_ADMIN", ["TIME_VIEW"])] 45 46 46 47 # INavigationContributor methods 47 48 def get_active_navigation_item(self, req): … … 52 53 53 54 def get_navigation_items(self, req): 54 55 url = req.href.Billing() 55 if req.perm.has_permission(" REPORT_VIEW"):56 yield 'mainnav', " Billing", \56 if req.perm.has_permission("TIME_VIEW"): 57 yield 'mainnav', "billing", \ 57 58 Markup('<a href="%s">%s</a>' % \ 58 59 (url , "Management")) 59 60 … … 83 84 84 85 if req.method == 'POST': 85 86 if req.args.has_key('setbillingtime'): 86 self.set_bill_date(req.authname) 87 addMessage("All tickets last bill date updated") 87 if req.perm.has_permission("TIME_ADMIN"): 88 self.set_bill_date(req.authname) 89 addMessage("All tickets last bill date updated") 90 else: 91 addMessage("You don't have permission to set a new bill date!") 88 92 89 93 mgr = CustomReportManager(self.env, self.log) 90 94 data = {};
