diff options
| author | J08nY | 2017-06-09 17:41:24 +0200 |
|---|---|---|
| committer | J08nY | 2017-06-09 17:41:24 +0200 |
| commit | b932ba4a32f208aa934bad8b4039e8c871b6715f (patch) | |
| tree | c93f1277353928446dccaa4e16845fe9a83372b5 /src/mailman_pgp/rest/root.py | |
| parent | 25487795779c05ff8e97680550948443924b98c0 (diff) | |
| download | mailman-pgp-b932ba4a32f208aa934bad8b4039e8c871b6715f.tar.gz mailman-pgp-b932ba4a32f208aa934bad8b4039e8c871b6715f.tar.zst mailman-pgp-b932ba4a32f208aa934bad8b4039e8c871b6715f.zip | |
Diffstat (limited to 'src/mailman_pgp/rest/root.py')
| -rw-r--r-- | src/mailman_pgp/rest/root.py | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/src/mailman_pgp/rest/root.py b/src/mailman_pgp/rest/root.py new file mode 100644 index 0000000..286d9ae --- /dev/null +++ b/src/mailman_pgp/rest/root.py @@ -0,0 +1,39 @@ +""" +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 public import public + +from mailman_pgp.rest.lists import AllEncryptedLists, AnEncryptedList +from mailman_pgp.rest.users import AllUsers, AUser + + +@public +class RESTRoot: + @child() + def lists(self, context, segments): + if len(segments) == 0: + return AllEncryptedLists(), [] + else: + list_id = segments.pop(0) + return AnEncryptedList(list_id), segments + + @child() + def users(self, context, segments): + if len(segments) == 0: + return AllUsers(), [] + else: + uid = segments.pop(0) + return AUser(uid), segments |
