mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 08:56:36 +02:00
accesslib: remove has_capability_including_child_contexts()
No code is calling it, and it never appeared in any release.
This commit is contained in:
parent
0df35335ba
commit
9264620341
1 changed files with 0 additions and 32 deletions
|
@ -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
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue