From: vyshane Date: Wed, 13 Sep 2006 03:56:38 +0000 (+0000) Subject: moodle/site:manageblocks tweak X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=0c4d9f492ea741ae6a733d99eea0e50fc88a4f74;p=moodle.git moodle/site:manageblocks tweak --- diff --git a/lib/accesslib.php b/lib/accesslib.php index fccb7f1c81..e77ba4a9bb 100755 --- a/lib/accesslib.php +++ b/lib/accesslib.php @@ -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();