There is no such extension, but doing it is just a bunch of lines of code using the _lookup method.
My example in the previous message provides a quick solution, you just have to mount that controller as "privatefiles" or something like that and add a check for request.identity['user'] raising HTTPNotFound or similar in the case he cannot access the file. If you are behind a more advanced server you can use the xsendfile header to let the frontend server take care of the file to serve without exposing it. On Tue, Jun 19, 2012 at 3:10 PM, abc_coder <[email protected]> wrote: > Thanks for response. > As I understood I need some way to connect turbogears auth with file server > auth. > Is there any aplication or add-on to turbogears doing that? > I found one for Django: > http://django-private-files.readthedocs.org/en/0.1.2/index.html > > W dniu poniedziałek, 18 czerwca 2012 22:28:58 UTC+2 użytkownik Alessandro > Molina napisał: >> >> Static files are served by a middleware in the WSGI chain, >> this runs before the authentication layer got in, so it doesn't have >> any knowledge of users. >> >> You can roll your own statics serving controller which checks users >> and so on, a minima solution can be: >> >> class StaticsController(TGController): >> @expose() >> def _lookup(self, *args): >> return WSGIAppController(StaticURLParser(statics_path)), args >> >> On Mon, Jun 18, 2012 at 2:39 PM, abc_coder <[email protected]> >> wrote: >> > Hi all >> > >> > I searched a lot but haven't found any solution. How can I in turgobears >> > 2 >> > restrict access to static files only for logged users? >> > I want add some protection from unlogged users and web robots. >> > >> > Please help. >> > >> > -- >> > You received this message because you are subscribed to the Google >> > Groups >> > "TurboGears" group. >> > To view this discussion on the web visit >> > https://groups.google.com/d/msg/turbogears/-/a6oOER4Ps3cJ. >> > To post to this group, send email to [email protected]. >> > To unsubscribe from this group, send email to >> > [email protected]. >> > For more options, visit this group at >> > http://groups.google.com/group/turbogears?hl=en. > > -- > You received this message because you are subscribed to the Google Groups > "TurboGears" group. > To view this discussion on the web visit > https://groups.google.com/d/msg/turbogears/-/1cPLCF7zHFYJ. > > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/turbogears?hl=en. -- You received this message because you are subscribed to the Google Groups "TurboGears" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/turbogears?hl=en.

