adjust to latest api version
Signed-off-by: Bjoern Schiessle <bjoern@schiessle.org>
This commit is contained in:
parent
daba042d26
commit
bbce8c3ea1
|
@ -46,9 +46,9 @@ class Capabilities implements ICapability {
|
||||||
$capabilities = ['ocm' =>
|
$capabilities = ['ocm' =>
|
||||||
[
|
[
|
||||||
'enabled' => true,
|
'enabled' => true,
|
||||||
'api-version' => '1.0-proposal1',
|
'apiVersion' => '1.0-proposal1',
|
||||||
'end-point' => substr($url, 0, strrpos($url, '/')),
|
'endPoint' => substr($url, 0, strrpos($url, '/')),
|
||||||
'share-types' => ['file'],
|
'shareTypes' => ['file'],
|
||||||
'protocol' => [
|
'protocol' => [
|
||||||
'webdav' => '/public.php/webdav/',
|
'webdav' => '/public.php/webdav/',
|
||||||
]
|
]
|
||||||
|
|
|
@ -105,16 +105,16 @@ class RequestHandlerController extends Controller {
|
||||||
* @param string $owner provider specific UID of the user who owns the resource
|
* @param string $owner provider specific UID of the user who owns the resource
|
||||||
* @param string $ownerDisplayName display name of the user who shared the item
|
* @param string $ownerDisplayName display name of the user who shared the item
|
||||||
* @param string $sharedBy provider specific UID of the user who shared the resource
|
* @param string $sharedBy provider specific UID of the user who shared the resource
|
||||||
* @param $sharedByDisplayName display name of the user who shared the resource
|
* @param string $sharedByDisplayName display name of the user who shared the resource
|
||||||
|
* @param string $sharedSecret use to authenticate accross servers
|
||||||
* @param array $protocol (e,.g. ['name' => 'webdav', 'options' => ['username' => 'john', 'permissions' => 31]])
|
* @param array $protocol (e,.g. ['name' => 'webdav', 'options' => ['username' => 'john', 'permissions' => 31]])
|
||||||
* @param string $shareType ('group' or 'user' share)
|
* @param string $shareType ('group' or 'user' share)
|
||||||
* @param $resourceType ('file', 'calendar',...)
|
* @param $resourceType ('file', 'calendar',...)
|
||||||
* @return Http\DataResponse|JSONResponse
|
* @return Http\DataResponse|JSONResponse
|
||||||
*
|
*
|
||||||
* Example: curl -H "Content-Type: application/json" -X POST -d '{"shareWith":"admin1@serve1","name":"welcome server2.txt","description":"desc","providerId":"2","owner":"admin2@http://localhost/server2","ownerDisplayName":"admin2 display","shareType":"user","resourceType":"file","protocol":{"name":"webdav","options":{"access_token":"8Lrd1FVEREthux7","permissions":31}}}' http://localhost/server/index.php/ocm/shares
|
* Example: curl -H "Content-Type: application/json" -X POST -d '{"shareWith":"admin1@serve1","name":"welcome server2.txt","description":"desc","providerId":"2","owner":"admin2@http://localhost/server2","ownerDisplayName":"admin2 display","shareType":"user","resourceType":"file","protocol":{"name":"webdav","options":{"sharedSecret":"secret","permissions":"webdav-property"}}}' http://localhost/server/index.php/ocm/shares
|
||||||
*/
|
*/
|
||||||
public function addShare($shareWith, $name, $description, $providerId, $owner, $ownerDisplayName, $sharedBy, $sharedByDisplayName, $protocol, $shareType, $resourceType) {
|
public function addShare($shareWith, $name, $description, $providerId, $owner, $ownerDisplayName, $sharedBy, $sharedByDisplayName, $protocol, $shareType, $resourceType) {
|
||||||
|
|
||||||
if (!$this->config->incomingRequestsEnabled()) {
|
if (!$this->config->incomingRequestsEnabled()) {
|
||||||
return new JSONResponse(
|
return new JSONResponse(
|
||||||
['message' => 'This server doesn\'t support outgoing federated shares'],
|
['message' => 'This server doesn\'t support outgoing federated shares'],
|
||||||
|
@ -132,7 +132,8 @@ class RequestHandlerController extends Controller {
|
||||||
!is_array($protocol) ||
|
!is_array($protocol) ||
|
||||||
!isset($protocol['name']) ||
|
!isset($protocol['name']) ||
|
||||||
!isset ($protocol['options']) ||
|
!isset ($protocol['options']) ||
|
||||||
!is_array($protocol['options'])
|
!is_array($protocol['options']) ||
|
||||||
|
!isset($protocol['options']['sharedSecret'])
|
||||||
) {
|
) {
|
||||||
return new JSONResponse(
|
return new JSONResponse(
|
||||||
['message' => 'Missing arguments'],
|
['message' => 'Missing arguments'],
|
||||||
|
@ -163,7 +164,8 @@ class RequestHandlerController extends Controller {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$provider = $this->cloudFederationProviderManager->getCloudFederationProvider($resourceType);
|
$provider = $this->cloudFederationProviderManager->getCloudFederationProvider($resourceType);
|
||||||
$share = $this->factory->getCloudFederationShare($shareWith, $name, $description, $providerId, $owner, $ownerDisplayName, $sharedBy, $sharedByDisplayName, $protocol, $shareType, $resourceType);
|
$share = $this->factory->getCloudFederationShare($shareWith, $name, $description, $providerId, $owner, $ownerDisplayName, $sharedBy, $sharedByDisplayName, '', $shareType, $resourceType);
|
||||||
|
$share->setProtocol($protocol);
|
||||||
$id = $provider->shareReceived($share);
|
$id = $provider->shareReceived($share);
|
||||||
} catch (ProviderDoesNotExistsException $e) {
|
} catch (ProviderDoesNotExistsException $e) {
|
||||||
return new JSONResponse(
|
return new JSONResponse(
|
||||||
|
@ -191,12 +193,17 @@ class RequestHandlerController extends Controller {
|
||||||
/**
|
/**
|
||||||
* receive notification about existing share
|
* receive notification about existing share
|
||||||
*
|
*
|
||||||
|
* @NoCSRFRequired
|
||||||
|
* @PublicPage
|
||||||
|
* @BruteForceProtection(action=receiveFederatedShareNotification)
|
||||||
|
*
|
||||||
* @param string $notificationType (notification type, e.g. SHARE_ACCEPTED)
|
* @param string $notificationType (notification type, e.g. SHARE_ACCEPTED)
|
||||||
* @param string $resourceType (calendar, file, contact,...)
|
* @param string $resourceType (calendar, file, contact,...)
|
||||||
* @param array $message contain the actual notification, content is defined by cloud federation provider
|
* @param string $providerId id of the share
|
||||||
|
* @param array $notification the actual payload of the notification
|
||||||
* @return JSONResponse
|
* @return JSONResponse
|
||||||
*/
|
*/
|
||||||
public function receiveNotification($notificationType, $resourceType, $message) {
|
public function receiveNotification($notificationType, $resourceType, $providerId, array $notification) {
|
||||||
if (!$this->config->incomingRequestsEnabled()) {
|
if (!$this->config->incomingRequestsEnabled()) {
|
||||||
return new JSONResponse(
|
return new JSONResponse(
|
||||||
['message' => 'This server doesn\'t support outgoing federated shares'],
|
['message' => 'This server doesn\'t support outgoing federated shares'],
|
||||||
|
@ -207,7 +214,8 @@ class RequestHandlerController extends Controller {
|
||||||
// check if all required parameters are set
|
// check if all required parameters are set
|
||||||
if ($notificationType === null ||
|
if ($notificationType === null ||
|
||||||
$resourceType === null ||
|
$resourceType === null ||
|
||||||
!is_array($message)
|
$providerId === null ||
|
||||||
|
!is_array($notification)
|
||||||
) {
|
) {
|
||||||
return new JSONResponse(
|
return new JSONResponse(
|
||||||
['message' => 'Missing arguments'],
|
['message' => 'Missing arguments'],
|
||||||
|
@ -217,7 +225,7 @@ class RequestHandlerController extends Controller {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$provider = $this->cloudFederationProviderManager->getCloudFederationProvider($resourceType);
|
$provider = $this->cloudFederationProviderManager->getCloudFederationProvider($resourceType);
|
||||||
$provider->notificationReceived($notificationType, $message);
|
$provider->notificationReceived($notificationType, $providerId, $notification);
|
||||||
} catch (ProviderDoesNotExistsException $e) {
|
} catch (ProviderDoesNotExistsException $e) {
|
||||||
return new JSONResponse(
|
return new JSONResponse(
|
||||||
['message' => $e->getMessage()],
|
['message' => $e->getMessage()],
|
||||||
|
@ -241,10 +249,7 @@ class RequestHandlerController extends Controller {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return new JSONResponse(
|
return new JSONResponse([],Http::STATUS_CREATED);
|
||||||
['id' => $id, 'createdAt' => date()],
|
|
||||||
Http::STATUS_CREATED);
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -170,7 +170,7 @@ class RequestHandlerController extends OCSController {
|
||||||
$owner,
|
$owner,
|
||||||
$sharedByFederatedId,
|
$sharedByFederatedId,
|
||||||
$sharedBy,
|
$sharedBy,
|
||||||
['name' => 'webdav', 'options' => ['access_token' => $token]],
|
$token,
|
||||||
'user',
|
'user',
|
||||||
'file'
|
'file'
|
||||||
);
|
);
|
||||||
|
|
|
@ -379,7 +379,7 @@ class Notifications {
|
||||||
$fields['owner'],
|
$fields['owner'],
|
||||||
$fields['sharedByFederatedId'],
|
$fields['sharedByFederatedId'],
|
||||||
$fields['sharedBy'],
|
$fields['sharedBy'],
|
||||||
['name' => 'webdav', 'options' => ['access_token' => $fields['token'], 'permissions' => ['read', 'write', 'share']]],
|
$fields['token'],
|
||||||
'user',
|
'user',
|
||||||
'file'
|
'file'
|
||||||
);
|
);
|
||||||
|
|
|
@ -135,7 +135,7 @@ class CloudFederationProviderFiles implements ICloudFederationProvider {
|
||||||
list($ownerUid, $remote) = $this->addressHandler->splitUserRemote($share->getOwner());
|
list($ownerUid, $remote) = $this->addressHandler->splitUserRemote($share->getOwner());
|
||||||
|
|
||||||
$remote = $remote;
|
$remote = $remote;
|
||||||
$token = isset($protocol['options']['access_token']) ? $protocol['options']['access_token'] : null;
|
$token = $share->getShareSecret();
|
||||||
$name = $share->getResourceName();
|
$name = $share->getResourceName();
|
||||||
$owner = $share->getOwnerDisplayName();
|
$owner = $share->getOwnerDisplayName();
|
||||||
$sharedBy = $share->getSharedByDisplayName();
|
$sharedBy = $share->getSharedByDisplayName();
|
||||||
|
@ -234,21 +234,22 @@ class CloudFederationProviderFiles implements ICloudFederationProvider {
|
||||||
* notification received from another server
|
* notification received from another server
|
||||||
*
|
*
|
||||||
* @param string $notificationType (e.g. SHARE_ACCEPTED)
|
* @param string $notificationType (e.g. SHARE_ACCEPTED)
|
||||||
* @param array $message
|
* @param string $providerId id of the share
|
||||||
|
* @param array $notification payload of the notification
|
||||||
*
|
*
|
||||||
* @throws ShareNotFoundException
|
* @throws ShareNotFoundException
|
||||||
* @throws ActionNotSupportedException
|
* @throws ActionNotSupportedException
|
||||||
*
|
*
|
||||||
* @since 14.0.0
|
* @since 14.0.0
|
||||||
*/
|
*/
|
||||||
public function notificationReceived($notificationType, array $message) {
|
public function notificationReceived($notificationType, $providerId, array $notification) {
|
||||||
switch ($notificationType) {
|
switch ($notificationType) {
|
||||||
case 'SHARE_ACCEPTED' :
|
case 'SHARE_ACCEPTED' :
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
throw new ActionNotSupportedException($notificationType);
|
throw new ActionNotSupportedException($notification);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -324,7 +324,7 @@ class Manager {
|
||||||
*
|
*
|
||||||
* @param string $remoteDomain
|
* @param string $remoteDomain
|
||||||
* @param string $token
|
* @param string $token
|
||||||
* @param $remoteId
|
* @param $remoteId id of the share
|
||||||
* @param string $feedback
|
* @param string $feedback
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
|
@ -332,11 +332,15 @@ class Manager {
|
||||||
switch ($feedback) {
|
switch ($feedback) {
|
||||||
case 'accept':
|
case 'accept':
|
||||||
$notification = $this->cloudFederationFactory->getCloudFederationNotification();
|
$notification = $this->cloudFederationFactory->getCloudFederationNotification();
|
||||||
$notification->setMessage('SHARE_ACCEPTED', 'file',
|
$notification->setMessage(
|
||||||
|
'SHARE_ACCEPTED',
|
||||||
|
'file',
|
||||||
|
$remoteId,
|
||||||
[
|
[
|
||||||
'id' => $remoteId,
|
'sharedSecret' => $token,
|
||||||
'access_token' => $token
|
'message' => 'Recipient accept the share'
|
||||||
]
|
]
|
||||||
|
|
||||||
);
|
);
|
||||||
return $this->cloudFederationProviderManager->sendNotification($remoteDomain, $notification);
|
return $this->cloudFederationProviderManager->sendNotification($remoteDomain, $notification);
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,16 +37,16 @@ class CloudFederationFactory implements ICloudFederationFactory {
|
||||||
* @param string $owner provider specific UID of the user who owns the resource
|
* @param string $owner provider specific UID of the user who owns the resource
|
||||||
* @param string $ownerDisplayName display name of the user who shared the item
|
* @param string $ownerDisplayName display name of the user who shared the item
|
||||||
* @param string $sharedBy provider specific UID of the user who shared the resource
|
* @param string $sharedBy provider specific UID of the user who shared the resource
|
||||||
* @param $sharedByDisplayName display name of the user who shared the resource
|
* @param string $sharedByDisplayName display name of the user who shared the resource
|
||||||
* @param array $protocol (e,.g. ['name' => 'webdav', 'options' => ['username' => 'john', 'permissions' => 31]])
|
* @param string $sharedSecret used to authenticate requests across servers
|
||||||
* @param string $shareType ('group' or 'user' share)
|
* @param string $shareType ('group' or 'user' share)
|
||||||
* @param $resourceType ('file', 'calendar',...)
|
* @param $resourceType ('file', 'calendar',...)
|
||||||
* @return ICloudFederationShare
|
* @return ICloudFederationShare
|
||||||
*
|
*
|
||||||
* @since 14.0.0
|
* @since 14.0.0
|
||||||
*/
|
*/
|
||||||
public function getCloudFederationShare($shareWith, $name, $description, $providerId, $owner, $ownerDisplayName, $sharedBy, $sharedByDisplayName, $protocol, $shareType, $resourceType) {
|
public function getCloudFederationShare($shareWith, $name, $description, $providerId, $owner, $ownerDisplayName, $sharedBy, $sharedByDisplayName, $sharedSecret, $shareType, $resourceType) {
|
||||||
return new CloudFederationShare($shareWith, $name, $description, $providerId, $owner, $ownerDisplayName, $sharedBy, $sharedByDisplayName, $protocol, $shareType, $resourceType);
|
return new CloudFederationShare($shareWith, $name, $description, $providerId, $owner, $ownerDisplayName, $sharedBy, $sharedByDisplayName, $shareType, $resourceType, $sharedSecret);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -32,16 +32,19 @@ class CloudFederationNotification implements ICloudFederationNotification {
|
||||||
*
|
*
|
||||||
* @param string $notificationType (e.g. SHARE_ACCEPTED)
|
* @param string $notificationType (e.g. SHARE_ACCEPTED)
|
||||||
* @param string $resourceType (e.g. file, calendar, contact,...)
|
* @param string $resourceType (e.g. file, calendar, contact,...)
|
||||||
* @param array $message
|
* @param string $providerId id of the share
|
||||||
|
* @param array $notification payload of the notification
|
||||||
*
|
*
|
||||||
* @since 14.0.0
|
* @since 14.0.0
|
||||||
*/
|
*/
|
||||||
public function setMessage($notificationType, $resourceType, array $message) {
|
public function setMessage($notificationType, $resourceType, $providerId, array $notification) {
|
||||||
$this->message = [
|
$this->message = [
|
||||||
'notificationType' => $notificationType,
|
'notificationType' => $notificationType,
|
||||||
'resourceType' => $resourceType,
|
'resourceType' => $resourceType,
|
||||||
'message' => $message,
|
'providerId' => $providerId,
|
||||||
|
'notification' => $notification,
|
||||||
];
|
];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -57,7 +57,7 @@ class CloudFederationProviderManager implements ICloudFederationProviderManager
|
||||||
/** @var ILogger */
|
/** @var ILogger */
|
||||||
private $logger;
|
private $logger;
|
||||||
|
|
||||||
private $supportedAPIVersion = '2.0-draft';
|
private $supportedAPIVersion = '1.0-proposal1';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* CloudFederationProviderManager constructor.
|
* CloudFederationProviderManager constructor.
|
||||||
|
@ -131,7 +131,8 @@ class CloudFederationProviderManager implements ICloudFederationProviderManager
|
||||||
}
|
}
|
||||||
|
|
||||||
public function sendShare(ICloudFederationShare $share) {
|
public function sendShare(ICloudFederationShare $share) {
|
||||||
$ocmEndPoint = $this->getOCMEndPoint($share->getShareWith());
|
$cloudID = $this->cloudIdManager->resolveCloudId($share->getShareWith());
|
||||||
|
$ocmEndPoint = $this->getOCMEndPoint($cloudID->getRemote());
|
||||||
|
|
||||||
if (empty($ocmEndPoint)) {
|
if (empty($ocmEndPoint)) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -203,14 +204,13 @@ class CloudFederationProviderManager implements ICloudFederationProviderManager
|
||||||
/**
|
/**
|
||||||
* check if server supports the new OCM api and ask for the correct end-point
|
* check if server supports the new OCM api and ask for the correct end-point
|
||||||
*
|
*
|
||||||
* @param string $recipient full federated cloud ID of the recipient of a share
|
* @param string $url full base URL of the cloud server
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
protected function getOCMEndPoint($recipient) {
|
protected function getOCMEndPoint($url) {
|
||||||
$cloudId = $this->cloudIdManager->resolveCloudId($recipient);
|
|
||||||
$client = $this->httpClientService->newClient();
|
$client = $this->httpClientService->newClient();
|
||||||
try {
|
try {
|
||||||
$response = $client->get($cloudId->getRemote() . '/ocm-provider/', ['timeout' => 10, 'connect_timeout' => 10]);
|
$response = $client->get($url . '/ocm-provider/', ['timeout' => 10, 'connect_timeout' => 10]);
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
@ -218,10 +218,10 @@ class CloudFederationProviderManager implements ICloudFederationProviderManager
|
||||||
$result = $response->getBody();
|
$result = $response->getBody();
|
||||||
$result = json_decode($result, true);
|
$result = json_decode($result, true);
|
||||||
|
|
||||||
$supportedVersion = isset($result['api-version']) && $result['api-version'] === $this->supportedAPIVersion;
|
$supportedVersion = isset($result['apiVersion']) && $result['apiVersion'] === $this->supportedAPIVersion;
|
||||||
|
|
||||||
if (isset($result['end-point']) && $supportedVersion) {
|
if (isset($result['endPoint']) && $supportedVersion) {
|
||||||
return $result['end-point'];
|
return $result['endPoint'];
|
||||||
}
|
}
|
||||||
|
|
||||||
return '';
|
return '';
|
||||||
|
|
|
@ -50,10 +50,9 @@ class CloudFederationShare implements ICloudFederationShare {
|
||||||
* @param string $ownerDisplayName display name of the user who shared the item
|
* @param string $ownerDisplayName display name of the user who shared the item
|
||||||
* @param string $sharedBy provider specific UID of the user who shared the resource
|
* @param string $sharedBy provider specific UID of the user who shared the resource
|
||||||
* @param string $sharedByDisplayName display name of the user who shared the resource
|
* @param string $sharedByDisplayName display name of the user who shared the resource
|
||||||
* @param array $protocol (e,.g. ['name' => 'webdav', 'options' => ['username' => 'john', 'permissions' => 31]])
|
|
||||||
* @param string $shareType ('group' or 'user' share)
|
* @param string $shareType ('group' or 'user' share)
|
||||||
* @param $resourceType ('file', 'calendar',...)
|
* @param string $resourceType ('file', 'calendar',...)
|
||||||
*
|
* @param string $sharedSecret
|
||||||
*/
|
*/
|
||||||
public function __construct($shareWith = '',
|
public function __construct($shareWith = '',
|
||||||
$name = '',
|
$name = '',
|
||||||
|
@ -63,9 +62,9 @@ class CloudFederationShare implements ICloudFederationShare {
|
||||||
$ownerDisplayName = '',
|
$ownerDisplayName = '',
|
||||||
$sharedBy = '',
|
$sharedBy = '',
|
||||||
$sharedByDisplayName = '',
|
$sharedByDisplayName = '',
|
||||||
$protocol = [],
|
|
||||||
$shareType = '',
|
$shareType = '',
|
||||||
$resourceType = ''
|
$resourceType = '',
|
||||||
|
$sharedSecret = ''
|
||||||
) {
|
) {
|
||||||
$this->setShareWith($shareWith);
|
$this->setShareWith($shareWith);
|
||||||
$this->setResourceName($name);
|
$this->setResourceName($name);
|
||||||
|
@ -75,7 +74,13 @@ class CloudFederationShare implements ICloudFederationShare {
|
||||||
$this->setOwnerDisplayName($ownerDisplayName);
|
$this->setOwnerDisplayName($ownerDisplayName);
|
||||||
$this->setSharedBy($sharedBy);
|
$this->setSharedBy($sharedBy);
|
||||||
$this->setSharedByDisplayName($sharedByDisplayName);
|
$this->setSharedByDisplayName($sharedByDisplayName);
|
||||||
$this->setProtocol($protocol);
|
$this->setProtocol([
|
||||||
|
'name' => 'webdav',
|
||||||
|
'options' => [
|
||||||
|
'sharedSecret' => $sharedSecret,
|
||||||
|
'permissions' => '{http://open-collaboration-services.org/ns}share-permissions'
|
||||||
|
]
|
||||||
|
]);
|
||||||
$this->setShareType($shareType);
|
$this->setShareType($shareType);
|
||||||
$this->setResourceType($resourceType);
|
$this->setResourceType($resourceType);
|
||||||
|
|
||||||
|
@ -323,6 +328,17 @@ class CloudFederationShare implements ICloudFederationShare {
|
||||||
return $this->share['shareType'];
|
return $this->share['shareType'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* get share Secret
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*
|
||||||
|
* @since 14.0.0
|
||||||
|
*/
|
||||||
|
public function getShareSecret() {
|
||||||
|
return $this->share['protocol']['options']['sharedSecret'];
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get protocol specification
|
* get protocol specification
|
||||||
*
|
*
|
||||||
|
|
|
@ -33,15 +33,15 @@ interface ICloudFederationFactory {
|
||||||
* @param string $owner provider specific UID of the user who owns the resource
|
* @param string $owner provider specific UID of the user who owns the resource
|
||||||
* @param string $ownerDisplayName display name of the user who shared the item
|
* @param string $ownerDisplayName display name of the user who shared the item
|
||||||
* @param string $sharedBy provider specific UID of the user who shared the resource
|
* @param string $sharedBy provider specific UID of the user who shared the resource
|
||||||
* @param $sharedByDisplayName display name of the user who shared the resource
|
* @param string $sharedByDisplayName display name of the user who shared the resource
|
||||||
* @param array $protocol (e,.g. ['name' => 'webdav', 'options' => ['username' => 'john', 'permissions' => 31]])
|
* @param string $sharedSecret used to authenticate requests across servers
|
||||||
* @param string $shareType ('group' or 'user' share)
|
* @param string $shareType ('group' or 'user' share)
|
||||||
* @param $resourceType ('file', 'calendar',...)
|
* @param $resourceType ('file', 'calendar',...)
|
||||||
* @return ICloudFederationShare
|
* @return ICloudFederationShare
|
||||||
*
|
*
|
||||||
* @since 14.0.0
|
* @since 14.0.0
|
||||||
*/
|
*/
|
||||||
public function getCloudFederationShare($shareWith, $name, $description, $providerId, $owner, $ownerDisplayName, $sharedBy, $sharedByDisplayName, $protocol, $shareType, $resourceType);
|
public function getCloudFederationShare($shareWith, $name, $description, $providerId, $owner, $ownerDisplayName, $sharedBy, $sharedByDisplayName, $sharedSecret, $shareType, $resourceType);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get a Cloud FederationNotification object to prepare a notification you
|
* get a Cloud FederationNotification object to prepare a notification you
|
||||||
|
|
|
@ -28,11 +28,13 @@ interface ICloudFederationNotification {
|
||||||
*
|
*
|
||||||
* @param string $notificationType (e.g. SHARE_ACCEPTED)
|
* @param string $notificationType (e.g. SHARE_ACCEPTED)
|
||||||
* @param string $resourceType (e.g. file, calendar, contact,...)
|
* @param string $resourceType (e.g. file, calendar, contact,...)
|
||||||
* @param array $message
|
* @param $providerId id of the share
|
||||||
|
* @param array $notification , payload of the notification
|
||||||
*
|
*
|
||||||
|
* @return
|
||||||
* @since 14.0.0
|
* @since 14.0.0
|
||||||
*/
|
*/
|
||||||
public function setMessage($notificationType, $resourceType, array $message);
|
public function setMessage($notificationType, $resourceType, $providerId, array $notification);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get message, ready to send out
|
* get message, ready to send out
|
||||||
|
|
|
@ -62,13 +62,14 @@ interface ICloudFederationProvider {
|
||||||
* notification received from another server
|
* notification received from another server
|
||||||
*
|
*
|
||||||
* @param string $notificationType (e.g SHARE_ACCEPTED)
|
* @param string $notificationType (e.g SHARE_ACCEPTED)
|
||||||
* @param array $message provider specific notification
|
* @param string $providerId share ID
|
||||||
|
* @param array $notification provider specific notification
|
||||||
*
|
*
|
||||||
* @throws ShareNotFoundException
|
* @throws ShareNotFoundException
|
||||||
* @throws ActionNotSupportedException
|
* @throws ActionNotSupportedException
|
||||||
*
|
*
|
||||||
* @since 14.0.0
|
* @since 14.0.0
|
||||||
*/
|
*/
|
||||||
public function notificationReceived($notificationType, array $message);
|
public function notificationReceived($notificationType, $providerId, array $notification);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -221,6 +221,16 @@ interface ICloudFederationShare {
|
||||||
*/
|
*/
|
||||||
public function getShareType();
|
public function getShareType();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* get share Secret
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*
|
||||||
|
* @since 14.0.0
|
||||||
|
*/
|
||||||
|
public function getShareSecret();
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get protocol specification
|
* get protocol specification
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in New Issue