3
0
mirror of https://github.com/ergochat/ergo.git synced 2024-12-23 19:22:41 +01:00

Merge pull request #1812 from slingamn/cstransfer

fix case where CS TRANSFER as an operator required acceptance
This commit is contained in:
Shivaram Lingamneni 2021-11-02 20:58:51 -04:00 committed by GitHub
commit d488cf7f57
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 8 deletions

View File

@ -541,13 +541,11 @@ func csTransferHandler(service *ircService, server *Server, client *Client, comm
chname = regInfo.Name chname = regInfo.Name
account := client.Account() account := client.Account()
isFounder := account != "" && account == regInfo.Founder isFounder := account != "" && account == regInfo.Founder
var oper *Oper oper := client.Oper()
if !isFounder { hasPrivs := oper.HasRoleCapab("chanreg")
oper = client.Oper() if !isFounder && !hasPrivs {
if !oper.HasRoleCapab("chanreg") { service.Notice(rb, client.t("Insufficient privileges"))
service.Notice(rb, client.t("Insufficient privileges")) return
return
}
} }
target := params[1] target := params[1]
targetAccount, err := server.accounts.LoadAccount(params[1]) targetAccount, err := server.accounts.LoadAccount(params[1])
@ -569,7 +567,7 @@ func csTransferHandler(service *ircService, server *Server, client *Client, comm
server.snomasks.Send(sno.LocalOpers, message) server.snomasks.Send(sno.LocalOpers, message)
server.logger.Info("opers", message) server.logger.Info("opers", message)
} }
status, err := channel.Transfer(client, target, oper != nil) status, err := channel.Transfer(client, target, hasPrivs)
if err == nil { if err == nil {
switch status { switch status {
case channelTransferComplete: case channelTransferComplete:

View File

@ -1080,6 +1080,9 @@ func schemaChangeV21To22(config *Config, tx *buntdb.Tx) error {
if !strings.HasPrefix(key, settingsPrefix) { if !strings.HasPrefix(key, settingsPrefix) {
return false return false
} }
if value == "" {
return true
}
account := strings.TrimPrefix(key, settingsPrefix) account := strings.TrimPrefix(key, settingsPrefix)
if _, err := tx.Get("account.verified " + account); err != nil { if _, err := tx.Get("account.verified " + account); err != nil {
return true return true