From 926462034110bae3da21f2fec72fb807abee9797 Mon Sep 17 00:00:00 2001 From: martinlanghoff Date: Wed, 19 Sep 2007 07:48:19 +0000 Subject: [PATCH] accesslib: remove has_capability_including_child_contexts() No code is calling it, and it never appeared in any release. --- lib/accesslib.php | 32 -------------------------------- 1 file changed, 32 deletions(-) diff --git a/lib/accesslib.php b/lib/accesslib.php index 30bdf83dd0..a879f71f34 100755 --- a/lib/accesslib.php +++ b/lib/accesslib.php @@ -721,38 +721,6 @@ function require_capability($capability, $context=NULL, $userid=NULL, $doanythin } } -/** - * Cheks if current user has allowed permission for any of submitted capabilities - * in given or child contexts. - * @param object $context - a context object (record from context table) - * @param array $capabilitynames array of strings, capability names - * @return boolean - */ -function has_capability_including_child_contexts($context, $capabilitynames) { - global $USER; - - foreach ($capabilitynames as $capname) { - if (has_capability($capname, $context)) { - return true; - } - } - - if ($children = get_child_contexts($context)) { - foreach ($capabilitynames as $capname) { - foreach ($children as $child) { - if (isset($USER->capabilities[$child][$capname]) and $USER->capabilities[$child][$capname] > 0) { - // extra check for inherited prevent and prohibit - if (has_capability($capname, get_context_instance_by_id($child), $USER->id, false)) { - return true; - } - } - } - } - } - - return false; -} - /* * Get an array of courses (with magic extra bits) * where the accessdata and in DB enrolments show -- 2.39.5