예제 #1
0
파일: Executor.php 프로젝트: rtens/domin
 /**
  * @param $id
  * @return ExecutionResult
  */
 public function execute($id)
 {
     if (!$this->access->isPermitted($id)) {
         return new NotPermittedResult();
     }
     try {
         $action = $this->actions->getAction($id);
         list($params, $missing) = $this->readParameters($action);
         if (!empty($missing)) {
             return new MissingParametersResult($missing);
         }
         if (!$this->access->isExecutionPermitted($id, $params)) {
             return new NotPermittedResult();
         }
         $returned = $action->execute($params);
         if (is_null($returned)) {
             return new NoResult();
         } else {
             if ($returned instanceof ExecutionResult) {
                 return $returned;
             } else {
                 return new ValueResult($returned);
             }
         }
     } catch (\Exception $e) {
         return new FailedResult($e);
     }
 }
예제 #2
0
파일: ListActions.php 프로젝트: rtens/domin
 private function assembleActions()
 {
     $actions = [];
     foreach ($this->actions->getAllActions() as $id => $action) {
         if ($id != WebApplication::INDEX_ACTION && $this->access->isPermitted($id)) {
             $actions[] = new ActionListItem($id, $action->caption(), $this->parser->shorten($action->description()));
         }
     }
     return $actions;
 }
예제 #3
0
 private function givenExeutionOf_With_IsNotPermitted($action, $params)
 {
     $this->access->add((new GenericAccessRestriction($action))->denyExecutionWith($params));
 }