]> git.mjollnir.org Git - moodle.git/commitdiff
Put back DEBUG_DEVELOPER sanity check in has_capability, that makes sure the capabilt...
authortjhunt <tjhunt>
Tue, 8 Jan 2008 15:04:00 +0000 (15:04 +0000)
committertjhunt <tjhunt>
Tue, 8 Jan 2008 15:04:00 +0000 (15:04 +0000)
lib/accesslib.php

index bd8e27ab9e5475e14a59886d092f906b97a380f7..3de14bee8c4e5f86f08ae2d72fbf5f7b3cded0d6 100755 (executable)
@@ -327,6 +327,16 @@ function has_capability($capability, $context, $userid=NULL, $doanything=true) {
         return false;
     }
 
+/// Some sanity checks
+    if (debugging('',DEBUG_DEVELOPER)) {
+        if (!record_exists('capabilities', 'name', $capability)) {
+            debugging('Capability "'.$capability.'" was not found! This should be fixed in code.');
+        }
+        if ($doanything != true and $doanything != false) {
+            debugging('Capability parameter "doanything" is wierd ("'.$doanything.'"). This should be fixed in code.');
+        }
+    }
+
     if (empty($userid)) { // we must accept null, 0, '0', '' etc. in $userid
         $userid = $USER->id;
     }