summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/mailman/docs/NEWS.rst1
-rw-r--r--src/mailman/rest/docs/membership.rst11
-rw-r--r--src/mailman/rest/lists.py14
3 files changed, 22 insertions, 4 deletions
diff --git a/src/mailman/docs/NEWS.rst b/src/mailman/docs/NEWS.rst
index 57e3ad43d..3528400b9 100644
--- a/src/mailman/docs/NEWS.rst
+++ b/src/mailman/docs/NEWS.rst
@@ -29,6 +29,7 @@ REST
member records. Arguments are `subscriber` (email address to search for -
required), `fqdn_listname` (optional), and `role` (i.e. MemberRole -
optional). (LP: #799612)
+ * Fixed /lists/<fqdn_listname>/<role>/<email> (LP: #825570)
Commands
--------
diff --git a/src/mailman/rest/docs/membership.rst b/src/mailman/rest/docs/membership.rst
index 179ac99fe..6932459dc 100644
--- a/src/mailman/rest/docs/membership.rst
+++ b/src/mailman/rest/docs/membership.rst
@@ -258,6 +258,17 @@ mailing list.
Finding members
===============
+A specific member can always be referenced by their role and address.
+
+ >>> dump_json('http://localhost:9001/3.0/lists/'
+ ... 'bee@example.com/owner/cperson@example.com')
+ address: cperson@example.com
+ fqdn_listname: bee@example.com
+ http_etag: ...
+ role: owner
+ self_link: http://localhost:9001/3.0/members/7
+ user: http://localhost:9001/3.0/users/2
+
You can find a specific member based on several different criteria. For
example, we can search for all the memberships of a particular address.
diff --git a/src/mailman/rest/lists.py b/src/mailman/rest/lists.py
index 3edb43b00..a8b4fac4f 100644
--- a/src/mailman/rest/lists.py
+++ b/src/mailman/rest/lists.py
@@ -36,6 +36,7 @@ from mailman.interfaces.domain import BadDomainSpecificationError
from mailman.interfaces.listmanager import (
IListManager, ListAlreadyExistsError)
from mailman.interfaces.member import MemberRole
+from mailman.interfaces.subscriptions import ISubscriptionService
from mailman.rest.configuration import ListConfiguration
from mailman.rest.helpers import (
CollectionMixin, etag, no_content, path_to, restish_matcher)
@@ -48,7 +49,7 @@ from mailman.rest.validator import Validator
def member_matcher(request, segments):
"""A matcher of member URLs inside mailing lists.
- e.g. /member/aperson@example.org
+ e.g. /<role>/aperson@example.org
"""
if len(segments) != 2:
return None
@@ -60,7 +61,7 @@ def member_matcher(request, segments):
# No more segments.
# XXX 2010-02-25 barry Matchers are undocumented in restish; they return a
# 3-tuple of (match_args, match_kws, segments).
- return (), dict(role=role, address=segments[1]), ()
+ return (), dict(role=role, email=segments[1]), ()
@restish_matcher
@@ -145,11 +146,16 @@ class AList(_ListBase):
return no_content()
@resource.child(member_matcher)
- def member(self, request, segments, role, address):
+ def member(self, request, segments, role, email):
"""Return a single member representation."""
if self._mlist is None:
return http.not_found()
- return AMember(self._mlist, role, address)
+ members = getUtility(ISubscriptionService).find_members(
+ email, self._mlist.fqdn_listname, role)
+ if len(members) == 0:
+ return http.not_found()
+ assert len(members) == 1, 'Too many matches'
+ return AMember(members[0].member_id)
@resource.child(roster_matcher)
def roster(self, request, segments, role):