]> git.ipfire.org Git - ipfire.org.git/blobdiff - src/web/docs.py
docs: Move file listing handler
[ipfire.org.git] / src / web / docs.py
index 27f89281883f8b81b40325b94b22410efa9a056a..e3f684753721d0af7f83a15ea031ed6bd30a5d45 100644 (file)
@@ -89,6 +89,21 @@ class PageHandler(base.BaseHandler):
                self.render("docs/page.html", page=page, latest_revision=latest_revision)
 
 
+class FilesHandler(base.BaseHandler):
+       @tornado.web.authenticated
+       def get(self, path):
+               if path is None:
+                       path = "/"
+
+               # Check permissions
+               if not self.backend.wiki.check_acl(path, self.current_user):
+                       raise tornado.web.HTTPError(403, "Access to %s not allowed for %s" % (path, self.current_user))
+
+               files = self.backend.wiki.get_files(path)
+
+               self.render("docs/files/index.html", path=path, files=files)
+
+
 class FileHandler(base.BaseHandler):
        @property
        def action(self):