Actually check if alias is reserved (#534)
This commit is contained in:
parent
ae19db60e3
commit
385cab8dc9
|
@ -115,9 +115,12 @@ func SetLocalAlias(
|
||||||
|
|
||||||
// Check that the alias does not fall within an exclusive namespace of an
|
// Check that the alias does not fall within an exclusive namespace of an
|
||||||
// application service
|
// application service
|
||||||
|
// TODO: This code should eventually be refactored with:
|
||||||
|
// 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
|
||||||
for _, appservice := range cfg.Derived.ApplicationServices {
|
for _, appservice := range cfg.Derived.ApplicationServices {
|
||||||
if userNamespaces, ok := appservice.NamespaceMap["users"]; ok {
|
if aliasNamespaces, ok := appservice.NamespaceMap["aliases"]; ok {
|
||||||
for _, namespace := range userNamespaces {
|
for _, namespace := range aliasNamespaces {
|
||||||
if namespace.Exclusive && namespace.RegexpObject.MatchString(alias) {
|
if namespace.Exclusive && namespace.RegexpObject.MatchString(alias) {
|
||||||
return util.JSONResponse{
|
return util.JSONResponse{
|
||||||
Code: http.StatusBadRequest,
|
Code: http.StatusBadRequest,
|
||||||
|
|
Loading…
Reference in a new issue