3
0
mirror of https://github.com/ergochat/ergo.git synced 2024-12-22 18:52:41 +01:00
strip local_ from oper capab names, also consolidate unban into ban
This commit is contained in:
Shivaram Lingamneni 2021-01-15 08:24:42 -05:00
parent 8769e2d92a
commit e195854851
7 changed files with 15 additions and 18 deletions

View File

@ -584,9 +584,8 @@ oper-classes:
# capability names
capabilities:
- "local_kill"
- "local_ban"
- "local_unban"
- "kill"
- "ban"
- "nofakelag"
- "roleplay"
- "relaymsg"

View File

@ -930,9 +930,8 @@ oper-classes:
# capability names
capabilities:
- "local_kill"
- "local_ban"
- "local_unban"
- "kill"
- "ban"
- "nofakelag"
# ircd operators

View File

@ -170,7 +170,7 @@ func init() {
handler: killHandler,
minParams: 1,
oper: true,
capabs: []string{"local_kill"}, //TODO(dan): when we have S2S, this will be checked in the command handler itself
capabs: []string{"kill"},
},
"KLINE": {
handler: klineHandler,

View File

@ -649,7 +649,7 @@ type OperClass struct {
// OperatorClasses returns a map of assembled operator classes from the given config.
func (conf *Config) OperatorClasses() (map[string]*OperClass, error) {
fixupCapability := func(capab string) string {
return strings.TrimPrefix(capab, "oper:") // #868
return strings.TrimPrefix(strings.TrimPrefix(capab, "oper:"), "local_") // #868, #1442
}
ocs := make(map[string]*OperClass)

View File

@ -826,7 +826,7 @@ func formatBanForListing(client *Client, key string, info IPBanInfo) string {
func dlineHandler(server *Server, client *Client, msg ircmsg.IrcMessage, rb *ResponseBuffer) bool {
// check oper permissions
oper := client.Oper()
if oper == nil || !oper.Class.Capabilities.Has("local_ban") {
if oper == nil || !oper.Class.Capabilities.Has("ban") {
rb.Add(nil, server.name, ERR_NOPRIVS, client.nick, msg.Command, client.t("Insufficient oper privs"))
return false
}
@ -1364,7 +1364,7 @@ func klineHandler(server *Server, client *Client, msg ircmsg.IrcMessage, rb *Res
details := client.Details()
// check oper permissions
oper := client.Oper()
if oper == nil || !oper.Class.Capabilities.Has("local_ban") {
if oper == nil || !oper.Class.Capabilities.Has("ban") {
rb.Add(nil, server.name, ERR_NOPRIVS, details.nick, msg.Command, client.t("Insufficient oper privs"))
return false
}
@ -2814,7 +2814,7 @@ func topicHandler(server *Server, client *Client, msg ircmsg.IrcMessage, rb *Res
func unDLineHandler(server *Server, client *Client, msg ircmsg.IrcMessage, rb *ResponseBuffer) bool {
// check oper permissions
oper := client.Oper()
if oper == nil || !oper.Class.Capabilities.Has("local_unban") {
if oper == nil || !oper.Class.Capabilities.Has("ban") {
rb.Add(nil, server.name, ERR_NOPRIVS, client.nick, msg.Command, client.t("Insufficient oper privs"))
return false
}
@ -2853,7 +2853,7 @@ func unKLineHandler(server *Server, client *Client, msg ircmsg.IrcMessage, rb *R
details := client.Details()
// check oper permissions
oper := client.Oper()
if oper == nil || !oper.Class.Capabilities.Has("local_unban") {
if oper == nil || !oper.Class.Capabilities.Has("ban") {
rb.Add(nil, server.name, ERR_NOPRIVS, details.nick, msg.Command, client.t("Insufficient oper privs"))
return false
}

View File

@ -1090,7 +1090,7 @@ func nsClientsHandler(service *ircService, server *Server, client *Client, comma
func nsClientsListHandler(service *ircService, server *Server, client *Client, params []string, rb *ResponseBuffer) {
target := client
hasPrivs := client.HasRoleCapabs("local_ban")
hasPrivs := client.HasRoleCapabs("ban")
if 0 < len(params) {
target = server.clients.Get(params[0])
if target == nil {
@ -1141,10 +1141,10 @@ func nsClientsLogoutHandler(service *ircService, server *Server, client *Client,
service.Notice(rb, client.t("No such nick"))
return
}
// User must have "local_kill" privileges to logout other user sessions.
// User must have "kill" privileges to logout other user sessions.
if target != client {
oper := client.Oper()
if oper == nil || !oper.Class.Capabilities.Has("local_kill") {
if oper == nil || !oper.Class.Capabilities.Has("kill") {
service.Notice(rb, client.t("Insufficient oper privs"))
return
}

View File

@ -556,9 +556,8 @@ oper-classes:
# capability names
capabilities:
- "local_kill"
- "local_ban"
- "local_unban"
- "kill"
- "ban"
- "nofakelag"
- "roleplay"
- "relaymsg"