ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
User.php
Go to the documentation of this file.
1<?php
2
4
5use Sabre\DAV;
7
19class User extends DAVACL\Principal implements DAV\ICollection {
20
29 function createFile($name, $data = null) {
30
31 throw new DAV\Exception\Forbidden('Permission denied to create file (filename ' . $name . ')');
32
33 }
34
43
44 throw new DAV\Exception\Forbidden('Permission denied to create directory');
45
46 }
47
54 function getChild($name) {
55
56 $principal = $this->principalBackend->getPrincipalByPath($this->getPrincipalURL() . '/' . $name);
57 if (!$principal) {
58 throw new DAV\Exception\NotFound('Node with name ' . $name . ' was not found');
59 }
60 if ($name === 'calendar-proxy-read')
61 return new ProxyRead($this->principalBackend, $this->principalProperties);
62
63 if ($name === 'calendar-proxy-write')
64 return new ProxyWrite($this->principalBackend, $this->principalProperties);
65
66 throw new DAV\Exception\NotFound('Node with name ' . $name . ' was not found');
67
68 }
69
75 function getChildren() {
76
77 $r = [];
78 if ($this->principalBackend->getPrincipalByPath($this->getPrincipalURL() . '/calendar-proxy-read')) {
79 $r[] = new ProxyRead($this->principalBackend, $this->principalProperties);
80 }
81 if ($this->principalBackend->getPrincipalByPath($this->getPrincipalURL() . '/calendar-proxy-write')) {
82 $r[] = new ProxyWrite($this->principalBackend, $this->principalProperties);
83 }
84
85 return $r;
86
87 }
88
95 function childExists($name) {
96
97 try {
98 $this->getChild($name);
99 return true;
100 } catch (DAV\Exception\NotFound $e) {
101 return false;
102 }
103
104 }
105
118 function getACL() {
119
120 $acl = parent::getACL();
121 $acl[] = [
122 'privilege' => '{DAV:}read',
123 'principal' => $this->principalProperties['uri'] . '/calendar-proxy-read',
124 'protected' => true,
125 ];
126 $acl[] = [
127 'privilege' => '{DAV:}read',
128 'principal' => $this->principalProperties['uri'] . '/calendar-proxy-write',
129 'protected' => true,
130 ];
131 return $acl;
132
133 }
134
135}
An exception for terminatinating execution or to throw for unit testing.
ProxyRead principal.
Definition: ProxyRead.php:19
CalDAV principal.
Definition: User.php:19
createDirectory($name)
Creates a new subdirectory.
Definition: User.php:42
childExists($name)
Returns whether or not the child node exists.
Definition: User.php:95
createFile($name, $data=null)
Creates a new file in the directory.
Definition: User.php:29
getChild($name)
Returns a specific child node, referenced by its name.
Definition: User.php:54
getChildren()
Returns an array with all the child nodes.
Definition: User.php:75
getACL()
Returns a list of ACE's for this node.
Definition: User.php:118
Principal class.
Definition: Principal.php:23
Main Exception class.
Definition: Exception.php:18
$r
Definition: example_031.php:79
The ICollection Interface.
Definition: ICollection.php:14
$data
Definition: bench.php:6