-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Maxence Lange <[email protected]>
- Loading branch information
1 parent
19e7704
commit cf657da
Showing
23 changed files
with
1,005 additions
and
195 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,7 @@ | |
* @copyright Copyright (c) 2020 Joas Schilling <[email protected]> | ||
* | ||
* @author Joas Schilling <[email protected]> | ||
* @author Maxence Lange <[email protected]> | ||
* | ||
* @license GNU AGPL version 3 or any later version | ||
* | ||
|
@@ -27,15 +28,22 @@ | |
'routes' => [ | ||
[ | ||
'name' => 'RequestHandler#addShare', | ||
'url' => '/ocm/shares', | ||
'url' => '/shares', | ||
'verb' => 'POST', | ||
'root' => '', | ||
'root' => '/ocm', | ||
], | ||
[ | ||
'name' => 'RequestHandler#receiveNotification', | ||
'url' => '/ocm/notifications', | ||
'url' => '/notifications', | ||
'verb' => 'POST', | ||
'root' => '', | ||
'root' => '/ocm', | ||
], | ||
// 1.1.0 | ||
// [ | ||
// 'name' => 'RequestHandler#inviteAccepted', | ||
// 'url' => '/invite-accepted', | ||
// 'verb' => 'POST', | ||
// 'root' => '/ocm', | ||
// ] | ||
], | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,13 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/** | ||
* @copyright Copyright (c) 2017 Bjoern Schiessle <[email protected]> | ||
* | ||
* @author Bjoern Schiessle <[email protected]> | ||
* @author Kate Döen <[email protected]> | ||
* @author Maxence Lange <[email protected]> | ||
* | ||
* @license GNU AGPL version 3 or any later version | ||
* | ||
|
@@ -23,16 +27,20 @@ | |
*/ | ||
namespace OCA\CloudFederationAPI; | ||
|
||
use OC\OCM\Model\OCMProvider; | ||
use OC\OCM\Model\OCMResource; | ||
use OCP\Capabilities\ICapability; | ||
use OCP\IURLGenerator; | ||
use OCP\OCM\IOCMDiscoveryService; | ||
|
||
class Capabilities implements ICapability { | ||
|
||
/** @var IURLGenerator */ | ||
private $urlGenerator; | ||
public const API_VERSION = '1.0-proposal1'; | ||
|
||
public function __construct(IURLGenerator $urlGenerator) { | ||
$this->urlGenerator = $urlGenerator; | ||
public function __construct( | ||
private IURLGenerator $urlGenerator, | ||
private IOCMDiscoveryService $discoveryService | ||
) { | ||
} | ||
|
||
/** | ||
|
@@ -55,23 +63,19 @@ public function __construct(IURLGenerator $urlGenerator) { | |
*/ | ||
public function getCapabilities() { | ||
$url = $this->urlGenerator->linkToRouteAbsolute('cloud_federation_api.requesthandlercontroller.addShare'); | ||
$capabilities = ['ocm' => | ||
[ | ||
'enabled' => true, | ||
'apiVersion' => '1.0-proposal1', | ||
'endPoint' => substr($url, 0, strrpos($url, '/')), | ||
'resourceTypes' => [ | ||
[ | ||
'name' => 'file', | ||
'shareTypes' => ['user', 'group'], | ||
'protocols' => [ | ||
'webdav' => '/public.php/webdav/', | ||
] | ||
], | ||
] | ||
] | ||
]; | ||
|
||
return $capabilities; | ||
$provider = new OCMProvider(); | ||
$provider->setEnabled(true); | ||
$provider->setApiVersion(self::API_VERSION); | ||
$provider->setEndPoint(substr($url, 0, strrpos($url, '/'))); | ||
|
||
$resource = new OCMResource(); | ||
$resource->setName('file') | ||
->setShareTypes(['user', 'group']) | ||
->setProtocols(['webdav' => '/public.php/webdav/']); | ||
|
||
$provider->setResourceTypes([$resource]); | ||
|
||
return ['ocm' => $provider]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.