コード例 #1
0
ファイル: Controller.php プロジェクト: kstep/pnut
 protected function canPerform(Model_Owned $model, $action)
 {
     $method = "can" . ucfirst(strtolower($action));
     if (!$model->{$method}($this->getAuthorizator()->getUser())) {
         $view = new View_Html();
         $view->deny($this->_realm);
         $object = strtolower(str_replace("Model_", "", get_class($article)));
         throw new Controller_Exception("Access denied for {$action} to {$object} {$model}.", 401, $view);
     }
 }
コード例 #2
0
ファイル: Restricted.php プロジェクト: kstep/pnut
 /**
  * action to be executed if access denied for the user
  * @return void
  * @author kstep
  */
 protected function accessDenied()
 {
     $view = new View_Html();
     $view->deny($this->_realm);
     throw new Controller_Exception("Access denied to {$this->_realm}.", 401, $view);
 }