1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- <?php
- /**
- * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors
- * SPDX-License-Identifier: AGPL-3.0-or-later
- */
- namespace OCA\DAV\Provisioning\Apple;
- use OCP\AppFramework\Utility\ITimeFactory;
- use Sabre\DAV\Exception\Forbidden;
- use Sabre\DAV\INode;
- use Sabre\DAV\IProperties;
- use Sabre\DAV\PropPatch;
- class AppleProvisioningNode implements INode, IProperties {
- public const FILENAME = 'apple-provisioning.mobileconfig';
- /**
- * @param ITimeFactory $timeFactory
- */
- public function __construct(
- protected ITimeFactory $timeFactory,
- ) {
- }
- /**
- * @return string
- */
- public function getName() {
- return self::FILENAME;
- }
- public function setName($name) {
- throw new Forbidden('Renaming ' . self::FILENAME . ' is forbidden');
- }
- /**
- * @return null
- */
- public function getLastModified() {
- return null;
- }
- /**
- * @throws Forbidden
- */
- public function delete() {
- throw new Forbidden(self::FILENAME . ' may not be deleted.');
- }
- /**
- * @param array $properties
- * @return array
- */
- public function getProperties($properties) {
- $datetime = $this->timeFactory->getDateTime();
- return [
- '{DAV:}getcontentlength' => 42,
- '{DAV:}getlastmodified' => $datetime->format(\DateTimeInterface::RFC2822),
- ];
- }
- /**
- * @param PropPatch $propPatch
- * @throws Forbidden
- */
- public function propPatch(PropPatch $propPatch) {
- throw new Forbidden(self::FILENAME . '\'s properties may not be altered.');
- }
- }
|