[Bug 1312884] [NEW] REST: creating a user from an existing address

Aurélien Bompard aurelien at bompard.org
Fri Apr 25 21:03:17 CEST 2014

Public bug reported:

I'm trying to create a User in Mailman 3 from an existing Address. The
existing address is currently unlinked and unverified, and I'd like to
create a user and link it to it

Here's what Barry suggests :

You might want to create the user and link to it from the existing
address resource, i.e. the AnAddress class.

Right now, you cannot get directly from the address to its linked user,
if it has one.  Look at _AddressBase._resource_as_dict() in

Sketching out an approach:

 - The address resource would gain a `user` key if there is a linked
user. This would be a url to the user resource.  If the address is
unlinked, then there would be no such key.

 - AnAddress would gain a /user sub-resource which would either 404 if
the address is unlinked or return the linked user's JSON data.

 - POSTing to /addresses/<email>/user would create a new user and link
the address to it, but only if the address is not yet linked.  If it's
already linked, you'd get a 409 Conflict error.  If the new user is
created, you'd get 201 Created response.

Additional use cases to consider:

Q. What if the address is already linked and you want to unlink it?
A. DELETE on the /addresses/<email>/user resource

Q. What if you want to change the user the address is linked to?
A. Currently, it's two operations: DELETE the existing link as above, then see below.  The other option is to allow a PUT on the /addresses/<email>/user resource.

Q. What if you want to link the unlinked address to an existing user?
A. Maybe allow this in the POST to /addresses/<email>/user, i.e. the user would only be created if it doesn't yet exist.  If it gets created, you'd get a 201 Created, but if it's just a link operation to an existing user, you'd get a 200 Success response.

It's possibly you'd want to include POST boolean that specifies whether
creating a new user is okay or not, with the appropriate response codes
in the false case.

** Affects: mailman
     Importance: Undecided
         Status: New

You received this bug notification because you are a member of Mailman
Coders, which is subscribed to GNU Mailman.

  REST: creating a user from an existing address

To manage notifications about this bug go to:

More information about the Mailman-coders mailing list