3
0
mirror of https://github.com/ergochat/ergo.git synced 2026-04-26 10:38:23 +02:00

fix missing read permissions checks for METADATA (#2382)

These were incorrectly refactored out in #2277.
Also group the two write subcommands together, then the
three read subcommands.
This commit is contained in:
Shivaram Lingamneni 2026-04-13 19:46:10 -07:00 committed by GitHub
parent 5bb94efaf6
commit 10da32292f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -3269,6 +3269,16 @@ func metadataRegisteredHandler(client *Client, config *Config, subcommand string
}
}
case "clear":
if !metadataCanIEditThisTarget(client, targetObj) {
noKeyPerms("*")
return
}
values := targetObj.ClearMetadata()
playMetadataList(rb, client.Nick(), target, values)
case "get":
if !metadataCanISeeThisTarget(client, targetObj) {
noKeyPerms("*")
@ -3295,19 +3305,19 @@ func metadataRegisteredHandler(client *Client, config *Config, subcommand string
}
case "list":
playMetadataList(rb, client.Nick(), target, targetObj.ListMetadata())
case "clear":
if !metadataCanIEditThisTarget(client, targetObj) {
if !metadataCanISeeThisTarget(client, targetObj) {
noKeyPerms("*")
return
}
values := targetObj.ClearMetadata()
playMetadataList(rb, client.Nick(), target, values)
playMetadataList(rb, client.Nick(), target, targetObj.ListMetadata())
case "sync":
if !metadataCanISeeThisTarget(client, targetObj) {
noKeyPerms("*")
return
}
if targetChannel != nil {
syncChannelMetadata(server, rb, targetChannel)
}