Update a couple permissions things, no longer allow anonymous users.

This commit is contained in:
Storm Dragon
2026-05-24 00:26:48 -04:00
parent 3e06de7501
commit 3df0c22948
6 changed files with 134 additions and 4 deletions
+7 -1
View File
@@ -560,6 +560,12 @@ func AddClient(hall string, c Client, creds ClientCredentials) (*Hall, error) {
c.SetUsername(username)
c.SetPermissions(perms)
for _, cc := range clients {
if !isSystemClient(cc) && cc.Username() == username {
return nil, UserError("username already in use")
}
}
if !member("op", perms) {
if g.locked != nil {
m := *g.locked
@@ -1005,7 +1011,7 @@ func (g *Hall) userExists(username string) bool {
// usernames might lead to security vulnaribilities.
// For now, we just do the minimal validation that avoids path traversal.
func validUsername(username string) bool {
return username == "" || validHallName(username)
return username != "" && validHallName(username)
}
// called locked