From: tjhunt Date: Tue, 19 Sep 2006 22:57:17 +0000 (+0000) Subject: In debug mode, warn people if they are asking for an unknown capability. X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=a8a7300accdf2f4cce8597b3ad2319ce1d03e247;p=moodle.git In debug mode, warn people if they are asking for an unknown capability. --- diff --git a/lib/accesslib.php b/lib/accesslib.php index 1f5d8aeb5c..13d94fb75d 100755 --- a/lib/accesslib.php +++ b/lib/accesslib.php @@ -272,6 +272,10 @@ function has_capability($capability, $context=NULL, $userid=NULL, $doanything=tr global $USER, $CONTEXT, $CFG; + if (debugging() && !record_exists('capabilities', 'name', $capability)) { + debugging("Checking for unknown cabability '$capability' in context {$context->id}."); + } + if (empty($userid) && empty($USER->capabilities)) { // Real user, first time here if (isloggedin()) { load_defaultuser_role(); // All users get this by default