]> git.mjollnir.org Git - moodle.git/commitdiff
In debug mode, warn people if they are asking for an unknown capability.
authortjhunt <tjhunt>
Tue, 19 Sep 2006 22:57:17 +0000 (22:57 +0000)
committertjhunt <tjhunt>
Tue, 19 Sep 2006 22:57:17 +0000 (22:57 +0000)
lib/accesslib.php

index 1f5d8aeb5c231a479e88110d426ea25875540531..13d94fb75d390df2096cee3cfe589d1a643514c1 100755 (executable)
@@ -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