aboutsummaryrefslogtreecommitdiff
path: root/src/pgpmailman/rest/root.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/pgpmailman/rest/root.py')
-rw-r--r--src/pgpmailman/rest/root.py32
1 files changed, 29 insertions, 3 deletions
diff --git a/src/pgpmailman/rest/root.py b/src/pgpmailman/rest/root.py
index a0dd3fa..b937fd3 100644
--- a/src/pgpmailman/rest/root.py
+++ b/src/pgpmailman/rest/root.py
@@ -1,14 +1,40 @@
+"""
+REST root.
+
+
+/lists/ -> List all known encrypted lists.
+/lists/<list_id>/ ->
+/lists/<list_id>/key -> GET list_public_key
+/lists/<list_id>/archive/key -> GET/POST list_archive_public_key
+
+/users/ -> List all known users of encrypted lists.
+/users/<uid>/ ->
+/users/<uid>/key -> GET/POST user_public_key
+
+"""
+
from mailman.rest.helpers import child
+from pgpmailman.rest.lists import AllEncryptedLists, AnEncryptedList
+from pgpmailman.rest.users import AUser, AllUsers
from public import public
@public
class RESTRoot:
-
@child()
def lists(self, context, segments):
- pass
+ if len(segments) == 0:
+ return AllEncryptedLists(), []
+ else:
+ list_name = segments.pop(0)
+ # WIP Check whether it's an encrypted list we know of here.
+ return AnEncryptedList(list_name), segments
@child()
def users(self, context, segments):
- pass
+ if len(segments) == 0:
+ return AllUsers(), []
+ else:
+ uid = segments.pop(0)
+ # WIP Check whether it's an encrypted user we know of here.
+ return AUser(uid), segments