public function getOptions()
 {
     $being = $this->property->being;
     if ($being == "array") {
         $selected = $this->property->getValue();
         $policy = $this->configurationManager->getConfiguration(\TYPO3\FLOW3\Configuration\ConfigurationManager::CONFIGURATION_TYPE_POLICY);
         $options = array();
         foreach ($policy["roles"] as $key => $value) {
             $options[] = new \Admin\Core\Option($key, $key, $this->isSelected($key));
         }
         return $options;
     } else {
         $groups = $this->helper->getGroups();
         $actions = $this->getActions();
         foreach ($groups as $group => $beings) {
             foreach ($beings["beings"] as $being => $conf) {
                 foreach ($actions as $action => $label) {
                     $label = str_replace("@being", $conf["name"], $label);
                     $name = $group . " | " . $conf["name"] . " | " . $label;
                     $this->createOrUpdate($name, $action, $being);
                 }
             }
         }
         $this->persistenceManager->persistAll();
         return parent::getOptions();
     }
 }
 /**
  * Generate and renders the JSON schema for the content types.
  * Schema format example: http://schema.rdfs.org/all.json
  *
  * @return string
  */
 public function indexAction()
 {
     $this->response->setHeader('Content-Type', 'application/json');
     $configuration = $this->configurationManager->getConfiguration(\TYPO3\FLOW3\Configuration\ConfigurationManager::CONFIGURATION_TYPE_SETTINGS, 'TYPO3.TYPO3CR');
     $schemaBuilder = new \TYPO3\TYPO3\Service\ContentTypeSchemaBuilder($configuration);
     $schemaBuilder->convertToVieSchema();
     return $schemaBuilder->generateAsJson();
 }
Example #3
0
 /**
  * Parses the given configuration path expression and sets $this->actualSettingValue
  * and $this->condition accordingly
  *
  * @param string $settingComparisonExpression The configuration expression (path + optional condition)
  * @return void
  * @throws \TYPO3\FLOW3\Aop\Exception\InvalidPointcutExpressionException
  */
 protected function parseConfigurationOptionPath($settingComparisonExpression)
 {
     $settingComparisonExpression = preg_split(self::PATTERN_SPLITBYEQUALSIGN, $settingComparisonExpression);
     if (isset($settingComparisonExpression[1])) {
         $matches = array();
         preg_match(self::PATTERN_MATCHVALUEINQUOTES, $settingComparisonExpression[1], $matches);
         if (isset($matches['SingleQuotedString']) && $matches['SingleQuotedString'] !== '') {
             $this->condition = $matches['SingleQuotedString'];
         } elseif (isset($matches['DoubleQuotedString']) && $matches['DoubleQuotedString'] !== '') {
             $this->condition = $matches['DoubleQuotedString'];
         } else {
             throw new \TYPO3\FLOW3\Aop\Exception\InvalidPointcutExpressionException('The given condition has a syntax error (Make sure to set quotes correctly). Got: "' . $settingComparisonExpression[1] . '"', 1230047529);
         }
     }
     $configurationKeys = preg_split('/\\./', $settingComparisonExpression[0]);
     if (count($configurationKeys) > 0) {
         $settingPackageKey = array_shift($configurationKeys);
         $settingValue = $this->configurationManager->getConfiguration(\TYPO3\FLOW3\Configuration\ConfigurationManager::CONFIGURATION_TYPE_SETTINGS, $settingPackageKey);
         foreach ($configurationKeys as $currentKey) {
             if (!isset($settingValue[$currentKey])) {
                 throw new \TYPO3\FLOW3\Aop\Exception\InvalidPointcutExpressionException('The given configuration path in the pointcut designator "setting" did not exist. Got: "' . $settingComparisonExpression[0] . '"', 1230035614);
             }
             $settingValue = $settingValue[$currentKey];
         }
         $this->actualSettingValue = $settingValue;
     }
 }
