Commit 6e5e73c4 authored by ale's avatar ale
Browse files

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 ...@@ -14,3 +14,8 @@ objectclass: top
objectclass: organizationalUnit objectclass: organizationalUnit
ou: Lists ou: Lists
dn: ou=Newsletters,dc=example,dc=com
objectclass: top
objectclass: organizationalUnit
ou: Lists
...@@ -36,3 +36,15 @@ status: active ...@@ -36,3 +36,15 @@ status: active
uidNumber: 256800 uidNumber: 256800
userPassword:: JGEyJDQkMzI3NjgkMSQwZDgyMzU1YjQ0Mzg0M2NmZDY4MjU1MzE4ZTVjYTdiZSRmNTQ0ODkxOTFiNWZlYzk2MDRlNWQ2ODZjMDQxZjJkNTFmOTgxOGY4ZTFmM2E4MDYzY2U3ZTEwMTE3OTc2OGI0 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 ...@@ -285,15 +285,22 @@ func relatedEmails(ctx context.Context, be domainBackend, addr string) []FindRes
{Type: ResourceTypeEmail, Name: addr}, {Type: ResourceTypeEmail, Name: addr},
} }
user, _ := splitEmailAddr(addr) user, _ := splitEmailAddr(addr)
// Mailing lists must have unique names regardless of the domain, so we // Mailing lists and newsletters must have unique names
// add potential conflicts for mailing lists with the same name over all // regardless of the domain, so we add potential conflicts for
// list-enabled domains. // mailing lists with the same name over all list-enabled
// domains.
for _, d := range be.GetAllowedDomains(ctx, ResourceTypeMailingList) { for _, d := range be.GetAllowedDomains(ctx, ResourceTypeMailingList) {
rel = append(rel, FindResourceRequest{ rel = append(rel, FindResourceRequest{
Type: ResourceTypeMailingList, Type: ResourceTypeMailingList,
Name: fmt.Sprintf("%s@%s", user, d), 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 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