ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilDAVMountPoint.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
21use Sabre\DAV\INode;
22use Sabre\DAV\Exception\Forbidden;
23use Sabre\DAV\ICollection;
24
34class ilDAVMountPoint implements ICollection
35{
36 use ilWebDAVReadOnlyNodeWriteFunctionsTrait;
37
38 protected int $user_id;
39
40 public function __construct(
41 protected string $client_id,
42 protected ilWebDAVObjFactory $web_dav_object_factory,
43 protected ilWebDAVRepositoryHelper $repo_helper,
44 ilObjUser $user
45 ) {
46 $this->user_id = $user->getId();
47 }
48
49 public function getName(): string
50 {
51 return 'MountPoint';
52 }
53
57 public function getChildren(): array
58 {
59 if ($this->user_id === ANONYMOUS_USER_ID) {
60 throw new Forbidden('Only for logged in users');
61 }
62 return [$this->web_dav_object_factory->getClientNode($this->client_id)];
63 }
64
65 public function getChild($name): ilDAVClientNode
66 {
67 return $this->web_dav_object_factory->getClientNode($name);
68 }
69
70 public function childExists($name): bool
71 {
72 return $name === $this->client_id;
73 }
74
75 public function getLastModified(): int
76 {
77 return strtotime('2000-01-01');
78 }
79}
This class represents the absolut Root-Node on a WebDAV request.
__construct(protected string $client_id, protected ilWebDAVObjFactory $web_dav_object_factory, protected ilWebDAVRepositoryHelper $repo_helper, ilObjUser $user)
User class.
const ANONYMOUS_USER_ID
Definition: constants.php:27
$client_id
Definition: ltiauth.php:67