Example #4
0
 /**
  * Returns the Settings of that namespace and caches it
  *
  * @param $namespace String Namespace
  * @return $settings Array of settings
  * @author Marc Neuhaus <*****@*****.**>
  **/
 public function getSettings($namespace = "Admin")
 {
     if (!isset($this->cache["settings"]) || !isset($this->cache["settings"][$namespace])) {
         $this->cache["settings"][$namespace] = $this->configurationManager->getConfiguration(\TYPO3\FLOW3\Configuration\ConfigurationManager::CONFIGURATION_TYPE_SETTINGS, $namespace);
     }
     return $this->cache["settings"][$namespace];
 }
 /**
  *
  * @param mixed $objects
  * @param string $as
  * @param string $limitsAs
  * @param string $paginationAs
  * @return string Rendered string
  * @author Marc Neuhaus <*****@*****.**>
  * @api
  */
 public function render($objects = null, $as = "paginatedObjects", $limitsAs = "limits", $paginationAs = "pagination")
 {
     $this->query = $objects->getQuery();
     $this->settings = $this->configurationManager->getConfiguration(\TYPO3\FLOW3\Configuration\ConfigurationManager::CONFIGURATION_TYPE_SETTINGS, "Admin.Pagination");
     $this->request = $this->controllerContext->getRequest();
     $this->total = $this->query->count();
     $limits = $this->handleLimits();
     $pagination = $this->handlePagination();
     $this->templateVariableContainer->add($limitsAs, $limits);
     $this->templateVariableContainer->add($paginationAs, $pagination);
     $this->templateVariableContainer->add($as, $this->query->execute());
     $content = $this->renderChildren();
     $this->templateVariableContainer->remove($limitsAs);
     $this->templateVariableContainer->remove($paginationAs);
     $this->templateVariableContainer->remove($as);
     return $content;
 }
 /**
  * Initializes the the object configurations and some other parts of this Object Manager.
  *
  * @param array $packages An array of active packages to consider
  * @return void
  */
 public function initialize(array $packages)
 {
     $this->registeredClassNames = $this->registerClassFiles($packages);
     $this->reflectionService->buildReflectionData($this->registeredClassNames);
     $rawCustomObjectConfigurations = $this->configurationManager->getConfiguration(\TYPO3\FLOW3\Configuration\ConfigurationManager::CONFIGURATION_TYPE_OBJECTS);
     $configurationBuilder = new \TYPO3\FLOW3\Object\Configuration\ConfigurationBuilder();
     $configurationBuilder->injectReflectionService($this->reflectionService);
     $configurationBuilder->injectSystemLogger($this->systemLogger);
     $this->objectConfigurations = $configurationBuilder->buildObjectConfigurations($this->registeredClassNames, $rawCustomObjectConfigurations);
     $this->setObjects($this->buildObjectsArray());
 }
Example #7
0
 /**
  * Initializes this Policy Service
  *
  * @return void
  */
 public function initializeObject()
 {
     $this->policy = $this->configurationManager->getConfiguration(\TYPO3\FLOW3\Configuration\ConfigurationManager::CONFIGURATION_TYPE_POLICY);
     $this->setAclsForEverybodyRole();
     if ($this->cache->has('acls')) {
         $this->acls = $this->cache->get('acls');
     } else {
         $this->parseEntityAcls();
     }
     if ($this->cache->has('entityResourcesConstraints')) {
         $this->entityResourcesConstraints = $this->cache->get('entityResourcesConstraints');
     } else {
         if (array_key_exists('resources', $this->policy) && array_key_exists('entities', $this->policy['resources'])) {
             $this->entityResourcesConstraints = $this->policyExpressionParser->parseEntityResources($this->policy['resources']['entities']);
         }
     }
 }
 /**
  * Generate a schema for the given configuration or YAML file.
  *
  * ./flow3 configuration:generateschema --type Settings --path TYPO3.FLOW3.persistence
  *
  * The schema will be output to standard output.
  *
  * @param string $type Configuration type to create a schema for
  * @param string $path path to the subconfiguration separated by "." like "TYPO3.FLOW3"
  * @param string $yaml YAML file to create a schema for
  * @return void
  */
 public function generateSchemaCommand($type = NULL, $path = NULL, $yaml = NULL)
 {
     $data = NULL;
     if ($yaml !== NULL && is_file($yaml) && is_readable($yaml)) {
         $data = \Symfony\Component\Yaml\Yaml::parse($yaml);
     } elseif ($type !== NULL) {
         $data = $this->configurationManager->getConfiguration($type);
         if ($path !== NULL) {
             $data = \TYPO3\FLOW3\Utility\Arrays::getValueByPath($data, $path);
         }
     }
     if (empty($data)) {
         $this->outputLine('Data was not found or is empty');
         return;
     }
     $yaml = \Symfony\Component\Yaml\Yaml::dump($this->schemaGenerator->generate($data), 99);
     $this->output($yaml . chr(10));
 }
