mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 08:56:36 +02:00
MDL-17502 accesslib: added warning if incorrect parameters supplied to has_all_capabilities() and fixed parameters in course lib code
This commit is contained in:
parent
18af228bf2
commit
3ce50127b9
2 changed files with 12 additions and 4 deletions
|
@ -512,6 +512,10 @@ function has_any_capability($capabilities, $context, $userid=NULL, $doanything=t
|
|||
* @return bool
|
||||
*/
|
||||
function has_all_capabilities($capabilities, $context, $userid=NULL, $doanything=true) {
|
||||
if (!is_array($capabilities)) {
|
||||
debugging('Incorrect $capabilities parameter in has_all_capabilities() call - must be an array');
|
||||
return false;
|
||||
}
|
||||
foreach ($capabilities as $capability) {
|
||||
if (!has_capability($capability, $context, $userid, $doanything)) {
|
||||
return false;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue