accesslib: remove has_capability_including_child_contexts()

No code is calling it, and it never appeared in any release.
This commit is contained in:
martinlanghoff 2007-09-19 07:48:19 +00:00
parent 0df35335ba
commit 9264620341

View file

@ -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) * Get an array of courses (with magic extra bits)
* where the accessdata and in DB enrolments show * where the accessdata and in DB enrolments show