@@ -23,50 +23,50 @@ |
||
| 23 | 23 | $application = new \OCA\Federation\AppInfo\Application(); |
| 24 | 24 | |
| 25 | 25 | $application->registerRoutes( |
| 26 | - $this, |
|
| 27 | - [ |
|
| 28 | - 'routes' => [ |
|
| 29 | - [ |
|
| 30 | - 'name' => 'Settings#addServer', |
|
| 31 | - 'url' => '/trusted-servers', |
|
| 32 | - 'verb' => 'POST' |
|
| 33 | - ], |
|
| 34 | - [ |
|
| 35 | - 'name' => 'Settings#removeServer', |
|
| 36 | - 'url' => '/trusted-servers/{id}', |
|
| 37 | - 'verb' => 'DELETE' |
|
| 38 | - ], |
|
| 39 | - [ |
|
| 40 | - 'name' => 'Settings#autoAddServers', |
|
| 41 | - 'url' => '/auto-add-servers', |
|
| 42 | - 'verb' => 'POST' |
|
| 43 | - ], |
|
| 44 | - ], |
|
| 45 | - 'ocs' => [ |
|
| 46 | - // old endpoints, only used by Nextcloud and ownCloud |
|
| 47 | - [ |
|
| 48 | - 'name' => 'OCSAuthAPI#getSharedSecret', |
|
| 49 | - 'url' => '/api/v1/shared-secret', |
|
| 50 | - 'verb' => 'GET', |
|
| 51 | - ], |
|
| 52 | - [ |
|
| 53 | - 'name' => 'OCSAuthAPI#requestSharedSecret', |
|
| 54 | - 'url' => '/api/v1/request-shared-secret', |
|
| 55 | - 'verb' => 'POST', |
|
| 56 | - ], |
|
| 57 | - // new endpoints, published as public api |
|
| 58 | - [ |
|
| 59 | - 'name' => 'OCSAuthAPI#getSharedSecret', |
|
| 60 | - 'root' => '/cloud', |
|
| 61 | - 'url' => '/shared-secret', |
|
| 62 | - 'verb' => 'GET', |
|
| 63 | - ], |
|
| 64 | - [ |
|
| 65 | - 'name' => 'OCSAuthAPI#requestSharedSecret', |
|
| 66 | - 'root' => '/cloud', |
|
| 67 | - 'url' => '/shared-secret', |
|
| 68 | - 'verb' => 'POST', |
|
| 69 | - ], |
|
| 70 | - ], |
|
| 71 | - ] |
|
| 26 | + $this, |
|
| 27 | + [ |
|
| 28 | + 'routes' => [ |
|
| 29 | + [ |
|
| 30 | + 'name' => 'Settings#addServer', |
|
| 31 | + 'url' => '/trusted-servers', |
|
| 32 | + 'verb' => 'POST' |
|
| 33 | + ], |
|
| 34 | + [ |
|
| 35 | + 'name' => 'Settings#removeServer', |
|
| 36 | + 'url' => '/trusted-servers/{id}', |
|
| 37 | + 'verb' => 'DELETE' |
|
| 38 | + ], |
|
| 39 | + [ |
|
| 40 | + 'name' => 'Settings#autoAddServers', |
|
| 41 | + 'url' => '/auto-add-servers', |
|
| 42 | + 'verb' => 'POST' |
|
| 43 | + ], |
|
| 44 | + ], |
|
| 45 | + 'ocs' => [ |
|
| 46 | + // old endpoints, only used by Nextcloud and ownCloud |
|
| 47 | + [ |
|
| 48 | + 'name' => 'OCSAuthAPI#getSharedSecret', |
|
| 49 | + 'url' => '/api/v1/shared-secret', |
|
| 50 | + 'verb' => 'GET', |
|
| 51 | + ], |
|
| 52 | + [ |
|
| 53 | + 'name' => 'OCSAuthAPI#requestSharedSecret', |
|
| 54 | + 'url' => '/api/v1/request-shared-secret', |
|
| 55 | + 'verb' => 'POST', |
|
| 56 | + ], |
|
| 57 | + // new endpoints, published as public api |
|
| 58 | + [ |
|
| 59 | + 'name' => 'OCSAuthAPI#getSharedSecret', |
|
| 60 | + 'root' => '/cloud', |
|
| 61 | + 'url' => '/shared-secret', |
|
| 62 | + 'verb' => 'GET', |
|
| 63 | + ], |
|
| 64 | + [ |
|
| 65 | + 'name' => 'OCSAuthAPI#requestSharedSecret', |
|
| 66 | + 'root' => '/cloud', |
|
| 67 | + 'url' => '/shared-secret', |
|
| 68 | + 'verb' => 'POST', |
|
| 69 | + ], |
|
| 70 | + ], |
|
| 71 | + ] |
|
| 72 | 72 | ); |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | ], |
| 55 | 55 | ]; |
| 56 | 56 | |
| 57 | - if($this->appManager->isEnabledForUser('files_sharing')) { |
|
| 57 | + if ($this->appManager->isEnabledForUser('files_sharing')) { |
|
| 58 | 58 | $services['SHARING'] = [ |
| 59 | 59 | 'version' => 1, |
| 60 | 60 | 'endpoints' => [ |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | } |
| 86 | 86 | } |
| 87 | 87 | |
| 88 | - if($this->appManager->isEnabledForUser('activity')) { |
|
| 88 | + if ($this->appManager->isEnabledForUser('activity')) { |
|
| 89 | 89 | $services['ACTIVITY'] = [ |
| 90 | 90 | 'version' => 1, |
| 91 | 91 | 'endpoints' => [ |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | ]; |
| 95 | 95 | } |
| 96 | 96 | |
| 97 | - if($this->appManager->isEnabledForUser('provisioning_api')) { |
|
| 97 | + if ($this->appManager->isEnabledForUser('provisioning_api')) { |
|
| 98 | 98 | $services['PROVISIONING'] = [ |
| 99 | 99 | 'version' => 1, |
| 100 | 100 | 'endpoints' => [ |
@@ -24,92 +24,92 @@ |
||
| 24 | 24 | namespace OC\OCS; |
| 25 | 25 | |
| 26 | 26 | class Provider extends \OCP\AppFramework\Controller { |
| 27 | - /** @var \OCP\App\IAppManager */ |
|
| 28 | - private $appManager; |
|
| 27 | + /** @var \OCP\App\IAppManager */ |
|
| 28 | + private $appManager; |
|
| 29 | 29 | |
| 30 | - /** |
|
| 31 | - * @param string $appName |
|
| 32 | - * @param \OCP\IRequest $request |
|
| 33 | - * @param \OCP\App\IAppManager $appManager |
|
| 34 | - */ |
|
| 35 | - public function __construct($appName, |
|
| 36 | - \OCP\IRequest $request, |
|
| 37 | - \OCP\App\IAppManager $appManager) { |
|
| 38 | - parent::__construct($appName, $request); |
|
| 39 | - $this->appManager = $appManager; |
|
| 40 | - } |
|
| 30 | + /** |
|
| 31 | + * @param string $appName |
|
| 32 | + * @param \OCP\IRequest $request |
|
| 33 | + * @param \OCP\App\IAppManager $appManager |
|
| 34 | + */ |
|
| 35 | + public function __construct($appName, |
|
| 36 | + \OCP\IRequest $request, |
|
| 37 | + \OCP\App\IAppManager $appManager) { |
|
| 38 | + parent::__construct($appName, $request); |
|
| 39 | + $this->appManager = $appManager; |
|
| 40 | + } |
|
| 41 | 41 | |
| 42 | - /** |
|
| 43 | - * @return \OCP\AppFramework\Http\JSONResponse |
|
| 44 | - */ |
|
| 45 | - public function buildProviderList() { |
|
| 46 | - $services = [ |
|
| 47 | - 'PRIVATE_DATA' => [ |
|
| 48 | - 'version' => 1, |
|
| 49 | - 'endpoints' => [ |
|
| 50 | - 'store' => '/ocs/v2.php/privatedata/setattribute', |
|
| 51 | - 'read' => '/ocs/v2.php/privatedata/getattribute', |
|
| 52 | - 'delete' => '/ocs/v2.php/privatedata/deleteattribute', |
|
| 53 | - ], |
|
| 54 | - ], |
|
| 55 | - ]; |
|
| 42 | + /** |
|
| 43 | + * @return \OCP\AppFramework\Http\JSONResponse |
|
| 44 | + */ |
|
| 45 | + public function buildProviderList() { |
|
| 46 | + $services = [ |
|
| 47 | + 'PRIVATE_DATA' => [ |
|
| 48 | + 'version' => 1, |
|
| 49 | + 'endpoints' => [ |
|
| 50 | + 'store' => '/ocs/v2.php/privatedata/setattribute', |
|
| 51 | + 'read' => '/ocs/v2.php/privatedata/getattribute', |
|
| 52 | + 'delete' => '/ocs/v2.php/privatedata/deleteattribute', |
|
| 53 | + ], |
|
| 54 | + ], |
|
| 55 | + ]; |
|
| 56 | 56 | |
| 57 | - if($this->appManager->isEnabledForUser('files_sharing')) { |
|
| 58 | - $services['SHARING'] = [ |
|
| 59 | - 'version' => 1, |
|
| 60 | - 'endpoints' => [ |
|
| 61 | - 'share' => '/ocs/v2.php/apps/files_sharing/api/v1/shares', |
|
| 62 | - ], |
|
| 63 | - ]; |
|
| 64 | - $services['FEDERATED_SHARING'] = [ |
|
| 65 | - 'version' => 1, |
|
| 66 | - 'endpoints' => [ |
|
| 67 | - 'share' => '/ocs/v2.php/cloud/shares', |
|
| 68 | - 'webdav' => '/public.php/webdav/', |
|
| 69 | - ], |
|
| 70 | - ]; |
|
| 71 | - } |
|
| 57 | + if($this->appManager->isEnabledForUser('files_sharing')) { |
|
| 58 | + $services['SHARING'] = [ |
|
| 59 | + 'version' => 1, |
|
| 60 | + 'endpoints' => [ |
|
| 61 | + 'share' => '/ocs/v2.php/apps/files_sharing/api/v1/shares', |
|
| 62 | + ], |
|
| 63 | + ]; |
|
| 64 | + $services['FEDERATED_SHARING'] = [ |
|
| 65 | + 'version' => 1, |
|
| 66 | + 'endpoints' => [ |
|
| 67 | + 'share' => '/ocs/v2.php/cloud/shares', |
|
| 68 | + 'webdav' => '/public.php/webdav/', |
|
| 69 | + ], |
|
| 70 | + ]; |
|
| 71 | + } |
|
| 72 | 72 | |
| 73 | - if ($this->appManager->isEnabledForUser('federation')) { |
|
| 74 | - if (isset($services['FEDERATED_SHARING'])) { |
|
| 75 | - $services['FEDERATED_SHARING']['endpoints']['shared-secret'] = '/ocs/v2.php/cloud/shared-secret'; |
|
| 76 | - $services['FEDERATED_SHARING']['endpoints']['system-address-book'] = '/remote.php/dav/addressbooks/system/system/system'; |
|
| 77 | - $services['FEDERATED_SHARING']['endpoints']['carddav-user'] = 'system'; |
|
| 78 | - } else { |
|
| 79 | - $services['FEDERATED_SHARING'] = [ |
|
| 80 | - 'version' => 1, |
|
| 81 | - 'endpoints' => [ |
|
| 82 | - 'shared-secret' => '/ocs/v2.php/cloud/shared-secret', |
|
| 83 | - 'system-address-book' => '/remote.php/dav/addressbooks/system/system/system', |
|
| 84 | - 'carddav-user' => 'system' |
|
| 85 | - ], |
|
| 86 | - ]; |
|
| 87 | - } |
|
| 88 | - } |
|
| 73 | + if ($this->appManager->isEnabledForUser('federation')) { |
|
| 74 | + if (isset($services['FEDERATED_SHARING'])) { |
|
| 75 | + $services['FEDERATED_SHARING']['endpoints']['shared-secret'] = '/ocs/v2.php/cloud/shared-secret'; |
|
| 76 | + $services['FEDERATED_SHARING']['endpoints']['system-address-book'] = '/remote.php/dav/addressbooks/system/system/system'; |
|
| 77 | + $services['FEDERATED_SHARING']['endpoints']['carddav-user'] = 'system'; |
|
| 78 | + } else { |
|
| 79 | + $services['FEDERATED_SHARING'] = [ |
|
| 80 | + 'version' => 1, |
|
| 81 | + 'endpoints' => [ |
|
| 82 | + 'shared-secret' => '/ocs/v2.php/cloud/shared-secret', |
|
| 83 | + 'system-address-book' => '/remote.php/dav/addressbooks/system/system/system', |
|
| 84 | + 'carddav-user' => 'system' |
|
| 85 | + ], |
|
| 86 | + ]; |
|
| 87 | + } |
|
| 88 | + } |
|
| 89 | 89 | |
| 90 | - if($this->appManager->isEnabledForUser('activity')) { |
|
| 91 | - $services['ACTIVITY'] = [ |
|
| 92 | - 'version' => 1, |
|
| 93 | - 'endpoints' => [ |
|
| 94 | - 'list' => '/ocs/v2.php/cloud/activity', |
|
| 95 | - ], |
|
| 96 | - ]; |
|
| 97 | - } |
|
| 90 | + if($this->appManager->isEnabledForUser('activity')) { |
|
| 91 | + $services['ACTIVITY'] = [ |
|
| 92 | + 'version' => 1, |
|
| 93 | + 'endpoints' => [ |
|
| 94 | + 'list' => '/ocs/v2.php/cloud/activity', |
|
| 95 | + ], |
|
| 96 | + ]; |
|
| 97 | + } |
|
| 98 | 98 | |
| 99 | - if($this->appManager->isEnabledForUser('provisioning_api')) { |
|
| 100 | - $services['PROVISIONING'] = [ |
|
| 101 | - 'version' => 1, |
|
| 102 | - 'endpoints' => [ |
|
| 103 | - 'user' => '/ocs/v2.php/cloud/users', |
|
| 104 | - 'groups' => '/ocs/v2.php/cloud/groups', |
|
| 105 | - 'apps' => '/ocs/v2.php/cloud/apps', |
|
| 106 | - ], |
|
| 107 | - ]; |
|
| 108 | - } |
|
| 99 | + if($this->appManager->isEnabledForUser('provisioning_api')) { |
|
| 100 | + $services['PROVISIONING'] = [ |
|
| 101 | + 'version' => 1, |
|
| 102 | + 'endpoints' => [ |
|
| 103 | + 'user' => '/ocs/v2.php/cloud/users', |
|
| 104 | + 'groups' => '/ocs/v2.php/cloud/groups', |
|
| 105 | + 'apps' => '/ocs/v2.php/cloud/apps', |
|
| 106 | + ], |
|
| 107 | + ]; |
|
| 108 | + } |
|
| 109 | 109 | |
| 110 | - return new \OCP\AppFramework\Http\JSONResponse([ |
|
| 111 | - 'version' => 2, |
|
| 112 | - 'services' => $services, |
|
| 113 | - ]); |
|
| 114 | - } |
|
| 110 | + return new \OCP\AppFramework\Http\JSONResponse([ |
|
| 111 | + 'version' => 2, |
|
| 112 | + 'services' => $services, |
|
| 113 | + ]); |
|
| 114 | + } |
|
| 115 | 115 | } |