Skip to content

Commit

Permalink
Remove dead, untested code from userIDIsWithinApplicationServiceNames…
Browse files Browse the repository at this point in the history
…pace
  • Loading branch information
vijfhoek committed Jan 11, 2023
1 parent 872dee4 commit c52f212
Showing 1 changed file with 7 additions and 22 deletions.
29 changes: 7 additions & 22 deletions internal/validate.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,33 +139,18 @@ func userIDIsWithinApplicationServiceNamespace(
return false
}

if appservice != nil {
if appservice.SenderLocalpart == local {
return true
}

// Loop through given application service's namespaces and see if any match
for _, namespace := range appservice.NamespaceMap["users"] {
// AS namespaces are checked for validity in config
if namespace.RegexpObject.MatchString(userID) {
return true
}
}
return false
if appservice.SenderLocalpart == local {
return true
}

// Loop through all known application service's namespaces and see if any match
for _, knownAppService := range cfg.Derived.ApplicationServices {
if knownAppService.SenderLocalpart == local {
// Loop through given application service's namespaces and see if any match
for _, namespace := range appservice.NamespaceMap["users"] {
// AS namespaces are checked for validity in config
if namespace.RegexpObject.MatchString(userID) {
return true
}
for _, namespace := range knownAppService.NamespaceMap["users"] {
// AS namespaces are checked for validity in config
if namespace.RegexpObject.MatchString(userID) {
return true
}
}
}

return false
}

Expand Down

0 comments on commit c52f212

Please sign in to comment.