Exemplo n.º 1
0
 /**
  * Check if the user has the given capability for the requested track
  */
 public function _has_capability($capability, $id = null)
 {
     if (empty($id)) {
         $id = isset($this) && method_exists($this, 'required_param') ? $this->required_param('id', PARAM_INT) : required_param('id', PARAM_INT);
     }
     // class contexts are different -- we rely on the cache because tracks
     // require special logic
     pmclasspage::get_contexts($capability);
     $cached = pmclasspage::check_cached($capability, $id);
     if ($cached !== null) {
         return $cached;
     }
     $context = \local_elisprogram\context\pmclass::instance($id);
     return has_capability($capability, $context);
 }