ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilObjWebDAV.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
25class ilObjWebDAV extends ilObject
26{
27 private bool $webdavEnabled;
29
30 public function __construct(int $id = 0, bool $call_by_reference = true)
31 {
32 $this->type = "wbdv";
34 }
35
36 #[\Override]
37 public function getPresentationTitle(): string
38 {
39 return $this->lng->txt("webdav");
40 }
41
42 #[\Override]
43 public function getLongDescription(): string
44 {
45 return $this->lng->txt("webdav_description");
46 }
47
48 public function setWebdavEnabled(bool $newValue): void
49 {
50 $this->webdavEnabled = $newValue;
51 }
52
53 public function isWebdavEnabled(): bool
54 {
56 }
57
58 public function setWebdavVersioningEnabled(bool $newValue): void
59 {
60 $this->webdavVersioningEnabled = $newValue;
61 }
62
63 public function isWebdavVersioningEnabled(): bool
64 {
66 }
67
68 #[\Override]
69 public function create(): int
70 {
71 $id = parent::create();
72 $this->write();
73 return $id;
74 }
75
76 #[\Override]
77 public function update(): bool
78 {
79 parent::update();
80 $this->write();
81 return true;
82 }
83
84 private function write(): void
85 {
86 $settings = new ilSetting('webdav');
87
88 $settings->set('webdav_enabled', $this->webdavEnabled ? '1' : '0');
89 $settings->set('webdav_versioning_enabled', $this->webdavVersioningEnabled ? '1' : '0');
90 }
91
92 #[\Override]
93 public function read(): void
94 {
95 parent::read();
96
97 $settings = new ilSetting('webdav');
98 $this->webdavEnabled = $settings->get('webdav_enabled', '0') == '1';
99 // default_value = 1 for versionigEnabled because it was already standard before ilias5.4
100 $this->webdavVersioningEnabled = $settings->get('webdav_versioning_enabled', '1') == '1';
101 }
102
108 {
109 global $DIC;
110 $ilUser = $DIC->user();
111
112 $status = ilAuthUtils::supportsLocalPasswordValidation($ilUser->getAuthMode(true));
113 $cmd = 'mount_webfolder';
114 if ($status === ilAuthUtils::LOCAL_PWV_USER && (string) $ilUser->getPasswd() === '') {
115 $cmd = 'showPasswordInstruction';
116 }
117
118 // Check if user has local password
119 return ["permission" => "read", "cmd" => $cmd, "lang_var" => "mount_webfolder", "enable_anonymous" => "false"];
120 }
121}
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
static supportsLocalPasswordValidation($a_authmode)
Check if local password validation is supported.
const int LOCAL_PWV_USER
create()
note: title, description and type should be set when this function is called
__construct(int $id=0, bool $call_by_reference=true)
getLongDescription()
get object long description (stored in object_description)
setWebdavEnabled(bool $newValue)
bool $webdavVersioningEnabled
getPresentationTitle()
get presentation title Normally same as title Overwritten for sessions
setWebdavVersioningEnabled(bool $newValue)
retrieveWebDAVCommandArrayForActionMenu()
Class ilObject Basic functions for all objects.
bool $call_by_reference
ILIAS Setting Class.
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
global $DIC
Definition: shib_login.php:26