Commit 6e5e73c4 authored by ale's avatar ale

Add newsletters to the global unique email namespace for validation

parent b5cacff5
Pipeline #3977 passed with stages
in 6 minutes and 1 second
......@@ -14,3 +14,8 @@ objectclass: top
objectclass: organizationalUnit
ou: Lists
dn: ou=Newsletters,dc=example,dc=com
objectclass: top
objectclass: organizationalUnit
ou: Lists
......@@ -36,3 +36,15 @@ status: active
uidNumber: 256800
userPassword:: JGEyJDQkMzI3NjgkMSQwZDgyMzU1YjQ0Mzg0M2NmZDY4MjU1MzE4ZTVjYTdiZSRmNTQ0ODkxOTFiNWZlYzk2MDRlNWQ2ODZjMDQxZjJkNTFmOTgxOGY4ZTFmM2E4MDYzY2U3ZTEwMTE3OTc2OGI0
dn: listName=newsletter1@investici.org,ou=Newsletters,dc=example,dc=com
status: active
listName: newsletter1@investici.org
objectClass: top
objectClass: mailingList
listDescription: No description
host: host2
creationDate: 21-03-2019
listOwner: tre@investici.org
public: no
originalHost: host2
......@@ -285,15 +285,22 @@ func relatedEmails(ctx context.Context, be domainBackend, addr string) []FindRes
{Type: ResourceTypeEmail, Name: addr},
}
user, _ := splitEmailAddr(addr)
// Mailing lists must have unique names regardless of the domain, so we
// add potential conflicts for mailing lists with the same name over all
// list-enabled domains.
// Mailing lists and newsletters must have unique names
// regardless of the domain, so we add potential conflicts for
// mailing lists with the same name over all list-enabled
// domains.
for _, d := range be.GetAllowedDomains(ctx, ResourceTypeMailingList) {
rel = append(rel, FindResourceRequest{
Type: ResourceTypeMailingList,
Name: fmt.Sprintf("%s@%s", user, d),
})
}
for _, d := range be.GetAllowedDomains(ctx, ResourceTypeNewsletter) {
rel = append(rel, FindResourceRequest{
Type: ResourceTypeNewsletter,
Name: fmt.Sprintf("%s@%s", user, d),
})
}
return rel
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment