@@ -35,79 +35,79 @@ |
||
35 | 35 | use Sabre\DAV\ServerPlugin; |
36 | 36 | |
37 | 37 | class PropfindPlugin extends ServerPlugin { |
38 | - public const TRASHBIN_FILENAME = '{http://nextcloud.org/ns}trashbin-filename'; |
|
39 | - public const TRASHBIN_ORIGINAL_LOCATION = '{http://nextcloud.org/ns}trashbin-original-location'; |
|
40 | - public const TRASHBIN_DELETION_TIME = '{http://nextcloud.org/ns}trashbin-deletion-time'; |
|
41 | - public const TRASHBIN_TITLE = '{http://nextcloud.org/ns}trashbin-title'; |
|
38 | + public const TRASHBIN_FILENAME = '{http://nextcloud.org/ns}trashbin-filename'; |
|
39 | + public const TRASHBIN_ORIGINAL_LOCATION = '{http://nextcloud.org/ns}trashbin-original-location'; |
|
40 | + public const TRASHBIN_DELETION_TIME = '{http://nextcloud.org/ns}trashbin-deletion-time'; |
|
41 | + public const TRASHBIN_TITLE = '{http://nextcloud.org/ns}trashbin-title'; |
|
42 | 42 | |
43 | - /** @var Server */ |
|
44 | - private $server; |
|
43 | + /** @var Server */ |
|
44 | + private $server; |
|
45 | 45 | |
46 | - /** @var IPreview */ |
|
47 | - private $previewManager; |
|
46 | + /** @var IPreview */ |
|
47 | + private $previewManager; |
|
48 | 48 | |
49 | - public function __construct( |
|
50 | - IPreview $previewManager |
|
51 | - ) { |
|
52 | - $this->previewManager = $previewManager; |
|
53 | - } |
|
49 | + public function __construct( |
|
50 | + IPreview $previewManager |
|
51 | + ) { |
|
52 | + $this->previewManager = $previewManager; |
|
53 | + } |
|
54 | 54 | |
55 | - public function initialize(Server $server) { |
|
56 | - $this->server = $server; |
|
55 | + public function initialize(Server $server) { |
|
56 | + $this->server = $server; |
|
57 | 57 | |
58 | - $this->server->on('propFind', [$this, 'propFind']); |
|
59 | - } |
|
58 | + $this->server->on('propFind', [$this, 'propFind']); |
|
59 | + } |
|
60 | 60 | |
61 | 61 | |
62 | - public function propFind(PropFind $propFind, INode $node) { |
|
63 | - if (!($node instanceof ITrash)) { |
|
64 | - return; |
|
65 | - } |
|
62 | + public function propFind(PropFind $propFind, INode $node) { |
|
63 | + if (!($node instanceof ITrash)) { |
|
64 | + return; |
|
65 | + } |
|
66 | 66 | |
67 | - $propFind->handle(self::TRASHBIN_FILENAME, function () use ($node) { |
|
68 | - return $node->getFilename(); |
|
69 | - }); |
|
67 | + $propFind->handle(self::TRASHBIN_FILENAME, function () use ($node) { |
|
68 | + return $node->getFilename(); |
|
69 | + }); |
|
70 | 70 | |
71 | - $propFind->handle(self::TRASHBIN_ORIGINAL_LOCATION, function () use ($node) { |
|
72 | - return $node->getOriginalLocation(); |
|
73 | - }); |
|
71 | + $propFind->handle(self::TRASHBIN_ORIGINAL_LOCATION, function () use ($node) { |
|
72 | + return $node->getOriginalLocation(); |
|
73 | + }); |
|
74 | 74 | |
75 | - $propFind->handle(self::TRASHBIN_TITLE, function () use ($node) { |
|
76 | - return $node->getTitle(); |
|
77 | - }); |
|
75 | + $propFind->handle(self::TRASHBIN_TITLE, function () use ($node) { |
|
76 | + return $node->getTitle(); |
|
77 | + }); |
|
78 | 78 | |
79 | - $propFind->handle(self::TRASHBIN_DELETION_TIME, function () use ($node) { |
|
80 | - return $node->getDeletionTime(); |
|
81 | - }); |
|
79 | + $propFind->handle(self::TRASHBIN_DELETION_TIME, function () use ($node) { |
|
80 | + return $node->getDeletionTime(); |
|
81 | + }); |
|
82 | 82 | |
83 | - $propFind->handle(FilesPlugin::SIZE_PROPERTYNAME, function () use ($node) { |
|
84 | - return $node->getSize(); |
|
85 | - }); |
|
83 | + $propFind->handle(FilesPlugin::SIZE_PROPERTYNAME, function () use ($node) { |
|
84 | + return $node->getSize(); |
|
85 | + }); |
|
86 | 86 | |
87 | - $propFind->handle(FilesPlugin::FILEID_PROPERTYNAME, function () use ($node) { |
|
88 | - return $node->getFileId(); |
|
89 | - }); |
|
87 | + $propFind->handle(FilesPlugin::FILEID_PROPERTYNAME, function () use ($node) { |
|
88 | + return $node->getFileId(); |
|
89 | + }); |
|
90 | 90 | |
91 | - $propFind->handle(FilesPlugin::PERMISSIONS_PROPERTYNAME, function () { |
|
92 | - return 'GD'; // read + delete |
|
93 | - }); |
|
91 | + $propFind->handle(FilesPlugin::PERMISSIONS_PROPERTYNAME, function () { |
|
92 | + return 'GD'; // read + delete |
|
93 | + }); |
|
94 | 94 | |
95 | - $propFind->handle(FilesPlugin::GETETAG_PROPERTYNAME, function () use ($node) { |
|
96 | - // add fake etag, it is only needed to identify the preview image |
|
97 | - return $node->getLastModified(); |
|
98 | - }); |
|
95 | + $propFind->handle(FilesPlugin::GETETAG_PROPERTYNAME, function () use ($node) { |
|
96 | + // add fake etag, it is only needed to identify the preview image |
|
97 | + return $node->getLastModified(); |
|
98 | + }); |
|
99 | 99 | |
100 | - $propFind->handle(FilesPlugin::INTERNAL_FILEID_PROPERTYNAME, function () use ($node) { |
|
101 | - // add fake etag, it is only needed to identify the preview image |
|
102 | - return $node->getFileId(); |
|
103 | - }); |
|
100 | + $propFind->handle(FilesPlugin::INTERNAL_FILEID_PROPERTYNAME, function () use ($node) { |
|
101 | + // add fake etag, it is only needed to identify the preview image |
|
102 | + return $node->getFileId(); |
|
103 | + }); |
|
104 | 104 | |
105 | - $propFind->handle(FilesPlugin::HAS_PREVIEW_PROPERTYNAME, function () use ($node) { |
|
106 | - return $this->previewManager->isAvailable($node->getFileInfo()); |
|
107 | - }); |
|
105 | + $propFind->handle(FilesPlugin::HAS_PREVIEW_PROPERTYNAME, function () use ($node) { |
|
106 | + return $this->previewManager->isAvailable($node->getFileInfo()); |
|
107 | + }); |
|
108 | 108 | |
109 | - $propFind->handle(FilesPlugin::MOUNT_TYPE_PROPERTYNAME, function () { |
|
110 | - return ''; |
|
111 | - }); |
|
112 | - } |
|
109 | + $propFind->handle(FilesPlugin::MOUNT_TYPE_PROPERTYNAME, function () { |
|
110 | + return ''; |
|
111 | + }); |
|
112 | + } |
|
113 | 113 | } |
@@ -30,11 +30,11 @@ |
||
30 | 30 | use Sabre\DAV\IFile; |
31 | 31 | |
32 | 32 | abstract class AbstractTrashFile extends AbstractTrash implements IFile, ITrash { |
33 | - public function put($data) { |
|
34 | - throw new Forbidden(); |
|
35 | - } |
|
33 | + public function put($data) { |
|
34 | + throw new Forbidden(); |
|
35 | + } |
|
36 | 36 | |
37 | - public function setName($name) { |
|
38 | - throw new Forbidden(); |
|
39 | - } |
|
37 | + public function setName($name) { |
|
38 | + throw new Forbidden(); |
|
39 | + } |
|
40 | 40 | } |
@@ -40,115 +40,115 @@ |
||
40 | 40 | */ |
41 | 41 | class ExternalSharesController extends Controller { |
42 | 42 | |
43 | - /** @var \OCA\Files_Sharing\External\Manager */ |
|
44 | - private $externalManager; |
|
45 | - /** @var IClientService */ |
|
46 | - private $clientService; |
|
43 | + /** @var \OCA\Files_Sharing\External\Manager */ |
|
44 | + private $externalManager; |
|
45 | + /** @var IClientService */ |
|
46 | + private $clientService; |
|
47 | 47 | |
48 | - /** |
|
49 | - * @param string $appName |
|
50 | - * @param IRequest $request |
|
51 | - * @param \OCA\Files_Sharing\External\Manager $externalManager |
|
52 | - * @param IClientService $clientService |
|
53 | - */ |
|
54 | - public function __construct($appName, |
|
55 | - IRequest $request, |
|
56 | - \OCA\Files_Sharing\External\Manager $externalManager, |
|
57 | - IClientService $clientService) { |
|
58 | - parent::__construct($appName, $request); |
|
59 | - $this->externalManager = $externalManager; |
|
60 | - $this->clientService = $clientService; |
|
61 | - } |
|
48 | + /** |
|
49 | + * @param string $appName |
|
50 | + * @param IRequest $request |
|
51 | + * @param \OCA\Files_Sharing\External\Manager $externalManager |
|
52 | + * @param IClientService $clientService |
|
53 | + */ |
|
54 | + public function __construct($appName, |
|
55 | + IRequest $request, |
|
56 | + \OCA\Files_Sharing\External\Manager $externalManager, |
|
57 | + IClientService $clientService) { |
|
58 | + parent::__construct($appName, $request); |
|
59 | + $this->externalManager = $externalManager; |
|
60 | + $this->clientService = $clientService; |
|
61 | + } |
|
62 | 62 | |
63 | - /** |
|
64 | - * @NoAdminRequired |
|
65 | - * @NoOutgoingFederatedSharingRequired |
|
66 | - * |
|
67 | - * @return JSONResponse |
|
68 | - */ |
|
69 | - public function index() { |
|
70 | - return new JSONResponse($this->externalManager->getOpenShares()); |
|
71 | - } |
|
63 | + /** |
|
64 | + * @NoAdminRequired |
|
65 | + * @NoOutgoingFederatedSharingRequired |
|
66 | + * |
|
67 | + * @return JSONResponse |
|
68 | + */ |
|
69 | + public function index() { |
|
70 | + return new JSONResponse($this->externalManager->getOpenShares()); |
|
71 | + } |
|
72 | 72 | |
73 | - /** |
|
74 | - * @NoAdminRequired |
|
75 | - * @NoOutgoingFederatedSharingRequired |
|
76 | - * |
|
77 | - * @param int $id |
|
78 | - * @return JSONResponse |
|
79 | - */ |
|
80 | - public function create($id) { |
|
81 | - $this->externalManager->acceptShare($id); |
|
82 | - return new JSONResponse(); |
|
83 | - } |
|
73 | + /** |
|
74 | + * @NoAdminRequired |
|
75 | + * @NoOutgoingFederatedSharingRequired |
|
76 | + * |
|
77 | + * @param int $id |
|
78 | + * @return JSONResponse |
|
79 | + */ |
|
80 | + public function create($id) { |
|
81 | + $this->externalManager->acceptShare($id); |
|
82 | + return new JSONResponse(); |
|
83 | + } |
|
84 | 84 | |
85 | - /** |
|
86 | - * @NoAdminRequired |
|
87 | - * @NoOutgoingFederatedSharingRequired |
|
88 | - * |
|
89 | - * @param integer $id |
|
90 | - * @return JSONResponse |
|
91 | - */ |
|
92 | - public function destroy($id) { |
|
93 | - $this->externalManager->declineShare($id); |
|
94 | - return new JSONResponse(); |
|
95 | - } |
|
85 | + /** |
|
86 | + * @NoAdminRequired |
|
87 | + * @NoOutgoingFederatedSharingRequired |
|
88 | + * |
|
89 | + * @param integer $id |
|
90 | + * @return JSONResponse |
|
91 | + */ |
|
92 | + public function destroy($id) { |
|
93 | + $this->externalManager->declineShare($id); |
|
94 | + return new JSONResponse(); |
|
95 | + } |
|
96 | 96 | |
97 | - /** |
|
98 | - * Test whether the specified remote is accessible |
|
99 | - * |
|
100 | - * @param string $remote |
|
101 | - * @param bool $checkVersion |
|
102 | - * @return bool |
|
103 | - */ |
|
104 | - protected function testUrl($remote, $checkVersion = false) { |
|
105 | - try { |
|
106 | - $client = $this->clientService->newClient(); |
|
107 | - $response = json_decode($client->get( |
|
108 | - $remote, |
|
109 | - [ |
|
110 | - 'timeout' => 3, |
|
111 | - 'connect_timeout' => 3, |
|
112 | - ] |
|
113 | - )->getBody()); |
|
97 | + /** |
|
98 | + * Test whether the specified remote is accessible |
|
99 | + * |
|
100 | + * @param string $remote |
|
101 | + * @param bool $checkVersion |
|
102 | + * @return bool |
|
103 | + */ |
|
104 | + protected function testUrl($remote, $checkVersion = false) { |
|
105 | + try { |
|
106 | + $client = $this->clientService->newClient(); |
|
107 | + $response = json_decode($client->get( |
|
108 | + $remote, |
|
109 | + [ |
|
110 | + 'timeout' => 3, |
|
111 | + 'connect_timeout' => 3, |
|
112 | + ] |
|
113 | + )->getBody()); |
|
114 | 114 | |
115 | - if ($checkVersion) { |
|
116 | - return !empty($response->version) && version_compare($response->version, '7.0.0', '>='); |
|
117 | - } else { |
|
118 | - return is_object($response); |
|
119 | - } |
|
120 | - } catch (\Exception $e) { |
|
121 | - return false; |
|
122 | - } |
|
123 | - } |
|
115 | + if ($checkVersion) { |
|
116 | + return !empty($response->version) && version_compare($response->version, '7.0.0', '>='); |
|
117 | + } else { |
|
118 | + return is_object($response); |
|
119 | + } |
|
120 | + } catch (\Exception $e) { |
|
121 | + return false; |
|
122 | + } |
|
123 | + } |
|
124 | 124 | |
125 | - /** |
|
126 | - * @PublicPage |
|
127 | - * @NoOutgoingFederatedSharingRequired |
|
128 | - * @NoIncomingFederatedSharingRequired |
|
129 | - * |
|
130 | - * @param string $remote |
|
131 | - * @return DataResponse |
|
132 | - */ |
|
133 | - public function testRemote($remote) { |
|
134 | - if (strpos($remote, '#') !== false || strpos($remote, '?') !== false || strpos($remote, ';') !== false) { |
|
135 | - return new DataResponse(false); |
|
136 | - } |
|
125 | + /** |
|
126 | + * @PublicPage |
|
127 | + * @NoOutgoingFederatedSharingRequired |
|
128 | + * @NoIncomingFederatedSharingRequired |
|
129 | + * |
|
130 | + * @param string $remote |
|
131 | + * @return DataResponse |
|
132 | + */ |
|
133 | + public function testRemote($remote) { |
|
134 | + if (strpos($remote, '#') !== false || strpos($remote, '?') !== false || strpos($remote, ';') !== false) { |
|
135 | + return new DataResponse(false); |
|
136 | + } |
|
137 | 137 | |
138 | - if ( |
|
139 | - $this->testUrl('https://' . $remote . '/ocs-provider/') || |
|
140 | - $this->testUrl('https://' . $remote . '/ocs-provider/index.php') || |
|
141 | - $this->testUrl('https://' . $remote . '/status.php', true) |
|
142 | - ) { |
|
143 | - return new DataResponse('https'); |
|
144 | - } elseif ( |
|
145 | - $this->testUrl('http://' . $remote . '/ocs-provider/') || |
|
146 | - $this->testUrl('http://' . $remote . '/ocs-provider/index.php') || |
|
147 | - $this->testUrl('http://' . $remote . '/status.php', true) |
|
148 | - ) { |
|
149 | - return new DataResponse('http'); |
|
150 | - } else { |
|
151 | - return new DataResponse(false); |
|
152 | - } |
|
153 | - } |
|
138 | + if ( |
|
139 | + $this->testUrl('https://' . $remote . '/ocs-provider/') || |
|
140 | + $this->testUrl('https://' . $remote . '/ocs-provider/index.php') || |
|
141 | + $this->testUrl('https://' . $remote . '/status.php', true) |
|
142 | + ) { |
|
143 | + return new DataResponse('https'); |
|
144 | + } elseif ( |
|
145 | + $this->testUrl('http://' . $remote . '/ocs-provider/') || |
|
146 | + $this->testUrl('http://' . $remote . '/ocs-provider/index.php') || |
|
147 | + $this->testUrl('http://' . $remote . '/status.php', true) |
|
148 | + ) { |
|
149 | + return new DataResponse('http'); |
|
150 | + } else { |
|
151 | + return new DataResponse(false); |
|
152 | + } |
|
153 | + } |
|
154 | 154 | } |
@@ -33,29 +33,29 @@ |
||
33 | 33 | use OCP\IL10N; |
34 | 34 | |
35 | 35 | class Swift extends Backend { |
36 | - use LegacyDependencyCheckPolyfill; |
|
36 | + use LegacyDependencyCheckPolyfill; |
|
37 | 37 | |
38 | - public function __construct(IL10N $l, OpenStackV2 $openstackAuth, Rackspace $rackspaceAuth) { |
|
39 | - $this |
|
40 | - ->setIdentifier('swift') |
|
41 | - ->addIdentifierAlias('\OC\Files\Storage\Swift') // legacy compat |
|
42 | - ->setStorageClass('\OCA\Files_External\Lib\Storage\Swift') |
|
43 | - ->setText($l->t('OpenStack Object Storage')) |
|
44 | - ->addParameters([ |
|
45 | - (new DefinitionParameter('service_name', $l->t('Service name'))) |
|
46 | - ->setFlag(DefinitionParameter::FLAG_OPTIONAL), |
|
47 | - new DefinitionParameter('region', $l->t('Region')), |
|
48 | - new DefinitionParameter('bucket', $l->t('Bucket')), |
|
49 | - (new DefinitionParameter('timeout', $l->t('Request timeout (seconds)'))) |
|
50 | - ->setFlag(DefinitionParameter::FLAG_OPTIONAL), |
|
51 | - ]) |
|
52 | - ->addAuthScheme(AuthMechanism::SCHEME_OPENSTACK) |
|
53 | - ->setLegacyAuthMechanismCallback(function (array $params) use ($openstackAuth, $rackspaceAuth) { |
|
54 | - if (isset($params['options']['key']) && $params['options']['key']) { |
|
55 | - return $rackspaceAuth; |
|
56 | - } |
|
57 | - return $openstackAuth; |
|
58 | - }) |
|
59 | - ; |
|
60 | - } |
|
38 | + public function __construct(IL10N $l, OpenStackV2 $openstackAuth, Rackspace $rackspaceAuth) { |
|
39 | + $this |
|
40 | + ->setIdentifier('swift') |
|
41 | + ->addIdentifierAlias('\OC\Files\Storage\Swift') // legacy compat |
|
42 | + ->setStorageClass('\OCA\Files_External\Lib\Storage\Swift') |
|
43 | + ->setText($l->t('OpenStack Object Storage')) |
|
44 | + ->addParameters([ |
|
45 | + (new DefinitionParameter('service_name', $l->t('Service name'))) |
|
46 | + ->setFlag(DefinitionParameter::FLAG_OPTIONAL), |
|
47 | + new DefinitionParameter('region', $l->t('Region')), |
|
48 | + new DefinitionParameter('bucket', $l->t('Bucket')), |
|
49 | + (new DefinitionParameter('timeout', $l->t('Request timeout (seconds)'))) |
|
50 | + ->setFlag(DefinitionParameter::FLAG_OPTIONAL), |
|
51 | + ]) |
|
52 | + ->addAuthScheme(AuthMechanism::SCHEME_OPENSTACK) |
|
53 | + ->setLegacyAuthMechanismCallback(function (array $params) use ($openstackAuth, $rackspaceAuth) { |
|
54 | + if (isset($params['options']['key']) && $params['options']['key']) { |
|
55 | + return $rackspaceAuth; |
|
56 | + } |
|
57 | + return $openstackAuth; |
|
58 | + }) |
|
59 | + ; |
|
60 | + } |
|
61 | 61 | } |
@@ -36,19 +36,19 @@ |
||
36 | 36 | * OpenStack Keystone authentication |
37 | 37 | */ |
38 | 38 | class OpenStackV3 extends AuthMechanism { |
39 | - public function __construct(IL10N $l) { |
|
40 | - $this |
|
41 | - ->setIdentifier('openstack::openstackv3') |
|
42 | - ->setScheme(self::SCHEME_OPENSTACK) |
|
43 | - ->setText($l->t('OpenStack v3')) |
|
44 | - ->addParameters([ |
|
45 | - new DefinitionParameter('user', $l->t('Username')), |
|
46 | - new DefinitionParameter('domain', $l->t('Domain')), |
|
47 | - (new DefinitionParameter('password', $l->t('Password'))) |
|
48 | - ->setType(DefinitionParameter::VALUE_PASSWORD), |
|
49 | - new DefinitionParameter('tenant', $l->t('Tenant name')), |
|
50 | - new DefinitionParameter('url', $l->t('Identity endpoint URL')) |
|
51 | - ]) |
|
52 | - ; |
|
53 | - } |
|
39 | + public function __construct(IL10N $l) { |
|
40 | + $this |
|
41 | + ->setIdentifier('openstack::openstackv3') |
|
42 | + ->setScheme(self::SCHEME_OPENSTACK) |
|
43 | + ->setText($l->t('OpenStack v3')) |
|
44 | + ->addParameters([ |
|
45 | + new DefinitionParameter('user', $l->t('Username')), |
|
46 | + new DefinitionParameter('domain', $l->t('Domain')), |
|
47 | + (new DefinitionParameter('password', $l->t('Password'))) |
|
48 | + ->setType(DefinitionParameter::VALUE_PASSWORD), |
|
49 | + new DefinitionParameter('tenant', $l->t('Tenant name')), |
|
50 | + new DefinitionParameter('url', $l->t('Identity endpoint URL')) |
|
51 | + ]) |
|
52 | + ; |
|
53 | + } |
|
54 | 54 | } |
@@ -30,19 +30,19 @@ |
||
30 | 30 | /** @var Application $application */ |
31 | 31 | $application = \OC::$server->query(Application::class); |
32 | 32 | $application->registerRoutes($this, [ |
33 | - 'routes' => [ |
|
34 | - [ |
|
35 | - 'name' => 'Preview#getPreview', |
|
36 | - 'url' => '/preview', |
|
37 | - 'verb' => 'GET', |
|
38 | - ], |
|
39 | - ], |
|
33 | + 'routes' => [ |
|
34 | + [ |
|
35 | + 'name' => 'Preview#getPreview', |
|
36 | + 'url' => '/preview', |
|
37 | + 'verb' => 'GET', |
|
38 | + ], |
|
39 | + ], |
|
40 | 40 | ]); |
41 | 41 | |
42 | 42 | /** @var $this \OCP\Route\IRouter */ |
43 | 43 | $this->create('files_versions_download', 'apps/files_versions/download.php') |
44 | - ->actionInclude('files_versions/download.php'); |
|
44 | + ->actionInclude('files_versions/download.php'); |
|
45 | 45 | $this->create('files_versions_ajax_getVersions', 'apps/files_versions/ajax/getVersions.php') |
46 | - ->actionInclude('files_versions/ajax/getVersions.php'); |
|
46 | + ->actionInclude('files_versions/ajax/getVersions.php'); |
|
47 | 47 | $this->create('files_versions_ajax_rollbackVersion', 'apps/files_versions/ajax/rollbackVersion.php') |
48 | - ->actionInclude('files_versions/ajax/rollbackVersion.php'); |
|
48 | + ->actionInclude('files_versions/ajax/rollbackVersion.php'); |
@@ -29,12 +29,12 @@ |
||
29 | 29 | $isEnabled = $server->getAppManager()->isEnabledForUser('cloud_federation_api'); |
30 | 30 | |
31 | 31 | if ($isEnabled) { |
32 | - // Make sure the routes are loaded |
|
33 | - \OC_App::loadApp('cloud_federation_api'); |
|
34 | - $capabilities = new OCA\CloudFederationAPI\Capabilities($server->getURLGenerator()); |
|
35 | - header('Content-Type: application/json'); |
|
36 | - echo json_encode($capabilities->getCapabilities()['ocm']); |
|
32 | + // Make sure the routes are loaded |
|
33 | + \OC_App::loadApp('cloud_federation_api'); |
|
34 | + $capabilities = new OCA\CloudFederationAPI\Capabilities($server->getURLGenerator()); |
|
35 | + header('Content-Type: application/json'); |
|
36 | + echo json_encode($capabilities->getCapabilities()['ocm']); |
|
37 | 37 | } else { |
38 | - header($_SERVER["SERVER_PROTOCOL"]." 501 Not Implemented", true, 501); |
|
39 | - exit("501 Not Implemented"); |
|
38 | + header($_SERVER["SERVER_PROTOCOL"]." 501 Not Implemented", true, 501); |
|
39 | + exit("501 Not Implemented"); |
|
40 | 40 | } |
@@ -29,12 +29,12 @@ |
||
29 | 29 | */ |
30 | 30 | class GroupMapping extends AbstractMapping { |
31 | 31 | |
32 | - /** |
|
33 | - * returns the DB table name which holds the mappings |
|
34 | - * @return string |
|
35 | - */ |
|
36 | - protected function getTableName(bool $includePrefix = true) { |
|
37 | - $p = $includePrefix ? '*PREFIX*' : ''; |
|
38 | - return $p . 'ldap_group_mapping'; |
|
39 | - } |
|
32 | + /** |
|
33 | + * returns the DB table name which holds the mappings |
|
34 | + * @return string |
|
35 | + */ |
|
36 | + protected function getTableName(bool $includePrefix = true) { |
|
37 | + $p = $includePrefix ? '*PREFIX*' : ''; |
|
38 | + return $p . 'ldap_group_mapping'; |
|
39 | + } |
|
40 | 40 | } |
@@ -30,68 +30,68 @@ |
||
30 | 30 | |
31 | 31 | class UploadFolder implements ICollection { |
32 | 32 | |
33 | - /** @var Directory */ |
|
34 | - private $node; |
|
35 | - /** @var CleanupService */ |
|
36 | - private $cleanupService; |
|
37 | - |
|
38 | - public function __construct(Directory $node, CleanupService $cleanupService) { |
|
39 | - $this->node = $node; |
|
40 | - $this->cleanupService = $cleanupService; |
|
41 | - } |
|
42 | - |
|
43 | - public function createFile($name, $data = null) { |
|
44 | - // TODO: verify name - should be a simple number |
|
45 | - $this->node->createFile($name, $data); |
|
46 | - } |
|
47 | - |
|
48 | - public function createDirectory($name) { |
|
49 | - throw new Forbidden('Permission denied to create file (filename ' . $name . ')'); |
|
50 | - } |
|
51 | - |
|
52 | - public function getChild($name) { |
|
53 | - if ($name === '.file') { |
|
54 | - return new FutureFile($this->node, '.file'); |
|
55 | - } |
|
56 | - return new UploadFile($this->node->getChild($name)); |
|
57 | - } |
|
58 | - |
|
59 | - public function getChildren() { |
|
60 | - $tmpChildren = $this->node->getChildren(); |
|
61 | - |
|
62 | - $children = []; |
|
63 | - $children[] = new FutureFile($this->node, '.file'); |
|
64 | - |
|
65 | - foreach ($tmpChildren as $child) { |
|
66 | - $children[] = new UploadFile($child); |
|
67 | - } |
|
68 | - |
|
69 | - return $children; |
|
70 | - } |
|
71 | - |
|
72 | - public function childExists($name) { |
|
73 | - if ($name === '.file') { |
|
74 | - return true; |
|
75 | - } |
|
76 | - return $this->node->childExists($name); |
|
77 | - } |
|
78 | - |
|
79 | - public function delete() { |
|
80 | - $this->node->delete(); |
|
81 | - |
|
82 | - // Background cleanup job is not needed anymore |
|
83 | - $this->cleanupService->removeJob($this->getName()); |
|
84 | - } |
|
85 | - |
|
86 | - public function getName() { |
|
87 | - return $this->node->getName(); |
|
88 | - } |
|
89 | - |
|
90 | - public function setName($name) { |
|
91 | - throw new Forbidden('Permission denied to rename this folder'); |
|
92 | - } |
|
93 | - |
|
94 | - public function getLastModified() { |
|
95 | - return $this->node->getLastModified(); |
|
96 | - } |
|
33 | + /** @var Directory */ |
|
34 | + private $node; |
|
35 | + /** @var CleanupService */ |
|
36 | + private $cleanupService; |
|
37 | + |
|
38 | + public function __construct(Directory $node, CleanupService $cleanupService) { |
|
39 | + $this->node = $node; |
|
40 | + $this->cleanupService = $cleanupService; |
|
41 | + } |
|
42 | + |
|
43 | + public function createFile($name, $data = null) { |
|
44 | + // TODO: verify name - should be a simple number |
|
45 | + $this->node->createFile($name, $data); |
|
46 | + } |
|
47 | + |
|
48 | + public function createDirectory($name) { |
|
49 | + throw new Forbidden('Permission denied to create file (filename ' . $name . ')'); |
|
50 | + } |
|
51 | + |
|
52 | + public function getChild($name) { |
|
53 | + if ($name === '.file') { |
|
54 | + return new FutureFile($this->node, '.file'); |
|
55 | + } |
|
56 | + return new UploadFile($this->node->getChild($name)); |
|
57 | + } |
|
58 | + |
|
59 | + public function getChildren() { |
|
60 | + $tmpChildren = $this->node->getChildren(); |
|
61 | + |
|
62 | + $children = []; |
|
63 | + $children[] = new FutureFile($this->node, '.file'); |
|
64 | + |
|
65 | + foreach ($tmpChildren as $child) { |
|
66 | + $children[] = new UploadFile($child); |
|
67 | + } |
|
68 | + |
|
69 | + return $children; |
|
70 | + } |
|
71 | + |
|
72 | + public function childExists($name) { |
|
73 | + if ($name === '.file') { |
|
74 | + return true; |
|
75 | + } |
|
76 | + return $this->node->childExists($name); |
|
77 | + } |
|
78 | + |
|
79 | + public function delete() { |
|
80 | + $this->node->delete(); |
|
81 | + |
|
82 | + // Background cleanup job is not needed anymore |
|
83 | + $this->cleanupService->removeJob($this->getName()); |
|
84 | + } |
|
85 | + |
|
86 | + public function getName() { |
|
87 | + return $this->node->getName(); |
|
88 | + } |
|
89 | + |
|
90 | + public function setName($name) { |
|
91 | + throw new Forbidden('Permission denied to rename this folder'); |
|
92 | + } |
|
93 | + |
|
94 | + public function getLastModified() { |
|
95 | + return $this->node->getLastModified(); |
|
96 | + } |
|
97 | 97 | } |