From 0c4d9f492ea741ae6a733d99eea0e50fc88a4f74 Mon Sep 17 00:00:00 2001 From: vyshane Date: Wed, 13 Sep 2006 03:56:38 +0000 Subject: [PATCH] moodle/site:manageblocks tweak --- lib/accesslib.php | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) 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(); -- 2.39.5