Implement message permission and shutup command.
This commit is contained in:
@@ -106,6 +106,15 @@ func (token *Stateful) Check(host, group string, username *string) (string, []st
|
||||
return user, token.Permissions, nil
|
||||
}
|
||||
|
||||
func member(v string, l []string) bool {
|
||||
for _, w := range l {
|
||||
if v == w {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// load updates the state from the corresponding file.
|
||||
// called locked
|
||||
func (state *state) load() (string, error) {
|
||||
@@ -155,6 +164,12 @@ func (state *state) load() (string, error) {
|
||||
state.fileSize = 0
|
||||
return "", err
|
||||
}
|
||||
// the "message" permission was introduced in Galene 0.9,
|
||||
// so add it to tokens read from disk. We can remove this
|
||||
// hack in late 2024.
|
||||
if !member("message", t.Permissions) {
|
||||
t.Permissions = append(t.Permissions, "message")
|
||||
}
|
||||
ts[t.Token] = &t
|
||||
}
|
||||
state.tokens = ts
|
||||
|
||||
Reference in New Issue
Block a user