/** * Check if the user has the given capability for the requested user */ public function _has_capability($capability, $id = null) { $id = $id ? $id : $this->required_param('id', PARAM_INT); // user contexts are different -- we rely on the cache because clusters // require special logic userpage::get_contexts($capability); $cached = userpage::check_cached($capability, $id); if ($cached !== null) { return $cached; } return has_capability($capability, $this->context); }