mirror of
https://github.com/ergochat/ergo.git
synced 2024-11-25 13:29:27 +01:00
fix #1442
strip local_ from oper capab names, also consolidate unban into ban
This commit is contained in:
parent
8769e2d92a
commit
e195854851
@ -584,9 +584,8 @@ oper-classes:
|
||||
|
||||
# capability names
|
||||
capabilities:
|
||||
- "local_kill"
|
||||
- "local_ban"
|
||||
- "local_unban"
|
||||
- "kill"
|
||||
- "ban"
|
||||
- "nofakelag"
|
||||
- "roleplay"
|
||||
- "relaymsg"
|
||||
|
@ -930,9 +930,8 @@ oper-classes:
|
||||
|
||||
# capability names
|
||||
capabilities:
|
||||
- "local_kill"
|
||||
- "local_ban"
|
||||
- "local_unban"
|
||||
- "kill"
|
||||
- "ban"
|
||||
- "nofakelag"
|
||||
|
||||
# ircd operators
|
||||
|
@ -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,
|
||||
|
@ -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)
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -556,9 +556,8 @@ oper-classes:
|
||||
|
||||
# capability names
|
||||
capabilities:
|
||||
- "local_kill"
|
||||
- "local_ban"
|
||||
- "local_unban"
|
||||
- "kill"
|
||||
- "ban"
|
||||
- "nofakelag"
|
||||
- "roleplay"
|
||||
- "relaymsg"
|
||||
|
Loading…
Reference in New Issue
Block a user