public function authorize($method) { return true; $res = parent::authorize($method); $res = $res && ($this->getParam("id") == $this->_userid || $this->userIsAdmin()); if (!$res && $this->getError() == RestErrorEnum::RE_OK) { $this->setError(RestErrorEnum::ACCESS_DENIED); } return $res; }
public function get() { if (parent::get() !== false) { db()->setFetchMode(Zend_Db::FETCH_NUM); $res = db()->query("SELECT researcher_privs_to_xml(?, ?)", array($this->getParam("id"), $this->_userid))->fetchAll(); $ret = array(); foreach ($res as $r) { $ret[] = $r[0]; } return new XMLFragmentRestResponse($ret, $this); } else { return false; } }