Example #9
0
 /**
  * FIXME: Not yet completely refactored to new proxy mechanism
  *
  * @param array $argumentConfigurations
  * @return string
  */
 protected function buildMethodParametersCode(array $argumentConfigurations)
 {
     $preparedArguments = array();
     foreach ($argumentConfigurations as $argument) {
         if ($argument === NULL) {
             $preparedArguments[] = 'NULL';
         } else {
             $argumentValue = $argument->getValue();
             switch ($argument->getType()) {
                 case \TYPO3\FLOW3\Object\Configuration\ConfigurationArgument::ARGUMENT_TYPES_OBJECT:
                     if ($argumentValue instanceof \TYPO3\FLOW3\Object\Configuration\Configuration) {
                         $argumentValueObjectName = $argumentValue->getObjectName();
                         if ($this->objectConfigurations[$argumentValueObjectName]->getScope() === \TYPO3\FLOW3\Object\Configuration\Configuration::SCOPE_PROTOTYPE) {
                             $preparedArguments[] = '$this->getPrototype(\'' . $argumentValueObjectName . '\', array(' . $this->buildMethodParametersCode($argumentValue->getArguments(), $this->objectConfigurations) . '))';
                         } else {
                             $preparedArguments[] = '\\TYPO3\\FLOW3\\Core\\Bootstrap::$staticObjectManager->get(\'' . $argumentValueObjectName . '\')';
                         }
                     } else {
                         if (strpos($argumentValue, '.') !== FALSE) {
                             $settingPath = explode('.', $argumentValue);
                             $settings = Arrays::getValueByPath($this->configurationManager->getConfiguration(ConfigurationManager::CONFIGURATION_TYPE_SETTINGS), array_shift($settingPath));
                             $argumentValue = Arrays::getValueByPath($settings, $settingPath);
                         }
                         $preparedArguments[] = '\\TYPO3\\FLOW3\\Core\\Bootstrap::$staticObjectManager->get(\'' . $argumentValue . '\')';
                     }
                     break;
                 case \TYPO3\FLOW3\Object\Configuration\ConfigurationArgument::ARGUMENT_TYPES_STRAIGHTVALUE:
                     $preparedArguments[] = var_export($argumentValue, TRUE);
                     break;
                 case \TYPO3\FLOW3\Object\Configuration\ConfigurationArgument::ARGUMENT_TYPES_SETTING:
                     $preparedArguments[] = '\\TYPO3\\FLOW3\\Core\\Bootstrap::$staticObjectManager->getSettingsByPath(explode(\'.\', \'' . $argumentValue . '\'))';
                     break;
             }
         }
     }
     return implode(', ', $preparedArguments);
 }
Example #10
0
 /**
  * Initialize the injected router-object
  *
  * @return void
  */
 protected function initializeRouter()
 {
     $routesConfiguration = $this->configurationManager->getConfiguration(\TYPO3\FLOW3\Configuration\ConfigurationManager::CONFIGURATION_TYPE_ROUTES);
     $this->router->setRoutesConfiguration($routesConfiguration);
 }
Example #11
0
 /**
  * Intialize this engine
  *
  * @return void
  */
 public function initializeObject()
 {
     $this->router->setRoutesConfiguration($this->configurationManager->getConfiguration(\TYPO3\FLOW3\Configuration\ConfigurationManager::CONFIGURATION_TYPE_ROUTES));
 }