ILIAS  release_7 Revision v7.30-3-g800a261c036
All Data Structures Namespaces Files Functions Variables Modules Pages
class.ilPrivacySecurityConfigStoredObjective.php
Go to the documentation of this file.
1 <?php declare(strict_types=1);
2 
3 /* Copyright (c) 2019 Richard Klees <richard.klees@concepts-and-training.de> Extended GPL, see docs/LICENSE */
4 /* Copyright (c) 2020 Daniel Weise <daniel.weise@concepts-and-training.de> Extended GPL, see docs/LICENSE */
5 
6 use ILIAS\Setup;
7 
11 class ilPrivacySecurityConfigStoredObjective implements Setup\Objective
12 {
16  protected $config;
17 
19  {
20  $this->config = $config;
21  }
22 
23  public function getHash() : string
24  {
25  return hash("sha256", self::class);
26  }
27 
28  public function getLabel() : string
29  {
30  return "Store information about privacy security in settings";
31  }
32 
33  public function isNotable() : bool
34  {
35  return true;
36  }
37 
38  public function getPreconditions(Setup\Environment $environment) : array
39  {
40  $common_config = $environment->getConfigFor("common");
41  return [
42  new \ilIniFilesPopulatedObjective($common_config),
43  new \ilSettingsFactoryExistsObjective()
44  ];
45  }
46 
47  public function achieve(Setup\Environment $environment) : Setup\Environment
48  {
49  $factory = $environment->getResource(Setup\Environment::RESOURCE_SETTINGS_FACTORY);
50  $settings = $factory->settingsFor("common");
51  $settings->set("https", $this->bool2string($this->config->getForceHttpsOnLogin()));
52 
53  return $environment;
54  }
55 
59  public function isApplicable(Setup\Environment $environment) : bool
60  {
61  return true;
62  }
63 
64  protected function bool2string(bool $value) : string
65  {
66  if ($value) {
67  return "1";
68  }
69  return "0";
70  }
71 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
An environment holds resources to be used in the setup process.
Definition: Environment.php:11
$factory
Definition: metadata.php:58