mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-26 00:03:09 -06:00
Also fix the senderLocalpart problem
This commit is contained in:
parent
2eef224435
commit
67ab81b866
|
|
@ -328,7 +328,18 @@ func UserIDIsWithinApplicationServiceNamespace(
|
||||||
userID string,
|
userID string,
|
||||||
appservice *config.ApplicationService,
|
appservice *config.ApplicationService,
|
||||||
) bool {
|
) bool {
|
||||||
|
|
||||||
|
var local, _, err = gomatrixserverlib.SplitID('@', userID)
|
||||||
|
if err != nil {
|
||||||
|
// Not a valid userID
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
if appservice != nil {
|
if appservice != nil {
|
||||||
|
if appservice.SenderLocalpart == local {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
// Loop through given application service's namespaces and see if any match
|
// Loop through given application service's namespaces and see if any match
|
||||||
for _, namespace := range appservice.NamespaceMap["users"] {
|
for _, namespace := range appservice.NamespaceMap["users"] {
|
||||||
// AS namespaces are checked for validity in config
|
// AS namespaces are checked for validity in config
|
||||||
|
|
@ -341,6 +352,9 @@ func UserIDIsWithinApplicationServiceNamespace(
|
||||||
|
|
||||||
// Loop through all known application service's namespaces and see if any match
|
// Loop through all known application service's namespaces and see if any match
|
||||||
for _, knownAppService := range cfg.Derived.ApplicationServices {
|
for _, knownAppService := range cfg.Derived.ApplicationServices {
|
||||||
|
if knownAppService.SenderLocalpart == local {
|
||||||
|
return true
|
||||||
|
}
|
||||||
for _, namespace := range knownAppService.NamespaceMap["users"] {
|
for _, namespace := range knownAppService.NamespaceMap["users"] {
|
||||||
// AS namespaces are checked for validity in config
|
// AS namespaces are checked for validity in config
|
||||||
if namespace.RegexpObject.MatchString(userID) {
|
if namespace.RegexpObject.MatchString(userID) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue