]> git.ipfire.org Git - ipfire.org.git/commitdiff
users: Move group handlers
authorMichael Tremer <michael.tremer@ipfire.org>
Mon, 26 Jun 2023 09:23:07 +0000 (09:23 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Mon, 26 Jun 2023 09:23:07 +0000 (09:23 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Makefile.am
src/templates/users/groups/index.html [moved from src/templates/people/groups.html with 95% similarity]
src/templates/users/groups/show.html [moved from src/templates/people/group.html with 95% similarity]
src/templates/users/show.html
src/web/__init__.py
src/web/people.py
src/web/users.py

index f05467d04937a536263b22bdca21c1d9b51e9b9c..166abdafc0130256b5e0fae4ce0eef215ae87b3a 100644 (file)
@@ -263,8 +263,6 @@ templates_people_DATA = \
        src/templates/people/conferences.html \
        src/templates/people/call.html \
        src/templates/people/calls.html \
-       src/templates/people/group.html \
-       src/templates/people/groups.html \
        src/templates/people/index.html \
        src/templates/people/passwd.html \
        src/templates/people/sip.html \
@@ -305,6 +303,12 @@ templates_users_DATA = \
 
 templates_usersdir = $(templatesdir)/users
 
+templates_users_groups_DATA = \
+       src/templates/users/groups/index.html \
+       src/templates/users/groups/show.html
+
+templates_users_groupsdir = $(templates_usersdir)/groups
+
 templates_users_modules_DATA = \
        src/templates/users/modules/list.html
 
similarity index 95%
rename from src/templates/people/groups.html
rename to src/templates/users/groups/index.html
index 71bb365570b8cca87a2a6f55762310cf04d2e891..ed589127dc409153d074456e8840812d944b62d6 100644 (file)
@@ -1,4 +1,4 @@
-{% extends "../base.html" %}
+{% extends "../../base.html" %}
 
 {% block title %}{{ _("Groups") }}{% end block %}
 
similarity index 95%
rename from src/templates/people/group.html
rename to src/templates/users/groups/show.html
index a31f6d664dceb532860e6790df9b0242336c1dc8..63125b54f642e943c9b98ce06ee1c477fc28fcdb 100644 (file)
@@ -1,4 +1,4 @@
-{% extends "../base.html" %}
+{% extends "../../base.html" %}
 
 {% block title %}{{ group }}{% end block %}
 
index 29bc136babd7fd973fa3fb049b9d061e9ab41c2a..644a95bfd9ab462b6e51c8da11ff5e860ef3bcea 100644 (file)
 
                                                                <nav class="panel">
                                                                        {% for g in account.groups %}
-                                                                               <a class="panel-block" href="/groups/{{ g.gid }}">
+                                                                               <a class="panel-block" href="/users/groups/{{ g.gid }}">
                                                                                        <span class="panel-icon">
                                                                                                <i class="fas fa-users" aria-hidden="true"></i>
                                                                                        </span>
index 784cd8cd2376ed86952c11a9d7f4f370b29ca709..6819343c47f02d0c9210ef626ba1897f0799fa76 100644 (file)
@@ -159,6 +159,10 @@ class Application(tornado.web.Application):
                        (r"/users/([a-z_][a-z0-9_-]{0,31})", users.ShowHandler),
                        (r"/users/([a-z_][a-z0-9_-]{0,31})\.jpg", users.AvatarHandler),
 
+                       # User Groups
+                       (r"/users/groups", users.GroupIndexHandler),
+                       (r"/users/groups/([a-z_][a-z0-9_-]{0,31})", users.GroupShowHandler),
+
                        # RSS feed
                        (r"/news.rss", tornado.web.RedirectHandler, { "url" : "https://blog.ipfire.org/feed.xml" }),
 
@@ -305,8 +309,6 @@ class Application(tornado.web.Application):
                        (r"/", people.IndexHandler),
                        (r"/activate/([a-z_][a-z0-9_-]{0,31})/(\w+)", auth.ActivateHandler),
                        (r"/conferences", people.ConferencesHandler),
-                       (r"/groups", people.GroupsHandler),
-                       (r"/groups/([a-z_][a-z0-9_-]{0,31})", people.GroupHandler),
                        (r"/register", auth.RegisterHandler),
                        (r"/users/([a-z_][a-z0-9_-]{0,31})/calls/([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})", people.CallHandler),
                        (r"/users/([a-z_][a-z0-9_-]{0,31})/calls(?:/(\d{4}-\d{2}-\d{2}))?", people.CallsHandler),
index b4d688954fc01378d58c21e19c67018544b7a0a0..b0258e35565b86a280e12d5d8612642fb3d533c5 100644 (file)
@@ -65,31 +65,6 @@ class ConferencesHandler(auth.CacheMixin, base.BaseHandler):
                self.render("people/conferences.html", conferences=self.backend.talk.conferences)
 
 
-class GroupsHandler(auth.CacheMixin, base.BaseHandler):
-       @tornado.web.authenticated
-       def get(self):
-               # Only staff can see other groups
-               if not self.current_user.is_staff():
-                       raise tornado.web.HTTPError(403)
-
-               self.render("people/groups.html")
-
-
-class GroupHandler(auth.CacheMixin, base.BaseHandler):
-       @tornado.web.authenticated
-       def get(self, gid):
-               # Only staff can see other groups
-               if not self.current_user.is_staff():
-                       raise tornado.web.HTTPError(403)
-
-               # Fetch group
-               group = self.backend.groups.get_by_gid(gid)
-               if not group:
-                       raise tornado.web.HTTPError(404, "Could not find group %s" % gid)
-
-               self.render("people/group.html", group=group)
-
-
 class SubscribeHandler(auth.CacheMixin, base.BaseHandler):
        @tornado.web.authenticated
        def post(self):
index 9b12e6247669bbea7c91d9da52fee0d0acb56879..1453c6d44156d4d16c1250548cbe3c2d0bceaf1f 100644 (file)
@@ -143,6 +143,31 @@ class AvatarHandler(base.BaseHandler):
                        return f.getvalue()
 
 
+class GroupIndexHandler(auth.CacheMixin, base.BaseHandler):
+       @tornado.web.authenticated
+       def get(self):
+               # Only staff can see other groups
+               if not self.current_user.is_staff():
+                       raise tornado.web.HTTPError(403)
+
+               self.render("users/groups/index.html")
+
+
+class GroupShowHandler(auth.CacheMixin, base.BaseHandler):
+       @tornado.web.authenticated
+       def get(self, gid):
+               # Only staff can see other groups
+               if not self.current_user.is_staff():
+                       raise tornado.web.HTTPError(403)
+
+               # Fetch group
+               group = self.backend.groups.get_by_gid(gid)
+               if not group:
+                       raise tornado.web.HTTPError(404, "Could not find group %s" % gid)
+
+               self.render("users/groups/show.html", group=group)
+
+
 class ListModule(ui_modules.UIModule):
        def render(self, accounts, show_created_at=False):
                return self.render_string("users/modules/list.html", accounts=accounts,