OSDN Git Service

BugTrack/2565 Fix read_auth and edit_auth apply condition branch_r1_5 master r1_5_4
authorumorigu <umorigu@gmail.com>
Sat, 26 Mar 2022 16:49:30 +0000 (01:49 +0900)
committerumorigu <umorigu@gmail.com>
Sat, 26 Mar 2022 16:49:30 +0000 (01:49 +0900)
* if $read_auth is 0, is_page_readable() always returns TRUE
* if $edit_auth is 0, is_page_writable() always returns TRUE

lib/auth.php

index 83aaafe..ba9aa36 100644 (file)
@@ -244,7 +244,10 @@ function check_editable($page, $auth_enabled = TRUE, $exit_on_fail = TRUE)
  * Whether the page is readable from current user or not.
  */
 function is_page_readable($page) {
-       global $read_auth_pages;
+       global $read_auth_pages, $read_auth;
+       if (!$read_auth) {
+               return TRUE;
+       }
        return _is_page_accessible($page, $read_auth_pages);
 }
 
@@ -252,7 +255,10 @@ function is_page_readable($page) {
  * Whether the page is writable from current user or not.
  */
 function is_page_writable($page) {
-       global $edit_auth_pages;
+       global $edit_auth_pages, $edit_auth;
+       if (!$edit_auth) {
+               return TRUE;
+       }
        return _is_page_accessible($page, $edit_auth_pages);
 }