Thank you very much trac-hacks is a great site.
I found a plugin meet my needs http://trac-hacks.org/wiki/LoginRequiredPlugin On Friday, July 25, 2014 10:57:30 AM UTC+8, siyuan tong wrote: > > Hi all > > I want to write a plugin check the req auth premmition: > if user is not login then redirect to the login page, and login module has > setting to acct_mgr.web_ui.loginmodule > > > def match_request(self, req): > if req.path_info in ['/login', '/logout']: > return False > if req.authname == "anonymous": > return True > > def process_request(self, req): > req.redirect(req.abs_href.base+"/login") > > but the code above does not work, > > I found IRequestHandler was handle in > trac/trac/web/main.py RequestDispatcher, > > for handler in self.handlers: > if handler.match_request(req): > chosen_handler = handler > > for example: I visit the /main/dashboard in url > if the <bhdashboard.web_ui.DashboardModule> match the req before my plugin > match_request > then the response will return. > > the order of self.handlers list is not configurable. > > How the do that correctly? > -- You received this message because you are subscribed to the Google Groups "Trac Development" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/trac-dev. For more options, visit https://groups.google.com/d/optout.
