ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilPrivacySecurityConfigStoredObjective.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
21use ILIAS\Setup;
22
27{
32
34 {
35 $this->config = $config;
36 }
37
38 public function getHash(): string
39 {
40 return hash("sha256", self::class);
41 }
42
43 public function getLabel(): string
44 {
45 return "Store information about privacy security in settings";
46 }
47
48 public function isNotable(): bool
49 {
50 return true;
51 }
52
53 public function getPreconditions(Setup\Environment $environment): array
54 {
55 return [
58 ];
59 }
60
61 public function achieve(Setup\Environment $environment): Setup\Environment
62 {
63 $factory = $environment->getResource(Setup\Environment::RESOURCE_SETTINGS_FACTORY);
64 $settings = $factory->settingsFor("common");
65 $settings->set("https", $this->bool2string($this->config->getForceHttpsOnLogin()));
66
68 if (null !== $this->config->getAuthDurationInMs()) {
69 $settings->set("auth_duration", (string) $this->config->getAuthDurationInMs());
70 } else {
71 $settings->delete("auth_duration");
72 }
73
74 if (null !== $this->config->getAccountAssistanceDurationInMs()) {
75 $settings->set("account_assistance_duration", (string) $this->config->getAccountAssistanceDurationInMs());
76 } else {
77 $settings->delete("account_assistance_duration");
78 }
79
80 if (null !== $this->config->getRegistrationDurationInMs()) {
81 $settings->set("registration_duration", (string) $this->config->getRegistrationDurationInMs());
82 } else {
83 $settings->delete("registration_duration");
84 }
85
86 return $environment;
87 }
88
92 public function isApplicable(Setup\Environment $environment): bool
93 {
94 return true;
95 }
96
97 protected function bool2string(bool $value): string
98 {
99 if ($value) {
100 return "1";
101 }
102 return "0";
103 }
104}
An environment holds resources to be used in the setup process.
Definition: Environment.php:28
getResource(string $id)
Consumers of this method should check if the result is what they expect, e.g.
An objective is a desired state of the system that is supposed to be created by the setup.
Definition: Objective.php:31
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...