mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-16 19:33:09 -06:00
Fix #661 appservice can't set aliases in its namespace
Signed-off-by: Alex Chen <minecnly@gmail.com>
This commit is contained in:
parent
da0dd06475
commit
9a989686e5
|
|
@ -117,12 +117,14 @@ func SetLocalAlias(
|
||||||
// 1. The new method for checking for things matching an AS's namespace
|
// 1. The new method for checking for things matching an AS's namespace
|
||||||
// 2. Using an overall Regex object for all AS's just like we did for usernames
|
// 2. Using an overall Regex object for all AS's just like we did for usernames
|
||||||
for _, appservice := range cfg.Derived.ApplicationServices {
|
for _, appservice := range cfg.Derived.ApplicationServices {
|
||||||
if aliasNamespaces, ok := appservice.NamespaceMap["aliases"]; ok {
|
if device.UserID != appservice.SenderLocalpart {
|
||||||
for _, namespace := range aliasNamespaces {
|
if aliasNamespaces, ok := appservice.NamespaceMap["aliases"]; ok {
|
||||||
if namespace.Exclusive && namespace.RegexpObject.MatchString(alias) {
|
for _, namespace := range aliasNamespaces {
|
||||||
return util.JSONResponse{
|
if namespace.Exclusive && namespace.RegexpObject.MatchString(alias) {
|
||||||
Code: http.StatusBadRequest,
|
return util.JSONResponse{
|
||||||
JSON: jsonerror.ASExclusive("Alias is reserved by an application service"),
|
Code: http.StatusBadRequest,
|
||||||
|
JSON: jsonerror.ASExclusive("Alias is reserved by an application service"),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue