public function executeConsole(AgaviRequestDataHolder $request_data)
 {
     $migration_description = $request_data->getParameter('description');
     $migration_timestamp = date('YmdHis');
     $migration_slug = StringToolkit::asSnakeCase(trim($request_data->getParameter('name', 'default')));
     $migration_name = StringToolkit::asStudlyCaps($migration_slug);
     $migration_dir = $this->getAttribute('migration_dir');
     // Bit of a hack to build namespace
     if (!preg_match('#.+/app/(?:modules|migration)/(\\w+_?)(?:$|/.+)#', $migration_dir, $matches)) {
         throw new RuntimeError(sprintf('Could not find namespace info in path %s', $migration_dir));
     }
     $namespace_parts = explode('_', $matches[1]);
     if (count($namespace_parts) == 1) {
         // @todo app migration - introduce a project root namespace setting
         $namespace_parts = ['Your', 'Application'];
     }
     // And a hack to determine the technology namespace
     $target = $request_data->getParameter('target');
     if (strpos($target, 'event_source')) {
         $technology = 'CouchDb';
     } elseif (strpos($target, 'view_store')) {
         $technology = 'Elasticsearch';
     } else {
         $technology = 'RabbitMq';
     }
     $migration_filepath = sprintf('%1$s%2$s%3$s_%4$s%2$s%4$s.php', $migration_dir, DIRECTORY_SEPARATOR, $migration_timestamp, $migration_slug);
     $twig_renderer = TwigRenderer::create(['template_paths' => [__DIR__]]);
     $twig_renderer->renderToFile($technology . 'Migration.tpl.twig', $migration_filepath, ['name' => $migration_name, 'timestamp' => $migration_timestamp, 'description' => $migration_description, 'folder' => $migration_dir, 'filepath' => $migration_filepath, 'vendor_prefix' => $namespace_parts[0], 'package_prefix' => $namespace_parts[1], 'technology' => $technology, 'project_prefix' => AgaviConfig::get('core.project_prefix')]);
     return $this->cliMessage('-> migration template was created here:' . PHP_EOL . $migration_filepath . PHP_EOL);
 }
 protected function createDOM(AgaviRequestDataHolder $rd)
 {
     $results = $rd->getParameter("searchResult", null);
     $count = $rd->getParameter("searchCount");
     $DOM = new DOMDocument("1.0", "UTF-8");
     $root = $DOM->createElement("results");
     $DOM->appendChild($root);
     foreach ($results as $result) {
         $resultNode = $DOM->createElement("result");
         $root->appendChild($resultNode);
         foreach ($result as $fieldname => $field) {
             $node = $DOM->createElement("column");
             $node->nodeValue = $field;
             $name = $DOM->createAttribute("name");
             $name->nodeValue = $fieldname;
             $node->appendChild($name);
             $resultNode->appendChild($node);
         }
     }
     if ($count) {
         $count = array_values($count[0]);
         $node = $DOM->createElement("total");
         $node->nodeValue = $count[0];
         $root->appendChild($node);
     }
     return $DOM;
 }
 /**
  * @depends testReadState
  * @group Database
  */
 public function testSaveState()
 {
     info("\tTesting state-save\n");
     $token = str_shuffle("ABCDEF123456789");
     $params = array("cmd" => "write", "data" => '[{"name":"test-case-setting","value":"TEST_CASE_' . $token . '"}]', "id" => 1, "session" => "session", "user" => "user");
     $paramHolder = new AgaviRequestDataHolder();
     $paramHolder->setParameters($params);
     $controller = AgaviContext::getInstance()->getController();
     $container = $controller->createExecutionContainer("AppKit", "Ext.ApplicationState", $paramHolder, "javascript", "write");
     try {
         $result = $container->execute();
         $data = json_decode($result->getContent(), true);
     } catch (Exception $e) {
         $this->fail("An exception was thrown during state write: " . $e->getMessage());
     }
     // Check for success state
     if (@(!$data["success"])) {
         $this->fail("Could not write view state! Your cronk settings may not be saved in icinga-web.");
     }
     // Finally get sure the enry is really set
     $entryFound = false;
     foreach ($data["data"] as $entry) {
         if ($entry["name"] == 'test-case-setting' && $entry["value"] == 'TEST_CASE_' . $token) {
             $entryFound = true;
         }
     }
     if (!$entryFound) {
         $this->fail("Write returned success, but preference could not be found in DB!\n");
     }
     success("\tWriting state succeeded!\n");
 }
 /**
  * Tries to authenticate the user with the given request data.
  *
  * @param AgaviRequestDataHolder $request_data
  *
  * @return string name of agavi view to select
  */
 protected function authenticate(AgaviRequestDataHolder $request_data)
 {
     $translation_manager = $this->getContext()->getTranslationManager();
     $user = $this->getContext()->getUser();
     $auth_request = $request_data->getHeader('AUTH_REQUEST');
     $username = $auth_request['username'];
     $password = $auth_request['password'];
     $service_locator = $this->getContext()->getServiceLocator();
     $authentication_service = $service_locator->getAuthenticationService();
     $auth_response = $authentication_service->authenticate($username, $password);
     $log_message = sprintf("username='******' message='%s' auth_provider='%s' errors=''", $username, $auth_response->getMessage(), get_class($authentication_service), join(';', $auth_response->getErrors()));
     $log_message_part = sprintf("for username '{$username}' via auth provider %s.", get_class($authentication_service));
     if ($auth_response->getState() === AuthResponse::STATE_AUTHORIZED) {
         $view_name = 'Success';
         $user->setAttributes(array_merge(['acl_role' => AclService::ROLE_NON_PRIV], $auth_response->getAttributes()));
         $user->setAuthenticated(true);
         $this->logInfo('[AUTHORIZED] ' . $log_message);
     } elseif ($auth_response->getState() === AuthResponse::STATE_UNAUTHORIZED) {
         $view_name = 'Error';
         $user->setAuthenticated(false);
         $this->setAttribute('errors', ['auth' => $translation_manager->_('invalid_login', 'honeybee.system_account.user.errors')]);
         $this->logError('[UNAUTHORIZED] ' . $log_message);
     } else {
         $view_name = 'Error';
         $user->setAuthenticated(false);
         $this->setAttribute('errors', ['auth' => $auth_response->getMessage()]);
         $vm->setError('invalid_login', $tm->_('invalid_login', 'honeybee.system_account.user.errors'));
         $this->logError("[ERROR] state='" . $auth_response->getState() . "' " . $log_message);
     }
     return $view_name;
 }
 public function executeWrite(AgaviRequestDataHolder $rd)
 {
     $username = $rd->getParameter('username');
     $password = $rd->getParameter('password');
     $do = $rd->getParameter('dologin');
     $this->setAttribute('authenticated', false);
     $this->setAttribute('executed', false);
     if ($do) {
         $this->setAttribute('executed', true);
         $user = $this->getContext()->getUser();
         try {
             $user->doLogin($username, $password);
             /*
              * Behaviour for blocking whole access if no icinga access
              */
             //if(!$user->hasCredential("icinga.user")) {
             //    $user->doLogout();
             //    $this->setAttribute('authenticated', false);
             //}
             $this->setAttribute('authenticated', true);
         } catch (AgaviSecurityException $e) {
             $this->setAttribute('authenticated', false);
         }
     }
     return $this->getDefaultViewName();
 }
 public function execute(AgaviRequestDataHolder $rd)
 {
     $type = $rd->getParameter('type', AppKitMessageQueueItem::INFO ^ AppKitMessageQueueItem::ERROR);
     $aggregator = $this->getContext()->getModel('MessageQueueAggregator', 'AppKit');
     $aggregator->setType($type);
     return 'Success';
 }
 public function executeHtml(AgaviRequestDataHolder $rd)
 {
     $this->setAttribute('title', 'Icinga.CronkLoader');
     $tm = $this->getContext()->getTranslationManager();
     try {
         $model = $this->getContext()->getModel('Provider.CronksData', 'Cronks');
         $crname = $rd->getParameter('cronk');
         /*
          * Allow external initialization of cronk stubs
          */
         $parameters = $rd->getParameter('p', array());
         if ($model->hasCronk($crname)) {
             $cronk = $model->getCronk($crname);
             if (array_key_exists('ae:parameter', $cronk) && is_array($cronk['ae:parameter'])) {
                 $cronk['ae:parameter'] = $this->rebuildComplexData($cronk['ae:parameter']);
                 $parameters = (array) $cronk['ae:parameter'] + $parameters + array('module' => $cronk['module'], 'action' => $cronk['action']);
             }
             if (array_key_exists('state', $cronk) && isset($cronk['state'])) {
                 $parameters['state'] = $cronk['state'];
             }
             return $this->createForwardContainer($cronk['module'], $cronk['action'], $parameters, 'simple', 'write');
         } else {
             return $tm->_('Sorry, cronk "%s" not found', null, null, array($crname));
         }
     } catch (Exception $e) {
         return $tm->_('Exception thrown: %s', null, null, array($e->getMessage()));
     }
     return 'Some strange error occured';
 }
 /**
  * retrieves content via model and returns it
  * @param   AgaviRequestDataHolder      $rd             required by Agavi but not used here
  * @return  string                      $content        generated content
  * @author  Christian Doebler <*****@*****.**>
  */
 public function executeSimple(AgaviRequestDataHolder $rd)
 {
     if ($rd->getParameter('interface', false) == true) {
         return $this->executeHtml($rd);
     }
     try {
         try {
             $modules = AgaviConfig::get("org.icinga.modules", array());
             $fileName = $rd->getParameter('template');
             $file = null;
             foreach ($modules as $name => $path) {
                 if (file_exists($path . "/config/templates/" . $fileName . '.xml')) {
                     $file = AppKitFileUtil::getAlternateFilename($path . "/config/templates/", $fileName, '.xml');
                 }
             }
             if ($file === null) {
                 $file = AppKitFileUtil::getAlternateFilename(AgaviConfig::get('modules.cronks.xml.path.to'), $fileName, '.xml');
             }
             $model = $this->getContext()->getModel('System.StaticContent', 'Cronks', array('rparam' => $rd->getParameter('p', array())));
             $model->setTemplateFile($file->getRealPath());
             $content = $model->renderTemplate($rd->getParameter('render', 'MAIN'), $rd->getParameters());
             return sprintf('<div class="%s">%s</div>', 'static-content-container', $content);
         } catch (AppKitFileUtilException $e) {
             $msg = 'Could not find template for ' . $rd->getParameter('template');
             AppKitAgaviUtil::log('Could not find template for ' . $rd->getParameter('template'), AgaviLogger::ERROR);
             return $msg;
         }
     } catch (Exception $e) {
         return $e->getMessage();
     }
 }
 public function executeJson(AgaviRequestDataHolder $rd)
 {
     $connection = $rd->getParameter("connection", "icinga");
     $model = $this->getContext()->getModel('System.StatusMap', 'Cronks', array("connection" => $connection));
     $jsonData = $model->getParentChildStructure();
     return trim(json_encode($jsonData), '[]');
 }
 public function executeWrite(\AgaviRequestDataHolder $request_data)
 {
     $report = array();
     $success = false;
     try {
         $optimize_style = $request_data->getParameter('optimize', AgaviConfig::get('requirejs.optimize_style', 'uglify2'));
         $buildfile_path = $request_data->getParameter('buildfile', AgaviConfig::get('requirejs.buildfile_path', AgaviConfig::get('core.pub_dir') . "/static/buildconfig.js"));
         $packer = new AssetCompiler();
         // just in case
         $packer->symlinkModuleAssets();
         // render buildconfig.js and put it into the target location for compilation
         $template_service = new ModuleTemplateRenderer();
         $buildconfig_content = $template_service->render('rjs/buildconfig.js');
         $success = file_put_contents($buildfile_path, $buildconfig_content, LOCK_EX);
         if (!$success) {
             $this->setAttribute('error', 'Could not write file: ' . $buildfile_path);
         }
         $success = $packer->compileJs($buildfile_path, $optimize_style, $report);
         $this->setAttribute('report', $report);
     } catch (\Exception $e) {
         $this->setAttribute('error', $e->getMessage());
         return 'Error';
     }
     if (!$success) {
         return 'Error';
     }
     return 'Success';
 }
 public function executeConsole(AgaviRequestDataHolder $request_data)
 {
     if ($this->hasAttribute('error')) {
         return $this->cliError($this->getAttribute('error'));
     }
     $error_message = 'Watching items had errors.' . PHP_EOL . PHP_EOL;
     $validation_errors = $this->getErrorMessages();
     if (!empty($validation_errors)) {
         $error_message .= implode(PHP_EOL, $validation_errors) . PHP_EOL;
     }
     if (!$this->hasAttribute('report')) {
         return $this->cliError($error_message);
     }
     $report = $this->getAttribute('report');
     $error_message .= 'Report for each item:' . PHP_EOL . PHP_EOL;
     foreach ($report as $directory => $data) {
         $error_message .= $data['name'] . ': ' . ($data['success'] ? 'OK' : 'FAILED');
         if (!$data['success'] && $request_data->getParameter('verbose', true)) {
             $error_message .= PHP_EOL . 'Command: ' . $data['cmd'] . PHP_EOL;
             if (!empty($data['stdout'])) {
                 $error_message .= 'STDOUT: ' . PHP_EOL . $data['stdout'];
             }
             if (!empty($data['stderr'])) {
                 $error_message .= 'STDERR: ' . PHP_EOL . $data['stderr'];
             }
             if (empty($data['stdout']) && empty($data['stderr'])) {
                 $error_message .= PHP_EOL;
             }
         }
         $error_message .= PHP_EOL . PHP_EOL;
     }
     return $this->cliError($error_message);
 }
 public function executeWrite(AgaviRequestDataHolder $request_data)
 {
     $size = $request_data->getParameter('size', 1);
     $aggregate_root_type = $request_data->getParameter('type');
     $fixture_service = $this->getServiceLocator()->getFixtureService();
     $type_prefix = $aggregate_root_type->getPrefix();
     $documents[$type_prefix] = $fixture_service->generate($type_prefix, $size);
     $json = json_encode($documents, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
     $errors = [];
     $report = [];
     $success = true;
     if ($request_data->hasParameter('target')) {
         $target = $request_data->getParameter('target');
         if (is_writable(dirname($target))) {
             $success = file_put_contents($target, $json, LOCK_EX) !== false;
             if (!$success) {
                 $errors[] = sprintf('failed to write to: %s', $target);
             }
         } else {
             $errors[] = sprintf('target filename is not writable: %s', $target);
             $success = false;
         }
     } else {
         $this->setAttribute('data', $json);
     }
     $this->setAttribute('report', $report);
     $this->setAttribute('size', count($documents[$type_prefix]));
     if (!$success) {
         $this->setAttribute('errors', $errors);
         return 'Error';
     }
     return 'Success';
 }
Beispiel #13
0
 public function executeRead(AgaviRequestDataHolder $rd)
 {
     // the validator already pulled the product object from the database and put it into the request data
     // so there's not much we need to do here
     $this->setAttribute('product', $rd->getParameter('product'));
     return 'Success';
 }
 public function executeWrite(AgaviRequestDataHolder $rd)
 {
     if (!$this->context->getUser()->isAuthenticated() || !$this->context->getUser()->hasCredential('icinga.user')) {
         return array('Api', 'GenericError');
     }
     if ($this->context->getUser()->getNsmUser()->getTarget('IcingaCommandRo')) {
         $errors = array('Commands are disabled for this user');
         $this->getContainer()->setAttributeByRef('errors', $errors, 'org.icinga.api.auth');
         $this->getContainer()->setAttribute('success', false, 'org.icinga.api.auth');
         return array('Api', 'GenericError');
     }
     $command = $rd->getParameter("command");
     $targets = json_decode($rd->getParameter("target"), true);
     $data = json_decode($rd->getParameter("data"), true);
     if (!is_array($data)) {
         $this->setAttribute('error', 'Parameter data={} could not decoded from json');
         return 'Error';
     }
     if (!is_array($targets)) {
         $targets = array($targets);
     }
     $api = $this->getContext()->getModel("System.CommandSender", "Cronks");
     $api->setCommandName($command);
     $api->setData($data);
     $api->setSelection($targets);
     // send it
     try {
         $api->dispatchCommands();
         $this->setAttribute("success", true);
     } catch (Exception $e) {
         $this->setAttribute("error", $e->getMessage());
         return 'Error';
     }
     return 'Success';
 }
 public function executeConsole(\AgaviRequestDataHolder $request_data)
 {
     $report = $this->getAttribute('report');
     if ($request_data->getParameter('silent', false)) {
         return;
     }
     $message = 'The following items were compiled:' . PHP_EOL . PHP_EOL;
     foreach ($report as $directory => $data) {
         $message .= '- ' . $data['name'] . PHP_EOL;
         if ($request_data->getParameter('verbose', false)) {
             $message .= 'Command: ' . $data['cmd'] . PHP_EOL;
             if (!empty($data['stdout'])) {
                 $message .= 'STDOUT: ' . PHP_EOL . $data['stdout'] . PHP_EOL;
             }
             if (!empty($data['stderr'])) {
                 $message .= 'STDERR: ' . PHP_EOL . $data['stderr'] . PHP_EOL;
             }
             if (empty($data['stdout']) && empty($data['stderr'])) {
                 $message .= PHP_EOL;
             }
             if (!empty($data['autoprefixer']['stdout'])) {
                 $message .= 'Autoprefixer STDOUT: ' . PHP_EOL . $data['autoprefixer']['stdout'];
             }
             if (!empty($data['autoprefixer']['stderr'])) {
                 $message .= 'Autoprefixer STDERR: ' . PHP_EOL . $data['autoprefixer']['stderr'];
             }
             if (empty($data['autoprefixer']['autoprefixer']['stdout']) && empty($data['autoprefixer']['stderr'])) {
                 $message .= PHP_EOL;
             }
         }
     }
     return $message . PHP_EOL;
 }
 public function executeJson(AgaviRequestDataHolder $rd)
 {
     $factory = $this->getContext()->getModel('JasperSoapFactory', 'Reporting', array('jasperconfig' => $rd->getParameter('jasperconfig')));
     $client = $factory->getSoapClientForWSDL(Reporting_JasperSoapFactoryModel::SERVICE_REPOSITORY);
     $parameters = $this->getContext()->getModel('JasperParameterStruct', 'Reporting', array('client' => $client, 'uri' => $rd->getParameter('uri'), 'filter' => 'inputControl'));
     return json_encode($parameters->getJsonStructure());
 }
 public function executeWrite(AgaviRequestDataHolder $request_data)
 {
     $permissions = null;
     try {
         $acl_service = $this->getServiceLocator()->getAclService();
         $permission_service = $this->getServiceLocator()->getPermissionService();
         $role = $request_data->getParameter('role');
         $permissions = [];
         if (empty($role) || $role === AclService::ROLE_FULL_PRIV) {
             $permissions = $permission_service->getGlobalPermissions();
         } elseif (!empty($role) && $role !== AclService::ROLE_NON_PRIV) {
             $permissions = $permission_service->getRolePermissions($role);
         }
         $parent_permissions = [];
         $internal_roles = [AclService::ROLE_FULL_PRIV, AclService::ROLE_NON_PRIV];
         foreach ($acl_service->getRoleParents($role) as $parent_role) {
             if (in_array($parent_role, $internal_roles)) {
                 if ($parent_role === AclService::ROLE_FULL_PRIV) {
                     $parent_permissions[$parent_role] = $permission_service->getGlobalPermissions();
                 } else {
                     $parent_permissions[$parent_role] = [];
                 }
             } else {
                 $parent_permissions[$parent_role] = $permission_service->getRolePermissions($parent_role);
             }
         }
         $this->setAttribute('parent_permissions', $parent_permissions);
         $this->setAttribute('permissions', $permissions);
     } catch (Exception $e) {
         $this->setAttribute('error', $e->getMessage());
         return 'Error';
     }
     return 'Success';
 }
 private function glueTogether()
 {
     $u = (string) $this->baseURl;
     if (count($this->params)) {
         $params = array();
         foreach ($this->params as $target => $source) {
             $m = array();
             if (preg_match('/^_(\\w+)\\[([^\\]]+)\\]$/', $source, $m)) {
                 $source = $this->rd->get(strtolower($m[1]), $m[2]);
             }
             if ($source) {
                 $params[] = sprintf('%s=%s', $target, urlencode($source));
             }
         }
         if (strpos($u, '?') !== false) {
             $u .= '&' . implode('&', $params);
         } else {
             $u .= '?' . implode('&', $params);
         }
     }
     if ($this->user && $this->pass) {
         $u = str_replace('://', sprintf('://%s:%s@', $this->user, $this->pass), $u);
     }
     $u = str_replace('{urlScheme}', $this->context->getRequest()->getUrlScheme(), $u);
     $u = str_replace('{urlHost}', $this->context->getRequest()->getUrlHost(), $u);
     return $u;
 }
 public function executeWrite(\AgaviRequestDataHolder $request_data)
 {
     $report = array();
     try {
         $style = $request_data->getParameter('style', AgaviConfig::get('sass.style', 'compressed'));
         $themes = $request_data->getParameter('themes', []);
         $packer = new AssetCompiler();
         // just in case
         $packer->symlinkModuleAssets();
         if (empty($themes)) {
             $compilation_succeeded = $packer->compileThemes($style, $report);
         } else {
             foreach ($themes as $theme) {
                 $compilation_succeeded = $packer->compileTheme($theme, $style, $report);
             }
         }
         $compilation_succeeded &= $packer->compileModuleStyles($style, $report);
         $this->setAttribute('report', $report);
     } catch (\Exception $e) {
         $this->setAttribute('error', $e->getMessage());
         return 'Error';
     }
     if (!$compilation_succeeded) {
         return 'Error';
     }
     return 'Success';
 }
 public function executeWrite(AgaviRequestDataHolder $rd)
 {
     $action = $rd->getParameter("action", null);
     $instance = $rd->getParameter("instance", null);
     $this->setAttribute("write", true);
     if ($instance == null) {
         $this->setAttribute("errorMsg", "Invalid request");
         return "Success";
     }
     $icinga = $this->getContext()->getModel("IcingaControlTask", "Api", array("host" => $instance));
     try {
         switch ($action) {
             case 'restart':
                 $icinga->restartIcinga();
                 return "Success";
                 break;
             case 'shutdown':
                 $icinga->stopIcinga();
                 return "Success";
                 break;
             default:
                 $this->setAttribute("errorMsg", "Invalid action");
                 return "Success";
         }
     } catch (Exception $e) {
         $this->setAttribute("errorMsg", $e->getMessage());
         return "Success";
     }
 }
 public function execute(AgaviRequestDataHolder $request_data)
 {
     $service_locator = $this->getServiceLocator();
     $queue = $request_data->getParameter('queue');
     $worker_state = [':config' => new ArrayConfig(['queue' => $queue])];
     $service_locator->createEntity(Worker::CLASS, $worker_state)->run();
     return AgaviView::NONE;
 }
 public function executeConsole(AgaviRequestDataHolder $request_data)
 {
     $message = '-> failure generating visualization';
     if (!$request_data->getParameter('quiet')) {
         $message .= PHP_EOL . ' - ' . implode(PHP_EOL, $this->getAttribute('errors'));
     }
     return $this->cliError($message);
 }
 public function executeConsole(AgaviRequestDataHolder $request_data)
 {
     $message = sprintf('-> failure importing data from fixture "%s"', $request_data->getParameter('fixture'));
     if (!$request_data->getParameter('quiet')) {
         $message .= PHP_EOL . ' - ' . $this->getAttribute('errors');
     }
     return $this->cliError($message);
 }
 public function executeConsole(AgaviRequestDataHolder $request_data)
 {
     $message = sprintf('-> failure generating code for skeleton "%s"', $request_data->getParameter('skeleton'));
     if (!$request_data->getParameter('quiet')) {
         $message .= PHP_EOL . ' - ' . $this->getAttribute('errors');
     }
     return $this->cliError($message);
 }
 public function executeJson(AgaviRequestDataHolder $rd)
 {
     $start = $rd->getParameter("start");
     $limit = $rd->getParameter("limit");
     $parser = $this->getContext()->getModel("LogParser", "AppKit");
     $logEntries = $parser->parseLog($rd->getParameter('logFile'), $start, $limit, $rd->getParameter("dir", "desc"));
     return json_encode($logEntries);
 }
 /**
  * @group Validators
  */
 public function runValidator($f, $in)
 {
     $req = new AgaviRequestDataHolder();
     $req->setParameter("input", $in);
     $exec = AgaviContext::getInstance()->getController()->createExecutionContainer();
     $val = $exec->getValidationManager()->createValidator('TestValidator', array("input"), array("invalid_json" => "Invalid json provided", "invalid_format" => "Invalid format"), array("format" => $f, "name" => "test_filter", "base" => NULL, "export" => "test", "source" => "parameters"));
     $val->setValidationParameters($req);
     return $val->validate();
 }
 public function executeConsole(AgaviRequestDataHolder $request_data)
 {
     $message = sprintf('-> successfully replayed events for aggregate root type "%s"' . PHP_EOL, $request_data->getParameter('type')->getName());
     $distributed_events = $this->getAttribute('distributed_events', []);
     foreach ($distributed_events as $type => $count) {
         $message .= sprintf(PHP_EOL . '   Event: %s' . PHP_EOL . '   Status: replayed %d event%s' . PHP_EOL, $type, $count, $count > 1 ? 's' : '');
     }
     return $this->cliMessage($message);
 }
 public function executeConsole(AgaviRequestDataHolder $request_data)
 {
     $command = $request_data->getParameter('command');
     $values = $command->getValues();
     // this should be more sophisticated as it e.g. doesn't include a custom port
     $set_password_url = sprintf('%shoneybee-system_account-user/password?token=%s', AgaviConfig::get('local.base_href'), $values['auth_token']);
     $set_password_cli_command = $this->routing->gen('honeybee.system_account.user.password', ['token' => $values['auth_token']]);
     $this->cliMessage(PHP_EOL . $this->translation_manager->_('Please set a password for the created account at: ') . $set_password_url . PHP_EOL . $this->translation_manager->_('Via CLI use the following: ') . $set_password_cli_command . PHP_EOL);
 }
 private function prepareReportingData(AgaviRequestDataHolder $rd)
 {
     $struct = $this->__userFile->getUserFileStruct();
     $fp = $this->__userFile->getFilePointer();
     if ($rd->getParameter('inline', null) !== 1) {
         $this->getResponse()->setHttpHeader('Content-Disposition', sprintf('attachment; filename=%s', $struct['pushname']));
     }
     $this->getResponse()->setContent($fp);
 }
 public function executeConsole(AgaviRequestDataHolder $request_data)
 {
     $message = sprintf('-> successfully imported data from fixture "%s"', $request_data->getParameter('fixture'));
     if (!$request_data->getParameter('quiet')) {
         foreach ($this->getAttribute('report', []) as $line) {
             $message .= sprintf(PHP_EOL . ' - %s', $line);
         }
     }
     return $this->cliMessage($message);
 }