Browse Source

fix #1442

strip local_ from oper capab names, also consolidate unban into ban
tags/v2.5.0-rc1
Shivaram Lingamneni 3 years ago
parent
commit
e195854851
7 changed files with 15 additions and 18 deletions
  1. 2
    3
      default.yaml
  2. 2
    3
      docs/MANUAL.md
  3. 1
    1
      irc/commands.go
  4. 1
    1
      irc/config.go
  5. 4
    4
      irc/handlers.go
  6. 3
    3
      irc/nickserv.go
  7. 2
    3
      traditional.yaml

+ 2
- 3
default.yaml View File

584
 
584
 
585
         # capability names
585
         # capability names
586
         capabilities:
586
         capabilities:
587
-            - "local_kill"
588
-            - "local_ban"
589
-            - "local_unban"
587
+            - "kill"
588
+            - "ban"
590
             - "nofakelag"
589
             - "nofakelag"
591
             - "roleplay"
590
             - "roleplay"
592
             - "relaymsg"
591
             - "relaymsg"

+ 2
- 3
docs/MANUAL.md View File

930
 
930
 
931
         # capability names
931
         # capability names
932
         capabilities:
932
         capabilities:
933
-        - "local_kill"
934
-        - "local_ban"
935
-        - "local_unban"
933
+        - "kill"
934
+        - "ban"
936
         - "nofakelag"
935
         - "nofakelag"
937
 
936
 
938
 # ircd operators
937
 # ircd operators

+ 1
- 1
irc/commands.go View File

170
 			handler:   killHandler,
170
 			handler:   killHandler,
171
 			minParams: 1,
171
 			minParams: 1,
172
 			oper:      true,
172
 			oper:      true,
173
-			capabs:    []string{"local_kill"}, //TODO(dan): when we have S2S, this will be checked in the command handler itself
173
+			capabs:    []string{"kill"},
174
 		},
174
 		},
175
 		"KLINE": {
175
 		"KLINE": {
176
 			handler:   klineHandler,
176
 			handler:   klineHandler,

+ 1
- 1
irc/config.go View File

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

+ 4
- 4
irc/handlers.go View File

826
 func dlineHandler(server *Server, client *Client, msg ircmsg.IrcMessage, rb *ResponseBuffer) bool {
826
 func dlineHandler(server *Server, client *Client, msg ircmsg.IrcMessage, rb *ResponseBuffer) bool {
827
 	// check oper permissions
827
 	// check oper permissions
828
 	oper := client.Oper()
828
 	oper := client.Oper()
829
-	if oper == nil || !oper.Class.Capabilities.Has("local_ban") {
829
+	if oper == nil || !oper.Class.Capabilities.Has("ban") {
830
 		rb.Add(nil, server.name, ERR_NOPRIVS, client.nick, msg.Command, client.t("Insufficient oper privs"))
830
 		rb.Add(nil, server.name, ERR_NOPRIVS, client.nick, msg.Command, client.t("Insufficient oper privs"))
831
 		return false
831
 		return false
832
 	}
832
 	}
1364
 	details := client.Details()
1364
 	details := client.Details()
1365
 	// check oper permissions
1365
 	// check oper permissions
1366
 	oper := client.Oper()
1366
 	oper := client.Oper()
1367
-	if oper == nil || !oper.Class.Capabilities.Has("local_ban") {
1367
+	if oper == nil || !oper.Class.Capabilities.Has("ban") {
1368
 		rb.Add(nil, server.name, ERR_NOPRIVS, details.nick, msg.Command, client.t("Insufficient oper privs"))
1368
 		rb.Add(nil, server.name, ERR_NOPRIVS, details.nick, msg.Command, client.t("Insufficient oper privs"))
1369
 		return false
1369
 		return false
1370
 	}
1370
 	}
2814
 func unDLineHandler(server *Server, client *Client, msg ircmsg.IrcMessage, rb *ResponseBuffer) bool {
2814
 func unDLineHandler(server *Server, client *Client, msg ircmsg.IrcMessage, rb *ResponseBuffer) bool {
2815
 	// check oper permissions
2815
 	// check oper permissions
2816
 	oper := client.Oper()
2816
 	oper := client.Oper()
2817
-	if oper == nil || !oper.Class.Capabilities.Has("local_unban") {
2817
+	if oper == nil || !oper.Class.Capabilities.Has("ban") {
2818
 		rb.Add(nil, server.name, ERR_NOPRIVS, client.nick, msg.Command, client.t("Insufficient oper privs"))
2818
 		rb.Add(nil, server.name, ERR_NOPRIVS, client.nick, msg.Command, client.t("Insufficient oper privs"))
2819
 		return false
2819
 		return false
2820
 	}
2820
 	}
2853
 	details := client.Details()
2853
 	details := client.Details()
2854
 	// check oper permissions
2854
 	// check oper permissions
2855
 	oper := client.Oper()
2855
 	oper := client.Oper()
2856
-	if oper == nil || !oper.Class.Capabilities.Has("local_unban") {
2856
+	if oper == nil || !oper.Class.Capabilities.Has("ban") {
2857
 		rb.Add(nil, server.name, ERR_NOPRIVS, details.nick, msg.Command, client.t("Insufficient oper privs"))
2857
 		rb.Add(nil, server.name, ERR_NOPRIVS, details.nick, msg.Command, client.t("Insufficient oper privs"))
2858
 		return false
2858
 		return false
2859
 	}
2859
 	}

+ 3
- 3
irc/nickserv.go View File

1090
 
1090
 
1091
 func nsClientsListHandler(service *ircService, server *Server, client *Client, params []string, rb *ResponseBuffer) {
1091
 func nsClientsListHandler(service *ircService, server *Server, client *Client, params []string, rb *ResponseBuffer) {
1092
 	target := client
1092
 	target := client
1093
-	hasPrivs := client.HasRoleCapabs("local_ban")
1093
+	hasPrivs := client.HasRoleCapabs("ban")
1094
 	if 0 < len(params) {
1094
 	if 0 < len(params) {
1095
 		target = server.clients.Get(params[0])
1095
 		target = server.clients.Get(params[0])
1096
 		if target == nil {
1096
 		if target == nil {
1141
 			service.Notice(rb, client.t("No such nick"))
1141
 			service.Notice(rb, client.t("No such nick"))
1142
 			return
1142
 			return
1143
 		}
1143
 		}
1144
-		// User must have "local_kill" privileges to logout other user sessions.
1144
+		// User must have "kill" privileges to logout other user sessions.
1145
 		if target != client {
1145
 		if target != client {
1146
 			oper := client.Oper()
1146
 			oper := client.Oper()
1147
-			if oper == nil || !oper.Class.Capabilities.Has("local_kill") {
1147
+			if oper == nil || !oper.Class.Capabilities.Has("kill") {
1148
 				service.Notice(rb, client.t("Insufficient oper privs"))
1148
 				service.Notice(rb, client.t("Insufficient oper privs"))
1149
 				return
1149
 				return
1150
 			}
1150
 			}

+ 2
- 3
traditional.yaml View File

556
 
556
 
557
         # capability names
557
         # capability names
558
         capabilities:
558
         capabilities:
559
-            - "local_kill"
560
-            - "local_ban"
561
-            - "local_unban"
559
+            - "kill"
560
+            - "ban"
562
             - "nofakelag"
561
             - "nofakelag"
563
             - "roleplay"
562
             - "roleplay"
564
             - "relaymsg"
563
             - "relaymsg"

Loading…
Cancel
Save