コード例 #1
0
ファイル: HomeController.php プロジェクト: VUW-SIM-FIS/emiemi
 public function externalcreateAction()
 {
     $muri = $this->getRequest()->getParam(HomeController::MASHUP_PARAM);
     if (!Zend_Uri::check($muri)) {
         $this->getLog()->err("Access granting failed: " . $muri . " malformed");
         return $this->_helper->redirector('account');
     }
     // check if mashup exists & belongs to current user
     $m = $this->getLA()->loadMashup($muri) or die('Mashup not found: ' . $muri);
     if ($m->getCreatorId() != $this->getUserId() && $this->getUser()->isAdmin()) {
         $this->getLog()->err("User " . $this->getUserId() . " has no rights on " . $muri);
         return $this->_helper->redirector('account');
     }
     // insert into auth table
     $access = new Model_Access();
     $access->setMashup($muri)->setUseruri($this->getUser()->getUri())->createAccesskey();
     if (!$access->save()) {
         $this->getLog()->err("ERROR creating access key: " . $conn->ErrorMsg());
         return $this->_helper->redirector('account');
     }
     $this->getLog()->info("Created access rights to " . $muri);
     return $this->_helper->redirector('account');
 }