Explorar o código

편집 필터 관련 권한 추가

https://github.com/openNAMU/openNAMU/issues/2336
잉여개발기 (SPDV) hai 1 ano
pai
achega
cb06676c25

+ 4 - 0
route/filter_all.py

@@ -16,6 +16,10 @@ def filter_all(tool):
         admin = acl_check(tool = 'owner_auth')
         admin = 1 if admin == 0 else 0
 
+        if tool == 'edit_filter':
+            if acl_check('', 'edit_filter_view', '', '') == 1:
+                return re_error(conn, 0)
+
         if tool == 'inter_wiki':
             title = get_lang(conn, 'interwiki_list')
             curs.execute(db_change("select html, plus, plus_t from html_filter where kind = 'inter_wiki'"))

+ 2 - 0
route/give_admin_groups.py

@@ -34,6 +34,7 @@ def give_admin_groups(name = 'test'):
                         [4, 'multiple_upload', get_lang(conn, 'multiple_upload_authority')],
                         [4, 'slow_edit_pass', get_lang(conn, 'slow_edit_pass_authority')],
                         [4, 'edit_bottom_compulsion_pass', get_lang(conn, 'edit_bottom_compulsion_pass_authority')],
+                        [3, 'edit_filter_pass', get_lang(conn, 'edit_filter_pass_authority')],
                         [4, '', get_lang(conn, 'user_authority')],
             [1, 'user', get_lang(conn, 'user_authority')],
                 [2, 'captcha_pass', get_lang(conn, 'captcha_pass_authority')],
@@ -63,6 +64,7 @@ def give_admin_groups(name = 'test'):
                             [5, '', get_lang(conn, 'bbs_view_authority')],
                         [4, 'bbs_view', get_lang(conn, 'bbs_view_authority')],
                     [3, 'captcha_one_check_five_pass', get_lang(conn, 'captcha_one_check_five_pass_authority')],
+                    [3, 'edit_filter_view', get_lang(conn, 'edit_filter_view_authority')],
                     [3, 'nothing', get_lang(conn, 'nothing_authority')]
         ]
 

+ 1 - 1
route/tool/func.py

@@ -2065,7 +2065,7 @@ def do_edit_filter(conn, data):
     curs = conn.cursor()
 
     ip = ip_check()
-    if acl_check(tool = 'ban_auth') == 1:
+    if acl_check(tool = 'edit_filter_pass') == 1:
         curs.execute(db_change("select plus, plus_t from html_filter where kind = 'regex_filter' and plus != ''"))
         for data_list in curs.fetchall():
             match = re.compile(data_list[0], re.I)

BIN=BIN
route_go/bin/main.amd64.bin


BIN=BIN
route_go/bin/main.amd64.exe


BIN=BIN
route_go/bin/main.arm64.bin


BIN=BIN
route_go/bin/main.arm64.exe


+ 18 - 2
route_go/route/tool/acl_and_auth.go

@@ -185,7 +185,7 @@ func Check_auth(auth_info map[string]bool) map[string]bool {
 		auth_info["admin_default_feature"] = true
 	}
 
-	admin_default_feature := []string{"treat_as_admin", "user_name_bold", "multiple_upload", "slow_edit_pass", "edit_bottom_compulsion_pass", "view_hide_user_name", "doc_watch_list_view", "user"}
+	admin_default_feature := []string{"treat_as_admin", "user_name_bold", "multiple_upload", "slow_edit_pass", "edit_bottom_compulsion_pass", "view_hide_user_name", "doc_watch_list_view", "edit_filter_pass", "user"}
 
 	if _, ok := auth_info["admin_default_feature"]; ok {
 		for _, v := range admin_default_feature {
@@ -201,7 +201,7 @@ func Check_auth(auth_info map[string]bool) map[string]bool {
 		}
 	}
 
-	ip_default := []string{"document", "discuss", "upload", "vote", "bbs_use", "captcha_one_check_five_pass"}
+	ip_default := []string{"document", "discuss", "upload", "vote", "bbs_use", "captcha_one_check_five_pass", "edit_filter_view"}
 
 	if _, ok := auth_info["ip"]; ok {
 		for _, v := range ip_default {
@@ -795,6 +795,22 @@ func Check_acl(db *sql.DB, name string, topic_number string, tool string, ip str
 			} else {
 				acl_data = "owner"
 			}
+		} else if tool == "edit_filter_pass" {
+			acl_pass_auth = "admin_default_feature"
+
+			if auth_info["edit_filter_pass"] {
+				acl_data = ""
+			} else {
+				acl_data = "owner"
+			}
+		} else if tool == "edit_filter_view" {
+			acl_pass_auth = "edit_filter_pass"
+
+			if auth_info["edit_filter_view"] {
+				acl_data = ""
+			} else {
+				acl_data = "owner"
+			}
 		} else if tool == "view_hide_user_name" {
 			acl_pass_auth = "admin_default_feature"
 

+ 1 - 1
version.json

@@ -1,6 +1,6 @@
 {
     "beta" : {
-        "r_ver" : "v3.5.0-v176",
+        "r_ver" : "v3.5.0-v177",
         "c_ver" : "20240513",
         "s_ver" : "20240426"
     }