ILIAS  release_8 Revision v8.24
class.ilObjWebDAV.php
Go to the documentation of this file.
1<?php
2
3declare(strict_types=1);
4
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 public function getPresentationTitle(): string
37 {
38 return $this->lng->txt("webdav");
39 }
40
41 public function getLongDescription(): string
42 {
43 return $this->lng->txt("webdav_description");
44 }
45
46 public function setWebdavEnabled(bool $newValue): void
47 {
48 $this->webdavEnabled = $newValue;
49 }
50
51 public function isWebdavEnabled(): bool
52 {
54 }
55
56 public function setWebdavVersioningEnabled(bool $newValue): void
57 {
58 $this->webdavVersioningEnabled = $newValue;
59 }
60
61 public function isWebdavVersioningEnabled(): bool
62 {
64 }
65
66 public function create(): int
67 {
68 $id = parent::create();
69 $this->write();
70 return $id;
71 }
72
73 public function update(): bool
74 {
75 parent::update();
76 $this->write();
77 return true;
78 }
79
80 private function write(): void
81 {
82 $settings = new ilSetting('webdav');
83
84 $settings->set('webdav_enabled', $this->webdavEnabled ? '1' : '0');
85 $settings->set('webdav_versioning_enabled', $this->webdavVersioningEnabled ? '1' : '0');
86 }
87
88 public function read(): void
89 {
90 parent::read();
91
92 $settings = new ilSetting('webdav');
93 $this->webdavEnabled = $settings->get('webdav_enabled', '0') == '1';
94 // default_value = 1 for versionigEnabled because it was already standard before ilias5.4
95 $this->webdavVersioningEnabled = $settings->get('webdav_versioning_enabled', '1') == '1';
96 }
97
103 {
104 global $DIC;
105 $ilUser = $DIC->user();
106
107 $status = ilAuthUtils::supportsLocalPasswordValidation($ilUser->getAuthMode(true));
108 $cmd = 'mount_webfolder';
109 if ($status === ilAuthUtils::LOCAL_PWV_USER && strlen($ilUser->getPasswd()) === 0) {
110 $cmd = 'showPasswordInstruction';
111 }
112
113 // Check if user has local password
114 return ["permission" => "read", "cmd" => $cmd, "lang_var" => "mount_webfolder", "enable_anonymous" => "false"];
115 }
116}
static supportsLocalPasswordValidation($a_authmode)
Check if local password validation is supported.
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()
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
bool $call_by_reference
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
global $DIC
Definition: feed.php:28
$ilUser
Definition: imgupload.php:34
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
array $settings
Setting values (LTI parameters, custom parameters and local parameters).
Definition: System.php:200