diff --git a/core/user.class.php b/core/user.class.php index 85d90df5..653a6929 100644 --- a/core/user.class.php +++ b/core/user.class.php @@ -4,6 +4,11 @@ function _new_user($row) { return new User($row); } +$_perm_map = array( + "override_config" => "admin", +); + + /** * An object representing a row in the "users" table. * @@ -90,6 +95,15 @@ class User { /* * useful user object functions start here */ + public function can($ability) { + global $_perm_map; + $needed = $_perm_map[$ability]; + if($needed == "admin" && $this->is_admin()) return true; + if($needed == "user" && $this->is_logged_in()) return true; + if($needed == "anon") return true; + return false; + } + /** * Test if this user is anonymous (not logged in) diff --git a/core/util.inc.php b/core/util.inc.php index 882c8560..3529fb87 100644 --- a/core/util.inc.php +++ b/core/util.inc.php @@ -879,7 +879,7 @@ function get_debug_info() { // print_obj ($object, $title, $return) function print_obj($object,$title="Object Information", $return=false) { global $user; - if(DEBUG && isset($_GET['debug']) && $user->is_admin()) { + if(DEBUG && isset($_GET['DEBUG']) && $user->can("override_config")) { $pr = print_r($object,true); $count = substr_count($pr,"\n")<=25?substr_count($pr,"\n"):25; $pr = "";