Переглянути джерело

fix #1442

strip local_ from oper capab names, also consolidate unban into ban
tags/v2.5.0-rc1
Shivaram Lingamneni 3 роки тому
джерело
коміт
e195854851
7 змінених файлів з 15 додано та 18 видалено
  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 Переглянути файл

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

+ 2
- 3
docs/MANUAL.md Переглянути файл

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

+ 1
- 1
irc/commands.go Переглянути файл

@@ -170,7 +170,7 @@ func init() {
170 170
 			handler:   killHandler,
171 171
 			minParams: 1,
172 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 175
 		"KLINE": {
176 176
 			handler:   klineHandler,

+ 1
- 1
irc/config.go Переглянути файл

@@ -649,7 +649,7 @@ type OperClass struct {
649 649
 // OperatorClasses returns a map of assembled operator classes from the given config.
650 650
 func (conf *Config) OperatorClasses() (map[string]*OperClass, error) {
651 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 655
 	ocs := make(map[string]*OperClass)

+ 4
- 4
irc/handlers.go Переглянути файл

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

+ 3
- 3
irc/nickserv.go Переглянути файл

@@ -1090,7 +1090,7 @@ func nsClientsHandler(service *ircService, server *Server, client *Client, comma
1090 1090
 
1091 1091
 func nsClientsListHandler(service *ircService, server *Server, client *Client, params []string, rb *ResponseBuffer) {
1092 1092
 	target := client
1093
-	hasPrivs := client.HasRoleCapabs("local_ban")
1093
+	hasPrivs := client.HasRoleCapabs("ban")
1094 1094
 	if 0 < len(params) {
1095 1095
 		target = server.clients.Get(params[0])
1096 1096
 		if target == nil {
@@ -1141,10 +1141,10 @@ func nsClientsLogoutHandler(service *ircService, server *Server, client *Client,
1141 1141
 			service.Notice(rb, client.t("No such nick"))
1142 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 1145
 		if target != client {
1146 1146
 			oper := client.Oper()
1147
-			if oper == nil || !oper.Class.Capabilities.Has("local_kill") {
1147
+			if oper == nil || !oper.Class.Capabilities.Has("kill") {
1148 1148
 				service.Notice(rb, client.t("Insufficient oper privs"))
1149 1149
 				return
1150 1150
 			}

+ 2
- 3
traditional.yaml Переглянути файл

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

Завантаження…
Відмінити
Зберегти