ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
class.ilPrivacySecurityConfigStoredObjective.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
20 use ILIAS\Setup;
21 
25 class ilPrivacySecurityConfigStoredObjective implements Setup\Objective
26 {
31 
32  public function __construct(ilPrivacySecuritySetupConfig $config)
33  {
34  $this->config = $config;
35  }
36 
37  public function getHash(): string
38  {
39  return hash("sha256", self::class);
40  }
41 
42  public function getLabel(): string
43  {
44  return "Store information about privacy security in settings";
45  }
46 
47  public function isNotable(): bool
48  {
49  return true;
50  }
51 
52  public function getPreconditions(Setup\Environment $environment): array
53  {
54  return [
57  ];
58  }
59 
60  public function achieve(Setup\Environment $environment): Setup\Environment
61  {
62  $factory = $environment->getResource(Setup\Environment::RESOURCE_SETTINGS_FACTORY);
63  $settings = $factory->settingsFor("common");
64  $settings->set("https", $this->bool2string($this->config->getForceHttpsOnLogin()));
65 
67  if (null !== $this->config->getAuthDurationInMs()) {
68  $settings->set("auth_duration", (string) $this->config->getAuthDurationInMs());
69  } else {
70  $settings->delete("auth_duration");
71  }
72 
73  if (null !== $this->config->getAccountAssistanceDurationInMs()) {
74  $settings->set("account_assistance_duration", (string) $this->config->getAccountAssistanceDurationInMs());
75  } else {
76  $settings->delete("account_assistance_duration");
77  }
78 
79  return $environment;
80  }
81 
85  public function isApplicable(Setup\Environment $environment): bool
86  {
87  return true;
88  }
89 
90  protected function bool2string(bool $value): string
91  {
92  if ($value) {
93  return "1";
94  }
95  return "0";
96  }
97 }
array $settings
Setting values (LTI parameters, custom parameters and local parameters).
Definition: System.php:200
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:27
$factory
Definition: metadata.php:75