@@ -30,52 +30,52 @@ |
||
30 | 30 | |
31 | 31 | class AppleProvisioningNode implements INode, IProperties { |
32 | 32 | |
33 | - const FILENAME = 'apple-provisioning.mobileconfig'; |
|
33 | + const FILENAME = 'apple-provisioning.mobileconfig'; |
|
34 | 34 | |
35 | - /** |
|
36 | - * @return string |
|
37 | - */ |
|
38 | - public function getName() { |
|
39 | - return self::FILENAME; |
|
40 | - } |
|
35 | + /** |
|
36 | + * @return string |
|
37 | + */ |
|
38 | + public function getName() { |
|
39 | + return self::FILENAME; |
|
40 | + } |
|
41 | 41 | |
42 | 42 | |
43 | - public function setName($name) { |
|
44 | - throw new Forbidden('Renaming ' . self::FILENAME . ' is forbidden'); |
|
45 | - } |
|
43 | + public function setName($name) { |
|
44 | + throw new Forbidden('Renaming ' . self::FILENAME . ' is forbidden'); |
|
45 | + } |
|
46 | 46 | |
47 | - /** |
|
48 | - * @return null |
|
49 | - */ |
|
50 | - public function getLastModified() { |
|
51 | - return null; |
|
52 | - } |
|
47 | + /** |
|
48 | + * @return null |
|
49 | + */ |
|
50 | + public function getLastModified() { |
|
51 | + return null; |
|
52 | + } |
|
53 | 53 | |
54 | - /** |
|
55 | - * @throws Forbidden |
|
56 | - */ |
|
57 | - public function delete() { |
|
58 | - throw new Forbidden(self::FILENAME . ' may not be deleted.'); |
|
59 | - } |
|
54 | + /** |
|
55 | + * @throws Forbidden |
|
56 | + */ |
|
57 | + public function delete() { |
|
58 | + throw new Forbidden(self::FILENAME . ' may not be deleted.'); |
|
59 | + } |
|
60 | 60 | |
61 | - /** |
|
62 | - * @param array $properties |
|
63 | - * @return array |
|
64 | - */ |
|
65 | - public function getProperties($properties) { |
|
66 | - $datetime = new \DateTime(); |
|
61 | + /** |
|
62 | + * @param array $properties |
|
63 | + * @return array |
|
64 | + */ |
|
65 | + public function getProperties($properties) { |
|
66 | + $datetime = new \DateTime(); |
|
67 | 67 | |
68 | - return [ |
|
69 | - '{DAV:}getcontentlength' => 42, |
|
70 | - '{DAV:}getlastmodified' => $datetime->format(\DateTime::RFC2822), |
|
71 | - ]; |
|
72 | - } |
|
68 | + return [ |
|
69 | + '{DAV:}getcontentlength' => 42, |
|
70 | + '{DAV:}getlastmodified' => $datetime->format(\DateTime::RFC2822), |
|
71 | + ]; |
|
72 | + } |
|
73 | 73 | |
74 | - /** |
|
75 | - * @param PropPatch $propPatch |
|
76 | - * @throws Forbidden |
|
77 | - */ |
|
78 | - public function propPatch(PropPatch $propPatch) { |
|
79 | - throw new Forbidden(self::FILENAME . '\'s properties may not be altered.'); |
|
80 | - } |
|
74 | + /** |
|
75 | + * @param PropPatch $propPatch |
|
76 | + * @throws Forbidden |
|
77 | + */ |
|
78 | + public function propPatch(PropPatch $propPatch) { |
|
79 | + throw new Forbidden(self::FILENAME . '\'s properties may not be altered.'); |
|
80 | + } |
|
81 | 81 | } |
82 | 82 | \ No newline at end of file |
@@ -35,102 +35,102 @@ discard block |
||
35 | 35 | |
36 | 36 | class AppleProvisioningPlugin extends ServerPlugin { |
37 | 37 | |
38 | - /** |
|
39 | - * @var Server |
|
40 | - */ |
|
41 | - protected $server; |
|
42 | - |
|
43 | - /** |
|
44 | - * @var IURLGenerator |
|
45 | - */ |
|
46 | - protected $urlGenerator; |
|
47 | - |
|
48 | - /** |
|
49 | - * @var IUserSession |
|
50 | - */ |
|
51 | - protected $userSession; |
|
52 | - |
|
53 | - /** |
|
54 | - * @var ThemingDefaults |
|
55 | - */ |
|
56 | - protected $themingDefaults; |
|
57 | - |
|
58 | - /** |
|
59 | - * @var IRequest |
|
60 | - */ |
|
61 | - protected $request; |
|
62 | - |
|
63 | - /** |
|
64 | - * AppleProvisioningPlugin constructor. |
|
65 | - * |
|
66 | - * @param IUserSession $userSession |
|
67 | - * @param IURLGenerator $urlGenerator |
|
68 | - * @param ThemingDefaults $themingDefaults |
|
69 | - * @param IRequest $request |
|
70 | - */ |
|
71 | - public function __construct(IUserSession $userSession, IURLGenerator $urlGenerator, ThemingDefaults $themingDefaults, IRequest $request) { |
|
72 | - $this->userSession = $userSession; |
|
73 | - $this->urlGenerator = $urlGenerator; |
|
74 | - $this->themingDefaults = $themingDefaults; |
|
75 | - $this->request = $request; |
|
76 | - } |
|
77 | - |
|
78 | - /** |
|
79 | - * @param Server $server |
|
80 | - */ |
|
81 | - public function initialize(Server $server) { |
|
82 | - $this->server = $server; |
|
83 | - $this->server->on('method:GET', [$this, 'httpGet'], 90); |
|
84 | - } |
|
85 | - |
|
86 | - /** |
|
87 | - * @param RequestInterface $request |
|
88 | - * @param ResponseInterface $response |
|
89 | - * @return boolean |
|
90 | - */ |
|
91 | - public function httpGet(RequestInterface $request, ResponseInterface $response) { |
|
92 | - if ($request->getPath() !== AppleProvisioningNode::FILENAME) { |
|
93 | - return true; |
|
94 | - } |
|
95 | - |
|
96 | - $user = $this->userSession->getUser(); |
|
97 | - if (!$user) { |
|
98 | - return true; |
|
99 | - } |
|
100 | - |
|
101 | - $serverProtocol = $this->request->getServerProtocol(); |
|
102 | - $USE_SSL = ($serverProtocol === 'https'); |
|
103 | - |
|
104 | - $absoluteURL = $this->urlGenerator->getAbsoluteURL(''); |
|
105 | - $parsedUrl = parse_url($absoluteURL); |
|
106 | - if (isset($parsedUrl['port'])) { |
|
107 | - $SERVER_PORT = $parsedUrl['port']; |
|
108 | - } else { |
|
109 | - $SERVER_PORT = $USE_SSL ? 443 : 80; |
|
110 | - } |
|
111 | - $SERVER_URL = $serverProtocol . '://' . $parsedUrl['host'] . '/'; |
|
112 | - |
|
113 | - $DESCRIPTION = $this->themingDefaults->getName(); |
|
114 | - $PRINCIPAL_URL = implode([ |
|
115 | - $this->urlGenerator->linkTo('', 'remote.php'), |
|
116 | - '/dav/principals/users/', |
|
117 | - $user->getUID(), |
|
118 | - ]); |
|
119 | - $USER_ID = $user->getUID(); |
|
120 | - |
|
121 | - $reverseDomain = implode('.', array_reverse(explode('.', $parsedUrl['host']))); |
|
122 | - |
|
123 | - $CALDAV_UUID = UUIDUtil::getUUID(); |
|
124 | - $CARDDAV_UUID = UUIDUtil::getUUID(); |
|
125 | - $PROFILE_UUID = UUIDUtil::getUUID(); |
|
126 | - |
|
127 | - $CALDAV_IDENTIFIER = $reverseDomain . '.' . $CALDAV_UUID; |
|
128 | - $CARDDAV_IDENTIFIER = $reverseDomain . '.' . $CARDDAV_UUID; |
|
129 | - $PROFILE_IDENTIFIER = $reverseDomain . '.' . $PROFILE_UUID; |
|
130 | - |
|
131 | - $USE_SSL = $USE_SSL ? '<true/>' : '<false/>'; |
|
132 | - |
|
133 | - $xml = <<<EOF |
|
38 | + /** |
|
39 | + * @var Server |
|
40 | + */ |
|
41 | + protected $server; |
|
42 | + |
|
43 | + /** |
|
44 | + * @var IURLGenerator |
|
45 | + */ |
|
46 | + protected $urlGenerator; |
|
47 | + |
|
48 | + /** |
|
49 | + * @var IUserSession |
|
50 | + */ |
|
51 | + protected $userSession; |
|
52 | + |
|
53 | + /** |
|
54 | + * @var ThemingDefaults |
|
55 | + */ |
|
56 | + protected $themingDefaults; |
|
57 | + |
|
58 | + /** |
|
59 | + * @var IRequest |
|
60 | + */ |
|
61 | + protected $request; |
|
62 | + |
|
63 | + /** |
|
64 | + * AppleProvisioningPlugin constructor. |
|
65 | + * |
|
66 | + * @param IUserSession $userSession |
|
67 | + * @param IURLGenerator $urlGenerator |
|
68 | + * @param ThemingDefaults $themingDefaults |
|
69 | + * @param IRequest $request |
|
70 | + */ |
|
71 | + public function __construct(IUserSession $userSession, IURLGenerator $urlGenerator, ThemingDefaults $themingDefaults, IRequest $request) { |
|
72 | + $this->userSession = $userSession; |
|
73 | + $this->urlGenerator = $urlGenerator; |
|
74 | + $this->themingDefaults = $themingDefaults; |
|
75 | + $this->request = $request; |
|
76 | + } |
|
77 | + |
|
78 | + /** |
|
79 | + * @param Server $server |
|
80 | + */ |
|
81 | + public function initialize(Server $server) { |
|
82 | + $this->server = $server; |
|
83 | + $this->server->on('method:GET', [$this, 'httpGet'], 90); |
|
84 | + } |
|
85 | + |
|
86 | + /** |
|
87 | + * @param RequestInterface $request |
|
88 | + * @param ResponseInterface $response |
|
89 | + * @return boolean |
|
90 | + */ |
|
91 | + public function httpGet(RequestInterface $request, ResponseInterface $response) { |
|
92 | + if ($request->getPath() !== AppleProvisioningNode::FILENAME) { |
|
93 | + return true; |
|
94 | + } |
|
95 | + |
|
96 | + $user = $this->userSession->getUser(); |
|
97 | + if (!$user) { |
|
98 | + return true; |
|
99 | + } |
|
100 | + |
|
101 | + $serverProtocol = $this->request->getServerProtocol(); |
|
102 | + $USE_SSL = ($serverProtocol === 'https'); |
|
103 | + |
|
104 | + $absoluteURL = $this->urlGenerator->getAbsoluteURL(''); |
|
105 | + $parsedUrl = parse_url($absoluteURL); |
|
106 | + if (isset($parsedUrl['port'])) { |
|
107 | + $SERVER_PORT = $parsedUrl['port']; |
|
108 | + } else { |
|
109 | + $SERVER_PORT = $USE_SSL ? 443 : 80; |
|
110 | + } |
|
111 | + $SERVER_URL = $serverProtocol . '://' . $parsedUrl['host'] . '/'; |
|
112 | + |
|
113 | + $DESCRIPTION = $this->themingDefaults->getName(); |
|
114 | + $PRINCIPAL_URL = implode([ |
|
115 | + $this->urlGenerator->linkTo('', 'remote.php'), |
|
116 | + '/dav/principals/users/', |
|
117 | + $user->getUID(), |
|
118 | + ]); |
|
119 | + $USER_ID = $user->getUID(); |
|
120 | + |
|
121 | + $reverseDomain = implode('.', array_reverse(explode('.', $parsedUrl['host']))); |
|
122 | + |
|
123 | + $CALDAV_UUID = UUIDUtil::getUUID(); |
|
124 | + $CARDDAV_UUID = UUIDUtil::getUUID(); |
|
125 | + $PROFILE_UUID = UUIDUtil::getUUID(); |
|
126 | + |
|
127 | + $CALDAV_IDENTIFIER = $reverseDomain . '.' . $CALDAV_UUID; |
|
128 | + $CARDDAV_IDENTIFIER = $reverseDomain . '.' . $CARDDAV_UUID; |
|
129 | + $PROFILE_IDENTIFIER = $reverseDomain . '.' . $PROFILE_UUID; |
|
130 | + |
|
131 | + $USE_SSL = $USE_SSL ? '<true/>' : '<false/>'; |
|
132 | + |
|
133 | + $xml = <<<EOF |
|
134 | 134 | <?xml version="1.0" encoding="UTF-8"?> |
135 | 135 | <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> |
136 | 136 | <plist version="1.0"> |
@@ -206,15 +206,15 @@ discard block |
||
206 | 206 | </plist> |
207 | 207 | EOF; |
208 | 208 | |
209 | - // TODO - use sprintf to properly replace placeholders in template |
|
210 | - // instead of this template thingy |
|
209 | + // TODO - use sprintf to properly replace placeholders in template |
|
210 | + // instead of this template thingy |
|
211 | 211 | |
212 | - $this->server->httpResponse->setStatus(207); |
|
213 | - // TODO use Content disposition cause it's a download, also see export plugin for calendar for refernce |
|
214 | - $this->server->httpResponse->setHeader('Content-Type', 'application/xml; charset=utf-8'); |
|
215 | - $this->server->httpResponse->setBody($xml); |
|
212 | + $this->server->httpResponse->setStatus(207); |
|
213 | + // TODO use Content disposition cause it's a download, also see export plugin for calendar for refernce |
|
214 | + $this->server->httpResponse->setHeader('Content-Type', 'application/xml; charset=utf-8'); |
|
215 | + $this->server->httpResponse->setBody($xml); |
|
216 | 216 | |
217 | - return false; |
|
218 | - } |
|
217 | + return false; |
|
218 | + } |
|
219 | 219 | |
220 | 220 | } |
@@ -67,246 +67,246 @@ |
||
67 | 67 | |
68 | 68 | class Server { |
69 | 69 | |
70 | - /** @var IRequest */ |
|
71 | - private $request; |
|
70 | + /** @var IRequest */ |
|
71 | + private $request; |
|
72 | 72 | |
73 | - /** @var string */ |
|
74 | - private $baseUri; |
|
73 | + /** @var string */ |
|
74 | + private $baseUri; |
|
75 | 75 | |
76 | - /** @var Connector\Sabre\Server */ |
|
77 | - public $server; |
|
76 | + /** @var Connector\Sabre\Server */ |
|
77 | + public $server; |
|
78 | 78 | |
79 | - public function __construct(IRequest $request, $baseUri) { |
|
80 | - $this->request = $request; |
|
81 | - $this->baseUri = $baseUri; |
|
82 | - $logger = \OC::$server->getLogger(); |
|
83 | - $dispatcher = \OC::$server->getEventDispatcher(); |
|
79 | + public function __construct(IRequest $request, $baseUri) { |
|
80 | + $this->request = $request; |
|
81 | + $this->baseUri = $baseUri; |
|
82 | + $logger = \OC::$server->getLogger(); |
|
83 | + $dispatcher = \OC::$server->getEventDispatcher(); |
|
84 | 84 | |
85 | - $root = new RootCollection(); |
|
86 | - $this->server = new \OCA\DAV\Connector\Sabre\Server(new CachingTree($root)); |
|
85 | + $root = new RootCollection(); |
|
86 | + $this->server = new \OCA\DAV\Connector\Sabre\Server(new CachingTree($root)); |
|
87 | 87 | |
88 | - // Add maintenance plugin |
|
89 | - $this->server->addPlugin(new \OCA\DAV\Connector\Sabre\MaintenancePlugin(\OC::$server->getConfig())); |
|
88 | + // Add maintenance plugin |
|
89 | + $this->server->addPlugin(new \OCA\DAV\Connector\Sabre\MaintenancePlugin(\OC::$server->getConfig())); |
|
90 | 90 | |
91 | - // Backends |
|
92 | - $authBackend = new Auth( |
|
93 | - \OC::$server->getSession(), |
|
94 | - \OC::$server->getUserSession(), |
|
95 | - \OC::$server->getRequest(), |
|
96 | - \OC::$server->getTwoFactorAuthManager(), |
|
97 | - \OC::$server->getBruteForceThrottler() |
|
98 | - ); |
|
91 | + // Backends |
|
92 | + $authBackend = new Auth( |
|
93 | + \OC::$server->getSession(), |
|
94 | + \OC::$server->getUserSession(), |
|
95 | + \OC::$server->getRequest(), |
|
96 | + \OC::$server->getTwoFactorAuthManager(), |
|
97 | + \OC::$server->getBruteForceThrottler() |
|
98 | + ); |
|
99 | 99 | |
100 | - // Set URL explicitly due to reverse-proxy situations |
|
101 | - $this->server->httpRequest->setUrl($this->request->getRequestUri()); |
|
102 | - $this->server->setBaseUri($this->baseUri); |
|
100 | + // Set URL explicitly due to reverse-proxy situations |
|
101 | + $this->server->httpRequest->setUrl($this->request->getRequestUri()); |
|
102 | + $this->server->setBaseUri($this->baseUri); |
|
103 | 103 | |
104 | - $this->server->addPlugin(new BlockLegacyClientPlugin(\OC::$server->getConfig())); |
|
105 | - $this->server->addPlugin(new AnonymousOptionsPlugin()); |
|
106 | - $authPlugin = new Plugin(); |
|
107 | - $authPlugin->addBackend(new PublicAuth()); |
|
108 | - $this->server->addPlugin($authPlugin); |
|
104 | + $this->server->addPlugin(new BlockLegacyClientPlugin(\OC::$server->getConfig())); |
|
105 | + $this->server->addPlugin(new AnonymousOptionsPlugin()); |
|
106 | + $authPlugin = new Plugin(); |
|
107 | + $authPlugin->addBackend(new PublicAuth()); |
|
108 | + $this->server->addPlugin($authPlugin); |
|
109 | 109 | |
110 | - // allow setup of additional auth backends |
|
111 | - $event = new SabrePluginEvent($this->server); |
|
112 | - $dispatcher->dispatch('OCA\DAV\Connector\Sabre::authInit', $event); |
|
110 | + // allow setup of additional auth backends |
|
111 | + $event = new SabrePluginEvent($this->server); |
|
112 | + $dispatcher->dispatch('OCA\DAV\Connector\Sabre::authInit', $event); |
|
113 | 113 | |
114 | - $bearerAuthBackend = new BearerAuth( |
|
115 | - \OC::$server->getUserSession(), |
|
116 | - \OC::$server->getSession(), |
|
117 | - \OC::$server->getRequest() |
|
118 | - ); |
|
119 | - $authPlugin->addBackend($bearerAuthBackend); |
|
120 | - // because we are throwing exceptions this plugin has to be the last one |
|
121 | - $authPlugin->addBackend($authBackend); |
|
114 | + $bearerAuthBackend = new BearerAuth( |
|
115 | + \OC::$server->getUserSession(), |
|
116 | + \OC::$server->getSession(), |
|
117 | + \OC::$server->getRequest() |
|
118 | + ); |
|
119 | + $authPlugin->addBackend($bearerAuthBackend); |
|
120 | + // because we are throwing exceptions this plugin has to be the last one |
|
121 | + $authPlugin->addBackend($authBackend); |
|
122 | 122 | |
123 | - // debugging |
|
124 | - if(\OC::$server->getConfig()->getSystemValue('debug', false)) { |
|
125 | - $this->server->addPlugin(new \Sabre\DAV\Browser\Plugin()); |
|
126 | - } else { |
|
127 | - $this->server->addPlugin(new DummyGetResponsePlugin()); |
|
128 | - } |
|
123 | + // debugging |
|
124 | + if(\OC::$server->getConfig()->getSystemValue('debug', false)) { |
|
125 | + $this->server->addPlugin(new \Sabre\DAV\Browser\Plugin()); |
|
126 | + } else { |
|
127 | + $this->server->addPlugin(new DummyGetResponsePlugin()); |
|
128 | + } |
|
129 | 129 | |
130 | - $this->server->addPlugin(new \OCA\DAV\Connector\Sabre\ExceptionLoggerPlugin('webdav', $logger)); |
|
131 | - $this->server->addPlugin(new \OCA\DAV\Connector\Sabre\LockPlugin()); |
|
132 | - $this->server->addPlugin(new \Sabre\DAV\Sync\Plugin()); |
|
130 | + $this->server->addPlugin(new \OCA\DAV\Connector\Sabre\ExceptionLoggerPlugin('webdav', $logger)); |
|
131 | + $this->server->addPlugin(new \OCA\DAV\Connector\Sabre\LockPlugin()); |
|
132 | + $this->server->addPlugin(new \Sabre\DAV\Sync\Plugin()); |
|
133 | 133 | |
134 | - // acl |
|
135 | - $acl = new DavAclPlugin(); |
|
136 | - $acl->principalCollectionSet = [ |
|
137 | - 'principals/users', 'principals/groups', |
|
138 | - 'principals/calendar-resources', |
|
139 | - 'principals/calendar-rooms', |
|
140 | - ]; |
|
141 | - $acl->defaultUsernamePath = 'principals/users'; |
|
142 | - $this->server->addPlugin($acl); |
|
134 | + // acl |
|
135 | + $acl = new DavAclPlugin(); |
|
136 | + $acl->principalCollectionSet = [ |
|
137 | + 'principals/users', 'principals/groups', |
|
138 | + 'principals/calendar-resources', |
|
139 | + 'principals/calendar-rooms', |
|
140 | + ]; |
|
141 | + $acl->defaultUsernamePath = 'principals/users'; |
|
142 | + $this->server->addPlugin($acl); |
|
143 | 143 | |
144 | - // calendar plugins |
|
145 | - if ($this->requestIsForSubtree(['calendars', 'public-calendars', 'system-calendars', 'principals'])) { |
|
146 | - $this->server->addPlugin(new \OCA\DAV\CalDAV\Plugin()); |
|
147 | - $this->server->addPlugin(new \Sabre\CalDAV\ICSExportPlugin()); |
|
148 | - $this->server->addPlugin(new \OCA\DAV\CalDAV\Schedule\Plugin()); |
|
149 | - if (\OC::$server->getConfig()->getAppValue('dav', 'sendInvitations', 'yes') === 'yes') { |
|
150 | - $this->server->addPlugin(\OC::$server->query(\OCA\DAV\CalDAV\Schedule\IMipPlugin::class)); |
|
151 | - } |
|
152 | - $this->server->addPlugin(new \Sabre\CalDAV\Subscriptions\Plugin()); |
|
153 | - $this->server->addPlugin(new \Sabre\CalDAV\Notifications\Plugin()); |
|
154 | - $this->server->addPlugin(new DAV\Sharing\Plugin($authBackend, \OC::$server->getRequest())); |
|
155 | - $this->server->addPlugin(new \OCA\DAV\CalDAV\Publishing\PublishPlugin( |
|
156 | - \OC::$server->getConfig(), |
|
157 | - \OC::$server->getURLGenerator() |
|
158 | - )); |
|
159 | - } |
|
144 | + // calendar plugins |
|
145 | + if ($this->requestIsForSubtree(['calendars', 'public-calendars', 'system-calendars', 'principals'])) { |
|
146 | + $this->server->addPlugin(new \OCA\DAV\CalDAV\Plugin()); |
|
147 | + $this->server->addPlugin(new \Sabre\CalDAV\ICSExportPlugin()); |
|
148 | + $this->server->addPlugin(new \OCA\DAV\CalDAV\Schedule\Plugin()); |
|
149 | + if (\OC::$server->getConfig()->getAppValue('dav', 'sendInvitations', 'yes') === 'yes') { |
|
150 | + $this->server->addPlugin(\OC::$server->query(\OCA\DAV\CalDAV\Schedule\IMipPlugin::class)); |
|
151 | + } |
|
152 | + $this->server->addPlugin(new \Sabre\CalDAV\Subscriptions\Plugin()); |
|
153 | + $this->server->addPlugin(new \Sabre\CalDAV\Notifications\Plugin()); |
|
154 | + $this->server->addPlugin(new DAV\Sharing\Plugin($authBackend, \OC::$server->getRequest())); |
|
155 | + $this->server->addPlugin(new \OCA\DAV\CalDAV\Publishing\PublishPlugin( |
|
156 | + \OC::$server->getConfig(), |
|
157 | + \OC::$server->getURLGenerator() |
|
158 | + )); |
|
159 | + } |
|
160 | 160 | |
161 | - // addressbook plugins |
|
162 | - if ($this->requestIsForSubtree(['addressbooks', 'principals'])) { |
|
163 | - $this->server->addPlugin(new DAV\Sharing\Plugin($authBackend, \OC::$server->getRequest())); |
|
164 | - $this->server->addPlugin(new \OCA\DAV\CardDAV\Plugin()); |
|
165 | - $this->server->addPlugin(new VCFExportPlugin()); |
|
166 | - $this->server->addPlugin(new ImageExportPlugin(new PhotoCache(\OC::$server->getAppDataDir('dav-photocache')))); |
|
167 | - } |
|
161 | + // addressbook plugins |
|
162 | + if ($this->requestIsForSubtree(['addressbooks', 'principals'])) { |
|
163 | + $this->server->addPlugin(new DAV\Sharing\Plugin($authBackend, \OC::$server->getRequest())); |
|
164 | + $this->server->addPlugin(new \OCA\DAV\CardDAV\Plugin()); |
|
165 | + $this->server->addPlugin(new VCFExportPlugin()); |
|
166 | + $this->server->addPlugin(new ImageExportPlugin(new PhotoCache(\OC::$server->getAppDataDir('dav-photocache')))); |
|
167 | + } |
|
168 | 168 | |
169 | - // system tags plugins |
|
170 | - $this->server->addPlugin(new SystemTagPlugin( |
|
171 | - \OC::$server->getSystemTagManager(), |
|
172 | - \OC::$server->getGroupManager(), |
|
173 | - \OC::$server->getUserSession() |
|
174 | - )); |
|
169 | + // system tags plugins |
|
170 | + $this->server->addPlugin(new SystemTagPlugin( |
|
171 | + \OC::$server->getSystemTagManager(), |
|
172 | + \OC::$server->getGroupManager(), |
|
173 | + \OC::$server->getUserSession() |
|
174 | + )); |
|
175 | 175 | |
176 | - // comments plugin |
|
177 | - $this->server->addPlugin(new CommentsPlugin( |
|
178 | - \OC::$server->getCommentsManager(), |
|
179 | - \OC::$server->getUserSession() |
|
180 | - )); |
|
176 | + // comments plugin |
|
177 | + $this->server->addPlugin(new CommentsPlugin( |
|
178 | + \OC::$server->getCommentsManager(), |
|
179 | + \OC::$server->getUserSession() |
|
180 | + )); |
|
181 | 181 | |
182 | - $this->server->addPlugin(new CopyEtagHeaderPlugin()); |
|
183 | - $this->server->addPlugin(new ChunkingPlugin()); |
|
182 | + $this->server->addPlugin(new CopyEtagHeaderPlugin()); |
|
183 | + $this->server->addPlugin(new ChunkingPlugin()); |
|
184 | 184 | |
185 | - // allow setup of additional plugins |
|
186 | - $dispatcher->dispatch('OCA\DAV\Connector\Sabre::addPlugin', $event); |
|
185 | + // allow setup of additional plugins |
|
186 | + $dispatcher->dispatch('OCA\DAV\Connector\Sabre::addPlugin', $event); |
|
187 | 187 | |
188 | - // Some WebDAV clients do require Class 2 WebDAV support (locking), since |
|
189 | - // we do not provide locking we emulate it using a fake locking plugin. |
|
190 | - if($request->isUserAgent([ |
|
191 | - '/WebDAVFS/', |
|
192 | - '/OneNote/', |
|
193 | - '/^Microsoft-WebDAV/',// Microsoft-WebDAV-MiniRedir/6.1.7601 |
|
194 | - ])) { |
|
195 | - $this->server->addPlugin(new FakeLockerPlugin()); |
|
196 | - } |
|
188 | + // Some WebDAV clients do require Class 2 WebDAV support (locking), since |
|
189 | + // we do not provide locking we emulate it using a fake locking plugin. |
|
190 | + if($request->isUserAgent([ |
|
191 | + '/WebDAVFS/', |
|
192 | + '/OneNote/', |
|
193 | + '/^Microsoft-WebDAV/',// Microsoft-WebDAV-MiniRedir/6.1.7601 |
|
194 | + ])) { |
|
195 | + $this->server->addPlugin(new FakeLockerPlugin()); |
|
196 | + } |
|
197 | 197 | |
198 | - if (BrowserErrorPagePlugin::isBrowserRequest($request)) { |
|
199 | - $this->server->addPlugin(new BrowserErrorPagePlugin()); |
|
200 | - } |
|
198 | + if (BrowserErrorPagePlugin::isBrowserRequest($request)) { |
|
199 | + $this->server->addPlugin(new BrowserErrorPagePlugin()); |
|
200 | + } |
|
201 | 201 | |
202 | - $lazySearchBackend = new LazySearchBackend(); |
|
203 | - $this->server->addPlugin(new SearchPlugin($lazySearchBackend)); |
|
202 | + $lazySearchBackend = new LazySearchBackend(); |
|
203 | + $this->server->addPlugin(new SearchPlugin($lazySearchBackend)); |
|
204 | 204 | |
205 | - // wait with registering these until auth is handled and the filesystem is setup |
|
206 | - $this->server->on('beforeMethod', function () use ($root, $lazySearchBackend) { |
|
207 | - // custom properties plugin must be the last one |
|
208 | - $userSession = \OC::$server->getUserSession(); |
|
209 | - $user = $userSession->getUser(); |
|
210 | - if ($user !== null) { |
|
211 | - $view = \OC\Files\Filesystem::getView(); |
|
212 | - $this->server->addPlugin( |
|
213 | - new FilesPlugin( |
|
214 | - $this->server->tree, |
|
215 | - \OC::$server->getConfig(), |
|
216 | - $this->request, |
|
217 | - \OC::$server->getPreviewManager(), |
|
218 | - false, |
|
219 | - !\OC::$server->getConfig()->getSystemValue('debug', false) |
|
220 | - ) |
|
221 | - ); |
|
205 | + // wait with registering these until auth is handled and the filesystem is setup |
|
206 | + $this->server->on('beforeMethod', function () use ($root, $lazySearchBackend) { |
|
207 | + // custom properties plugin must be the last one |
|
208 | + $userSession = \OC::$server->getUserSession(); |
|
209 | + $user = $userSession->getUser(); |
|
210 | + if ($user !== null) { |
|
211 | + $view = \OC\Files\Filesystem::getView(); |
|
212 | + $this->server->addPlugin( |
|
213 | + new FilesPlugin( |
|
214 | + $this->server->tree, |
|
215 | + \OC::$server->getConfig(), |
|
216 | + $this->request, |
|
217 | + \OC::$server->getPreviewManager(), |
|
218 | + false, |
|
219 | + !\OC::$server->getConfig()->getSystemValue('debug', false) |
|
220 | + ) |
|
221 | + ); |
|
222 | 222 | |
223 | - $this->server->addPlugin( |
|
224 | - new \Sabre\DAV\PropertyStorage\Plugin( |
|
225 | - new CustomPropertiesBackend( |
|
226 | - $this->server->tree, |
|
227 | - \OC::$server->getDatabaseConnection(), |
|
228 | - \OC::$server->getUserSession()->getUser() |
|
229 | - ) |
|
230 | - ) |
|
231 | - ); |
|
232 | - if ($view !== null) { |
|
233 | - $this->server->addPlugin( |
|
234 | - new QuotaPlugin($view, false)); |
|
235 | - } |
|
236 | - $this->server->addPlugin( |
|
237 | - new TagsPlugin( |
|
238 | - $this->server->tree, \OC::$server->getTagManager() |
|
239 | - ) |
|
240 | - ); |
|
241 | - // TODO: switch to LazyUserFolder |
|
242 | - $userFolder = \OC::$server->getUserFolder(); |
|
243 | - $this->server->addPlugin(new SharesPlugin( |
|
244 | - $this->server->tree, |
|
245 | - $userSession, |
|
246 | - $userFolder, |
|
247 | - \OC::$server->getShareManager() |
|
248 | - )); |
|
249 | - $this->server->addPlugin(new CommentPropertiesPlugin( |
|
250 | - \OC::$server->getCommentsManager(), |
|
251 | - $userSession |
|
252 | - )); |
|
253 | - $this->server->addPlugin(new \OCA\DAV\CalDAV\Search\SearchPlugin()); |
|
254 | - if ($view !== null) { |
|
255 | - $this->server->addPlugin(new FilesReportPlugin( |
|
256 | - $this->server->tree, |
|
257 | - $view, |
|
258 | - \OC::$server->getSystemTagManager(), |
|
259 | - \OC::$server->getSystemTagObjectMapper(), |
|
260 | - \OC::$server->getTagManager(), |
|
261 | - $userSession, |
|
262 | - \OC::$server->getGroupManager(), |
|
263 | - $userFolder |
|
264 | - )); |
|
265 | - $lazySearchBackend->setBackend(new \OCA\DAV\Files\FileSearchBackend( |
|
266 | - $this->server->tree, |
|
267 | - $user, |
|
268 | - \OC::$server->getRootFolder(), |
|
269 | - \OC::$server->getShareManager(), |
|
270 | - $view |
|
271 | - )); |
|
272 | - } |
|
273 | - $this->server->addPlugin(new \OCA\DAV\CalDAV\BirthdayCalendar\EnablePlugin( |
|
274 | - \OC::$server->getConfig(), |
|
275 | - \OC::$server->query(BirthdayService::class) |
|
276 | - )); |
|
277 | - $this->server->addPlugin(new AppleProvisioningPlugin( |
|
278 | - \OC::$server->getUserSession(), |
|
279 | - \OC::$server->getURLGenerator(), |
|
280 | - \OC::$server->getThemingDefaults(), |
|
281 | - \OC::$server->getRequest() |
|
282 | - )); |
|
283 | - } |
|
223 | + $this->server->addPlugin( |
|
224 | + new \Sabre\DAV\PropertyStorage\Plugin( |
|
225 | + new CustomPropertiesBackend( |
|
226 | + $this->server->tree, |
|
227 | + \OC::$server->getDatabaseConnection(), |
|
228 | + \OC::$server->getUserSession()->getUser() |
|
229 | + ) |
|
230 | + ) |
|
231 | + ); |
|
232 | + if ($view !== null) { |
|
233 | + $this->server->addPlugin( |
|
234 | + new QuotaPlugin($view, false)); |
|
235 | + } |
|
236 | + $this->server->addPlugin( |
|
237 | + new TagsPlugin( |
|
238 | + $this->server->tree, \OC::$server->getTagManager() |
|
239 | + ) |
|
240 | + ); |
|
241 | + // TODO: switch to LazyUserFolder |
|
242 | + $userFolder = \OC::$server->getUserFolder(); |
|
243 | + $this->server->addPlugin(new SharesPlugin( |
|
244 | + $this->server->tree, |
|
245 | + $userSession, |
|
246 | + $userFolder, |
|
247 | + \OC::$server->getShareManager() |
|
248 | + )); |
|
249 | + $this->server->addPlugin(new CommentPropertiesPlugin( |
|
250 | + \OC::$server->getCommentsManager(), |
|
251 | + $userSession |
|
252 | + )); |
|
253 | + $this->server->addPlugin(new \OCA\DAV\CalDAV\Search\SearchPlugin()); |
|
254 | + if ($view !== null) { |
|
255 | + $this->server->addPlugin(new FilesReportPlugin( |
|
256 | + $this->server->tree, |
|
257 | + $view, |
|
258 | + \OC::$server->getSystemTagManager(), |
|
259 | + \OC::$server->getSystemTagObjectMapper(), |
|
260 | + \OC::$server->getTagManager(), |
|
261 | + $userSession, |
|
262 | + \OC::$server->getGroupManager(), |
|
263 | + $userFolder |
|
264 | + )); |
|
265 | + $lazySearchBackend->setBackend(new \OCA\DAV\Files\FileSearchBackend( |
|
266 | + $this->server->tree, |
|
267 | + $user, |
|
268 | + \OC::$server->getRootFolder(), |
|
269 | + \OC::$server->getShareManager(), |
|
270 | + $view |
|
271 | + )); |
|
272 | + } |
|
273 | + $this->server->addPlugin(new \OCA\DAV\CalDAV\BirthdayCalendar\EnablePlugin( |
|
274 | + \OC::$server->getConfig(), |
|
275 | + \OC::$server->query(BirthdayService::class) |
|
276 | + )); |
|
277 | + $this->server->addPlugin(new AppleProvisioningPlugin( |
|
278 | + \OC::$server->getUserSession(), |
|
279 | + \OC::$server->getURLGenerator(), |
|
280 | + \OC::$server->getThemingDefaults(), |
|
281 | + \OC::$server->getRequest() |
|
282 | + )); |
|
283 | + } |
|
284 | 284 | |
285 | - // register plugins from apps |
|
286 | - $pluginManager = new PluginManager( |
|
287 | - \OC::$server, |
|
288 | - \OC::$server->getAppManager() |
|
289 | - ); |
|
290 | - foreach ($pluginManager->getAppPlugins() as $appPlugin) { |
|
291 | - $this->server->addPlugin($appPlugin); |
|
292 | - } |
|
293 | - foreach ($pluginManager->getAppCollections() as $appCollection) { |
|
294 | - $root->addChild($appCollection); |
|
295 | - } |
|
296 | - }); |
|
297 | - } |
|
285 | + // register plugins from apps |
|
286 | + $pluginManager = new PluginManager( |
|
287 | + \OC::$server, |
|
288 | + \OC::$server->getAppManager() |
|
289 | + ); |
|
290 | + foreach ($pluginManager->getAppPlugins() as $appPlugin) { |
|
291 | + $this->server->addPlugin($appPlugin); |
|
292 | + } |
|
293 | + foreach ($pluginManager->getAppCollections() as $appCollection) { |
|
294 | + $root->addChild($appCollection); |
|
295 | + } |
|
296 | + }); |
|
297 | + } |
|
298 | 298 | |
299 | - public function exec() { |
|
300 | - $this->server->exec(); |
|
301 | - } |
|
299 | + public function exec() { |
|
300 | + $this->server->exec(); |
|
301 | + } |
|
302 | 302 | |
303 | - private function requestIsForSubtree(array $subTrees): bool { |
|
304 | - foreach ($subTrees as $subTree) { |
|
305 | - $subTree = trim($subTree, ' /'); |
|
306 | - if (strpos($this->server->getRequestUri(), $subTree.'/') === 0) { |
|
307 | - return true; |
|
308 | - } |
|
309 | - } |
|
310 | - return false; |
|
311 | - } |
|
303 | + private function requestIsForSubtree(array $subTrees): bool { |
|
304 | + foreach ($subTrees as $subTree) { |
|
305 | + $subTree = trim($subTree, ' /'); |
|
306 | + if (strpos($this->server->getRequestUri(), $subTree.'/') === 0) { |
|
307 | + return true; |
|
308 | + } |
|
309 | + } |
|
310 | + return false; |
|
311 | + } |
|
312 | 312 | } |
@@ -40,121 +40,121 @@ |
||
40 | 40 | |
41 | 41 | class RootCollection extends SimpleCollection { |
42 | 42 | |
43 | - public function __construct() { |
|
44 | - $config = \OC::$server->getConfig(); |
|
45 | - $l10n = \OC::$server->getL10N('dav'); |
|
46 | - $random = \OC::$server->getSecureRandom(); |
|
47 | - $logger = \OC::$server->getLogger(); |
|
48 | - $userManager = \OC::$server->getUserManager(); |
|
49 | - $userSession = \OC::$server->getUserSession(); |
|
50 | - $groupManager = \OC::$server->getGroupManager(); |
|
51 | - $shareManager = \OC::$server->getShareManager(); |
|
52 | - $db = \OC::$server->getDatabaseConnection(); |
|
53 | - $dispatcher = \OC::$server->getEventDispatcher(); |
|
54 | - $userPrincipalBackend = new Principal( |
|
55 | - $userManager, |
|
56 | - $groupManager, |
|
57 | - $shareManager, |
|
58 | - \OC::$server->getUserSession(), |
|
59 | - $config |
|
60 | - ); |
|
61 | - $groupPrincipalBackend = new GroupPrincipalBackend($groupManager); |
|
62 | - $calendarResourcePrincipalBackend = new ResourcePrincipalBackend($db, $userSession, $groupManager, $logger); |
|
63 | - $calendarRoomPrincipalBackend = new RoomPrincipalBackend($db, $userSession, $groupManager, $logger); |
|
64 | - // as soon as debug mode is enabled we allow listing of principals |
|
65 | - $disableListing = !$config->getSystemValue('debug', false); |
|
66 | - |
|
67 | - // setup the first level of the dav tree |
|
68 | - $userPrincipals = new Collection($userPrincipalBackend, 'principals/users'); |
|
69 | - $userPrincipals->disableListing = $disableListing; |
|
70 | - $groupPrincipals = new Collection($groupPrincipalBackend, 'principals/groups'); |
|
71 | - $groupPrincipals->disableListing = $disableListing; |
|
72 | - $systemPrincipals = new Collection(new SystemPrincipalBackend(), 'principals/system'); |
|
73 | - $systemPrincipals->disableListing = $disableListing; |
|
74 | - $calendarResourcePrincipals = new Collection($calendarResourcePrincipalBackend, 'principals/calendar-resources'); |
|
75 | - $calendarResourcePrincipals->disableListing = $disableListing; |
|
76 | - $calendarRoomPrincipals = new Collection($calendarRoomPrincipalBackend, 'principals/calendar-rooms'); |
|
77 | - $calendarRoomPrincipals->disableListing = $disableListing; |
|
78 | - |
|
79 | - |
|
80 | - $filesCollection = new Files\RootCollection($userPrincipalBackend, 'principals/users'); |
|
81 | - $filesCollection->disableListing = $disableListing; |
|
82 | - $caldavBackend = new CalDavBackend($db, $userPrincipalBackend, $userManager, $groupManager, $random, $logger, $dispatcher); |
|
83 | - $userCalendarRoot = new CalendarRoot($userPrincipalBackend, $caldavBackend, 'principals/users'); |
|
84 | - $userCalendarRoot->disableListing = $disableListing; |
|
85 | - |
|
86 | - $resourceCalendarCaldavBackend = new CalDavBackend($db, $userPrincipalBackend, $userManager, $groupManager, $random, $logger, $dispatcher); |
|
87 | - $resourceCalendarRoot = new CalendarRoot($calendarResourcePrincipalBackend, $caldavBackend, 'principals/calendar-resources'); |
|
88 | - $resourceCalendarRoot->disableListing = $disableListing; |
|
89 | - $roomCalendarCaldavBackend = new CalDavBackend($db, $userPrincipalBackend, $userManager, $groupManager, $random, $logger, $dispatcher); |
|
90 | - $roomCalendarRoot = new CalendarRoot($calendarRoomPrincipalBackend, $roomCalendarCaldavBackend, 'principals/calendar-rooms'); |
|
91 | - $roomCalendarRoot->disableListing = $disableListing; |
|
92 | - |
|
93 | - $publicCalendarRoot = new PublicCalendarRoot($caldavBackend, $l10n, $config); |
|
94 | - $publicCalendarRoot->disableListing = $disableListing; |
|
95 | - |
|
96 | - $systemTagCollection = new SystemTag\SystemTagsByIdCollection( |
|
97 | - \OC::$server->getSystemTagManager(), |
|
98 | - \OC::$server->getUserSession(), |
|
99 | - $groupManager |
|
100 | - ); |
|
101 | - $systemTagRelationsCollection = new SystemTag\SystemTagsRelationsCollection( |
|
102 | - \OC::$server->getSystemTagManager(), |
|
103 | - \OC::$server->getSystemTagObjectMapper(), |
|
104 | - \OC::$server->getUserSession(), |
|
105 | - $groupManager, |
|
106 | - \OC::$server->getEventDispatcher() |
|
107 | - ); |
|
108 | - $commentsCollection = new Comments\RootCollection( |
|
109 | - \OC::$server->getCommentsManager(), |
|
110 | - $userManager, |
|
111 | - \OC::$server->getUserSession(), |
|
112 | - \OC::$server->getEventDispatcher(), |
|
113 | - \OC::$server->getLogger() |
|
114 | - ); |
|
115 | - |
|
116 | - $usersCardDavBackend = new CardDavBackend($db, $userPrincipalBackend, $userManager, $groupManager, $dispatcher); |
|
117 | - $usersAddressBookRoot = new AddressBookRoot($userPrincipalBackend, $usersCardDavBackend, 'principals/users'); |
|
118 | - $usersAddressBookRoot->disableListing = $disableListing; |
|
119 | - |
|
120 | - $systemCardDavBackend = new CardDavBackend($db, $userPrincipalBackend, $userManager, $groupManager, $dispatcher); |
|
121 | - $systemAddressBookRoot = new AddressBookRoot(new SystemPrincipalBackend(), $systemCardDavBackend, 'principals/system'); |
|
122 | - $systemAddressBookRoot->disableListing = $disableListing; |
|
123 | - |
|
124 | - $uploadCollection = new Upload\RootCollection($userPrincipalBackend, 'principals/users'); |
|
125 | - $uploadCollection->disableListing = $disableListing; |
|
126 | - |
|
127 | - $avatarCollection = new Avatars\RootCollection($userPrincipalBackend, 'principals/users'); |
|
128 | - $avatarCollection->disableListing = $disableListing; |
|
129 | - |
|
130 | - $appleProvisioning = new AppleProvisioningNode(); |
|
131 | - |
|
132 | - $children = [ |
|
133 | - new SimpleCollection('principals', [ |
|
134 | - $userPrincipals, |
|
135 | - $groupPrincipals, |
|
136 | - $systemPrincipals, |
|
137 | - $calendarResourcePrincipals, |
|
138 | - $calendarRoomPrincipals]), |
|
139 | - $filesCollection, |
|
140 | - $userCalendarRoot, |
|
141 | - new SimpleCollection('system-calendars', [ |
|
142 | - $resourceCalendarRoot, |
|
143 | - $roomCalendarRoot, |
|
144 | - ]), |
|
145 | - $publicCalendarRoot, |
|
146 | - new SimpleCollection('addressbooks', [ |
|
147 | - $usersAddressBookRoot, |
|
148 | - $systemAddressBookRoot]), |
|
149 | - $systemTagCollection, |
|
150 | - $systemTagRelationsCollection, |
|
151 | - $commentsCollection, |
|
152 | - $uploadCollection, |
|
153 | - $avatarCollection, |
|
154 | - $appleProvisioning |
|
155 | - ]; |
|
156 | - |
|
157 | - parent::__construct('root', $children); |
|
158 | - } |
|
43 | + public function __construct() { |
|
44 | + $config = \OC::$server->getConfig(); |
|
45 | + $l10n = \OC::$server->getL10N('dav'); |
|
46 | + $random = \OC::$server->getSecureRandom(); |
|
47 | + $logger = \OC::$server->getLogger(); |
|
48 | + $userManager = \OC::$server->getUserManager(); |
|
49 | + $userSession = \OC::$server->getUserSession(); |
|
50 | + $groupManager = \OC::$server->getGroupManager(); |
|
51 | + $shareManager = \OC::$server->getShareManager(); |
|
52 | + $db = \OC::$server->getDatabaseConnection(); |
|
53 | + $dispatcher = \OC::$server->getEventDispatcher(); |
|
54 | + $userPrincipalBackend = new Principal( |
|
55 | + $userManager, |
|
56 | + $groupManager, |
|
57 | + $shareManager, |
|
58 | + \OC::$server->getUserSession(), |
|
59 | + $config |
|
60 | + ); |
|
61 | + $groupPrincipalBackend = new GroupPrincipalBackend($groupManager); |
|
62 | + $calendarResourcePrincipalBackend = new ResourcePrincipalBackend($db, $userSession, $groupManager, $logger); |
|
63 | + $calendarRoomPrincipalBackend = new RoomPrincipalBackend($db, $userSession, $groupManager, $logger); |
|
64 | + // as soon as debug mode is enabled we allow listing of principals |
|
65 | + $disableListing = !$config->getSystemValue('debug', false); |
|
66 | + |
|
67 | + // setup the first level of the dav tree |
|
68 | + $userPrincipals = new Collection($userPrincipalBackend, 'principals/users'); |
|
69 | + $userPrincipals->disableListing = $disableListing; |
|
70 | + $groupPrincipals = new Collection($groupPrincipalBackend, 'principals/groups'); |
|
71 | + $groupPrincipals->disableListing = $disableListing; |
|
72 | + $systemPrincipals = new Collection(new SystemPrincipalBackend(), 'principals/system'); |
|
73 | + $systemPrincipals->disableListing = $disableListing; |
|
74 | + $calendarResourcePrincipals = new Collection($calendarResourcePrincipalBackend, 'principals/calendar-resources'); |
|
75 | + $calendarResourcePrincipals->disableListing = $disableListing; |
|
76 | + $calendarRoomPrincipals = new Collection($calendarRoomPrincipalBackend, 'principals/calendar-rooms'); |
|
77 | + $calendarRoomPrincipals->disableListing = $disableListing; |
|
78 | + |
|
79 | + |
|
80 | + $filesCollection = new Files\RootCollection($userPrincipalBackend, 'principals/users'); |
|
81 | + $filesCollection->disableListing = $disableListing; |
|
82 | + $caldavBackend = new CalDavBackend($db, $userPrincipalBackend, $userManager, $groupManager, $random, $logger, $dispatcher); |
|
83 | + $userCalendarRoot = new CalendarRoot($userPrincipalBackend, $caldavBackend, 'principals/users'); |
|
84 | + $userCalendarRoot->disableListing = $disableListing; |
|
85 | + |
|
86 | + $resourceCalendarCaldavBackend = new CalDavBackend($db, $userPrincipalBackend, $userManager, $groupManager, $random, $logger, $dispatcher); |
|
87 | + $resourceCalendarRoot = new CalendarRoot($calendarResourcePrincipalBackend, $caldavBackend, 'principals/calendar-resources'); |
|
88 | + $resourceCalendarRoot->disableListing = $disableListing; |
|
89 | + $roomCalendarCaldavBackend = new CalDavBackend($db, $userPrincipalBackend, $userManager, $groupManager, $random, $logger, $dispatcher); |
|
90 | + $roomCalendarRoot = new CalendarRoot($calendarRoomPrincipalBackend, $roomCalendarCaldavBackend, 'principals/calendar-rooms'); |
|
91 | + $roomCalendarRoot->disableListing = $disableListing; |
|
92 | + |
|
93 | + $publicCalendarRoot = new PublicCalendarRoot($caldavBackend, $l10n, $config); |
|
94 | + $publicCalendarRoot->disableListing = $disableListing; |
|
95 | + |
|
96 | + $systemTagCollection = new SystemTag\SystemTagsByIdCollection( |
|
97 | + \OC::$server->getSystemTagManager(), |
|
98 | + \OC::$server->getUserSession(), |
|
99 | + $groupManager |
|
100 | + ); |
|
101 | + $systemTagRelationsCollection = new SystemTag\SystemTagsRelationsCollection( |
|
102 | + \OC::$server->getSystemTagManager(), |
|
103 | + \OC::$server->getSystemTagObjectMapper(), |
|
104 | + \OC::$server->getUserSession(), |
|
105 | + $groupManager, |
|
106 | + \OC::$server->getEventDispatcher() |
|
107 | + ); |
|
108 | + $commentsCollection = new Comments\RootCollection( |
|
109 | + \OC::$server->getCommentsManager(), |
|
110 | + $userManager, |
|
111 | + \OC::$server->getUserSession(), |
|
112 | + \OC::$server->getEventDispatcher(), |
|
113 | + \OC::$server->getLogger() |
|
114 | + ); |
|
115 | + |
|
116 | + $usersCardDavBackend = new CardDavBackend($db, $userPrincipalBackend, $userManager, $groupManager, $dispatcher); |
|
117 | + $usersAddressBookRoot = new AddressBookRoot($userPrincipalBackend, $usersCardDavBackend, 'principals/users'); |
|
118 | + $usersAddressBookRoot->disableListing = $disableListing; |
|
119 | + |
|
120 | + $systemCardDavBackend = new CardDavBackend($db, $userPrincipalBackend, $userManager, $groupManager, $dispatcher); |
|
121 | + $systemAddressBookRoot = new AddressBookRoot(new SystemPrincipalBackend(), $systemCardDavBackend, 'principals/system'); |
|
122 | + $systemAddressBookRoot->disableListing = $disableListing; |
|
123 | + |
|
124 | + $uploadCollection = new Upload\RootCollection($userPrincipalBackend, 'principals/users'); |
|
125 | + $uploadCollection->disableListing = $disableListing; |
|
126 | + |
|
127 | + $avatarCollection = new Avatars\RootCollection($userPrincipalBackend, 'principals/users'); |
|
128 | + $avatarCollection->disableListing = $disableListing; |
|
129 | + |
|
130 | + $appleProvisioning = new AppleProvisioningNode(); |
|
131 | + |
|
132 | + $children = [ |
|
133 | + new SimpleCollection('principals', [ |
|
134 | + $userPrincipals, |
|
135 | + $groupPrincipals, |
|
136 | + $systemPrincipals, |
|
137 | + $calendarResourcePrincipals, |
|
138 | + $calendarRoomPrincipals]), |
|
139 | + $filesCollection, |
|
140 | + $userCalendarRoot, |
|
141 | + new SimpleCollection('system-calendars', [ |
|
142 | + $resourceCalendarRoot, |
|
143 | + $roomCalendarRoot, |
|
144 | + ]), |
|
145 | + $publicCalendarRoot, |
|
146 | + new SimpleCollection('addressbooks', [ |
|
147 | + $usersAddressBookRoot, |
|
148 | + $systemAddressBookRoot]), |
|
149 | + $systemTagCollection, |
|
150 | + $systemTagRelationsCollection, |
|
151 | + $commentsCollection, |
|
152 | + $uploadCollection, |
|
153 | + $avatarCollection, |
|
154 | + $appleProvisioning |
|
155 | + ]; |
|
156 | + |
|
157 | + parent::__construct('root', $children); |
|
158 | + } |
|
159 | 159 | |
160 | 160 | } |