fixed bug in permissions (node was displayed even with external_access=no)
authorniekt0 <niekt0@kyberia.cz>
Sun, 15 Jan 2012 00:52:55 +0000 (01:52 +0100)
committerniekt0 <niekt0@kyberia.cz>
Sun, 15 Jan 2012 00:52:55 +0000 (01:52 +0100)
wwwroot/backend/mysql/permissions.inc

index 14bc7d42b245d9e36d5194abfb51ee673c0ba57c..6ef959610a41be99105e7433cf45730f8461abf2 100644 (file)
@@ -58,6 +58,20 @@ public static function checkPerms($node) {
             $perms['node_system_access']   = $qr_np->getString('node_system_access');
             $perms['node_external_access'] = $qr_np->getString('node_external_access');
 
+        // external access must go first
+            if ($user_id == "") {
+                if ($perms['node_system_access'] != 'private'
+                && $perms['node_external_access'] == 'yes') {
+                        $perms['r'] = 1;
+                        $perms['w'] = 0;
+                    break;
+                } else {
+                        $perms['r'] = 0;
+                        $perms['w'] = 0;
+                    break;
+                }
+            }
+
             // r/w prava podla system accessu
             if ($perms['node_system_access'] == 'public') {
                 $perms['r'] = 1;
@@ -79,14 +93,6 @@ public static function checkPerms($node) {
                 break;
             }
 
-            if ($perms['node_system_access'] != 'private'
-                && (empty($_SESSION['user_id']))
-                && $perms['node_external_access'] == 'yes') {
-                    $perms['r'] = 1;
-                    $perms['w'] = 0;
-                    break;
-            }
-
         } // if ($perms['node_permission'] == '' && $perms['node_system_access'] == '')
         else {
             // ked som v public alebo moderated fore a dalsie nadradene su uz privatne
This page took 0.132704 seconds and 4 git commands to generate.