]> git.mjollnir.org Git - moodle.git/commitdiff
moodle/site:manageblocks tweak
authorvyshane <vyshane>
Wed, 13 Sep 2006 03:56:38 +0000 (03:56 +0000)
committervyshane <vyshane>
Wed, 13 Sep 2006 03:56:38 +0000 (03:56 +0000)
lib/accesslib.php

index fccb7f1c81e88ef29684320dd9ba9ed5806ef2bd..e77ba4a9bb184fda4ece95e1fd290986ce34d1f8 100755 (executable)
@@ -1342,8 +1342,18 @@ function load_capability_def($component) {
         $defpath = $CFG->libdir.'/db/access.php';
         $varprefix = 'moodle';
     } else {
-        $defpath = $CFG->dirroot.'/'.$component.'/db/access.php';
-        $varprefix = str_replace('/', '_', $component);
+        $compparts = explode('/', $component);
+        
+        if ($compparts[0] == 'block') {
+            // Blocks are an exception. Blocks directory is 'blocks', and not
+            // 'block'. So we need to jump through hoops.
+            $defpath = $CFG->dirroot.'/'.$compparts[0].
+                                's/'.$compparts[1].'/db/access.php';
+            $varprefix = $compparts[0].'_'.$compparts[1];
+        } else {
+            $defpath = $CFG->dirroot.'/'.$component.'/db/access.php';
+            $varprefix = str_replace('/', '_', $component);
+        }
     }
     $capabilities = array();