summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--apps/cloud_federation_api/lib/Controller/RequestHandlerController.php1
-rw-r--r--apps/federatedfilesharing/lib/FederatedShareProvider.php4
-rw-r--r--apps/federatedfilesharing/lib/ocm/CloudFederationProviderFiles.php27
-rw-r--r--lib/private/Federation/CloudFederationNotification.php7
-rw-r--r--lib/private/Federation/CloudFederationProviderManager.php2
-rw-r--r--lib/public/Federation/Exceptions/ActionNotSupportedException.php9
-rw-r--r--lib/public/Federation/Exceptions/AuthenticationFailedException.php10
-rw-r--r--lib/public/Federation/Exceptions/BadRequestException.php11
-rw-r--r--lib/public/Federation/Exceptions/ProviderAlreadyExistsException.php9
-rw-r--r--lib/public/Federation/Exceptions/ProviderCouldNotAddShareException.php17
-rw-r--r--lib/public/Federation/Exceptions/ProviderDoesNotExistsException.php9
-rw-r--r--lib/public/Federation/ICloudFederationFactory.php7
-rw-r--r--lib/public/Federation/ICloudFederationNotification.php10
-rw-r--r--lib/public/Federation/ICloudFederationShare.php7
-rw-r--r--lib/public/IServerContainer.php1
15 files changed, 109 insertions, 22 deletions
diff --git a/apps/cloud_federation_api/lib/Controller/RequestHandlerController.php b/apps/cloud_federation_api/lib/Controller/RequestHandlerController.php
index f79b7747700..518cb88dff4 100644
--- a/apps/cloud_federation_api/lib/Controller/RequestHandlerController.php
+++ b/apps/cloud_federation_api/lib/Controller/RequestHandlerController.php
@@ -108,7 +108,6 @@ class RequestHandlerController extends Controller {
* @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 $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 string $shareType ('group' or 'user' share)
* @param $resourceType ('file', 'calendar',...)
diff --git a/apps/federatedfilesharing/lib/FederatedShareProvider.php b/apps/federatedfilesharing/lib/FederatedShareProvider.php
index 27fbfeef619..5a12f8e9be3 100644
--- a/apps/federatedfilesharing/lib/FederatedShareProvider.php
+++ b/apps/federatedfilesharing/lib/FederatedShareProvider.php
@@ -506,13 +506,13 @@ class FederatedShareProvider implements IShareProvider {
* Delete a share (owner unShares the file)
*
* @param IShare $share
+ * @throws ShareNotFound
+ * @throws \OC\HintException
*/
public function delete(IShare $share) {
list(, $remote) = $this->addressHandler->splitUserRemote($share->getSharedWith());
- $isOwner = false;
-
// if the local user is the owner we can send the unShare request directly...
if ($this->userManager->userExists($share->getShareOwner())) {
$this->notifications->sendRemoteUnShare($remote, $share->getId(), $share->getToken());
diff --git a/apps/federatedfilesharing/lib/ocm/CloudFederationProviderFiles.php b/apps/federatedfilesharing/lib/ocm/CloudFederationProviderFiles.php
index 422d008ffd6..230af994482 100644
--- a/apps/federatedfilesharing/lib/ocm/CloudFederationProviderFiles.php
+++ b/apps/federatedfilesharing/lib/ocm/CloudFederationProviderFiles.php
@@ -162,7 +162,6 @@ class CloudFederationProviderFiles implements ICloudFederationProvider {
list($ownerUid, $remote) = $this->addressHandler->splitUserRemote($share->getOwner());
- $remote = $remote;
$token = $share->getShareSecret();
$name = $share->getResourceName();
$owner = $share->getOwnerDisplayName();
@@ -247,7 +246,7 @@ class CloudFederationProviderFiles implements ICloudFederationProvider {
} catch (\Exception $e) {
$this->logger->logException($e, [
'message' => 'Server can not add remote share.',
- 'level' => Util::ERROR,
+ 'level' => ILogger::ERROR,
'app' => 'files_sharing'
]);
throw new ProviderCouldNotAddShareException('internal server error, was not able to add share from ' . $remote, '', HTTP::STATUS_INTERNAL_SERVER_ERROR);
@@ -304,7 +303,7 @@ class CloudFederationProviderFiles implements ICloudFederationProvider {
* @throws BadRequestException
* @throws \OC\HintException
*/
- private function shareAccepted($id, $notification) {
+ private function shareAccepted($id, array $notification) {
if (!$this->isS2SEnabled()) {
throw new ActionNotSupportedException('Server does not support federated cloud sharing');
@@ -376,7 +375,7 @@ class CloudFederationProviderFiles implements ICloudFederationProvider {
* @throws \OC\HintException
*
*/
- protected function shareDeclined($id, $notification) {
+ protected function shareDeclined($id, array $notification) {
if (!$this->isS2SEnabled()) {
throw new ActionNotSupportedException('Server does not support federated cloud sharing');
@@ -446,12 +445,12 @@ class CloudFederationProviderFiles implements ICloudFederationProvider {
* received the notification that the owner unshared a file from you
*
* @param string $id
- * @param string $notification
+ * @param array $notification
* @return array
* @throws AuthenticationFailedException
* @throws BadRequestException
*/
- private function undoReshare($id, $notification) {
+ private function undoReshare($id, array $notification) {
if (!isset($notification['sharedSecret'])) {
throw new BadRequestException(['sharedSecret']);
}
@@ -550,15 +549,15 @@ class CloudFederationProviderFiles implements ICloudFederationProvider {
/**
* recipient of a share request to re-share the file with another user
*
- * @param $id
- * @param $notification
+ * @param string $id
+ * @param array $notification
* @return array
* @throws AuthenticationFailedException
* @throws BadRequestException
* @throws ProviderCouldNotAddShareException
* @throws ShareNotFound
*/
- protected function reshareRequested($id, $notification) {
+ protected function reshareRequested($id, array $notification) {
if (!isset($notification['sharedSecret'])) {
throw new BadRequestException(['sharedSecret']);
@@ -602,7 +601,6 @@ class CloudFederationProviderFiles implements ICloudFederationProvider {
throw new ProviderCouldNotAddShareException('resharing not allowed for share: ' . $id);
}
- throw new BadRequestException([]);
}
/**
@@ -615,7 +613,7 @@ class CloudFederationProviderFiles implements ICloudFederationProvider {
* @throws AuthenticationFailedException
* @throws BadRequestException
*/
- protected function updateResharePermissions($id, $notification) {
+ protected function updateResharePermissions($id, array $notification) {
if (!isset($notification['sharedSecret'])) {
throw new BadRequestException(['sharedSecret']);
@@ -640,12 +638,11 @@ class CloudFederationProviderFiles implements ICloudFederationProvider {
/**
* translate OCM Permissions to Nextcloud permissions
*
- * @param $ocmPermissions
+ * @param array $ocmPermissions
* @return int
* @throws BadRequestException
*/
- protected function ocmPermissions2ncPermissions($ocmPermissions) {
- error_log("ocm permissions: " . json_encode($ocmPermissions));
+ protected function ocmPermissions2ncPermissions(array $ocmPermissions) {
$ncPermissions = 0;
foreach($ocmPermissions as $permission) {
switch (strtolower($permission)) {
@@ -701,7 +698,7 @@ class CloudFederationProviderFiles implements ICloudFederationProvider {
$args = Filesystem::is_dir($file) ? array('dir' => $file) : array('dir' => dirname($file), 'scrollto' => $file);
$link = Util::linkToAbsolute('files', 'index.php', $args);
- return array($file, $link);
+ return [$file, $link];
}
diff --git a/lib/private/Federation/CloudFederationNotification.php b/lib/private/Federation/CloudFederationNotification.php
index fec69174a2f..62af67079e5 100644
--- a/lib/private/Federation/CloudFederationNotification.php
+++ b/lib/private/Federation/CloudFederationNotification.php
@@ -23,6 +23,13 @@ namespace OC\Federation;
use OCP\Federation\ICloudFederationNotification;
+/**
+ * Class CloudFederationNotification
+ *
+ * @package OC\Federation
+ *
+ * @since 14.0.0
+ */
class CloudFederationNotification implements ICloudFederationNotification {
private $message = [];
diff --git a/lib/private/Federation/CloudFederationProviderManager.php b/lib/private/Federation/CloudFederationProviderManager.php
index aa25ba9dee8..5c26afe13f8 100644
--- a/lib/private/Federation/CloudFederationProviderManager.php
+++ b/lib/private/Federation/CloudFederationProviderManager.php
@@ -200,7 +200,7 @@ class CloudFederationProviderManager implements ICloudFederationProviderManager
* @return bool
*/
public function isReady() {
- return $this->appManager->isEnabledForUser('cloud_federation_api', false);
+ return $this->appManager->isEnabledForUser('cloud_federation_api');
}
/**
* check if server supports the new OCM api and ask for the correct end-point
diff --git a/lib/public/Federation/Exceptions/ActionNotSupportedException.php b/lib/public/Federation/Exceptions/ActionNotSupportedException.php
index 7e7fe70f480..2d295bd9d8b 100644
--- a/lib/public/Federation/Exceptions/ActionNotSupportedException.php
+++ b/lib/public/Federation/Exceptions/ActionNotSupportedException.php
@@ -23,11 +23,20 @@ namespace OCP\Federation\Exceptions;
use OC\HintException;
+/**
+ * Class ActionNotSupportedException
+ *
+ * @package OCP\Federation\Exceptions
+ *
+ * @since 14.0.0
+ */
class ActionNotSupportedException extends HintException {
/**
* ActionNotSupportedException constructor.
*
+ * @since 14.0.0
+ *
*/
public function __construct($action) {
$l = \OC::$server->getL10N('federation');
diff --git a/lib/public/Federation/Exceptions/AuthenticationFailedException.php b/lib/public/Federation/Exceptions/AuthenticationFailedException.php
index a9a412dd835..1ea7ec5cd31 100644
--- a/lib/public/Federation/Exceptions/AuthenticationFailedException.php
+++ b/lib/public/Federation/Exceptions/AuthenticationFailedException.php
@@ -23,12 +23,20 @@ namespace OCP\Federation\Exceptions;
use OC\HintException;
+/**
+ * Class AuthenticationFailedException
+ *
+ * @package OCP\Federation\Exceptions
+ *
+ * @since 14.0.0
+ */
class AuthenticationFailedException extends HintException {
/**
* BadRequestException constructor.
*
- * @param array $missingParameters
+ * @since 14.0.0
+ *
*/
public function __construct() {
$l = \OC::$server->getL10N('federation');
diff --git a/lib/public/Federation/Exceptions/BadRequestException.php b/lib/public/Federation/Exceptions/BadRequestException.php
index 67cf911c2a0..9d9e48157a1 100644
--- a/lib/public/Federation/Exceptions/BadRequestException.php
+++ b/lib/public/Federation/Exceptions/BadRequestException.php
@@ -23,6 +23,13 @@ namespace OCP\Federation\Exceptions;
use OC\HintException;
+/**
+ * Class BadRequestException
+ *
+ * @package OCP\Federation\Exceptions
+ *
+ * @since 14.0.0
+ */
class BadRequestException extends HintException {
private $parameterList;
@@ -30,6 +37,8 @@ class BadRequestException extends HintException {
/**
* BadRequestException constructor.
*
+ * @since 14.0.0
+ *
* @param array $missingParameters
*/
public function __construct(array $missingParameters) {
@@ -44,6 +53,8 @@ class BadRequestException extends HintException {
/**
* get array with the return message as defined in the OCM API
*
+ * @since 14.0.0
+ *
* @return array
*/
public function getReturnMessage() {
diff --git a/lib/public/Federation/Exceptions/ProviderAlreadyExistsException.php b/lib/public/Federation/Exceptions/ProviderAlreadyExistsException.php
index f053a02fbea..e5022500d1c 100644
--- a/lib/public/Federation/Exceptions/ProviderAlreadyExistsException.php
+++ b/lib/public/Federation/Exceptions/ProviderAlreadyExistsException.php
@@ -23,11 +23,20 @@ namespace OCP\Federation\Exceptions;
use OC\HintException;
+/**
+ * Class ProviderAlreadyExistsException
+ *
+ * @package OCP\Federation\Exceptions
+ *
+ * @since 14.0.0
+ */
class ProviderAlreadyExistsException extends HintException {
/**
* ProviderAlreadyExistsException constructor.
*
+ * @since 14.0.0
+ *
* @param string $newProviderId cloud federation provider ID of the new provider
* @param string $existingProviderName name of cloud federation provider which already use the same ID
*/
diff --git a/lib/public/Federation/Exceptions/ProviderCouldNotAddShareException.php b/lib/public/Federation/Exceptions/ProviderCouldNotAddShareException.php
index 205206d5af8..80613cc29ac 100644
--- a/lib/public/Federation/Exceptions/ProviderCouldNotAddShareException.php
+++ b/lib/public/Federation/Exceptions/ProviderCouldNotAddShareException.php
@@ -24,8 +24,25 @@ namespace OCP\Federation\Exceptions;
use OC\HintException;
use OCP\AppFramework\Http;
+/**
+ * Class ProviderCouldNotAddShareException
+ *
+ * @package OCP\Federation\Exceptions
+ *
+ * @since 14.0.0
+ */
class ProviderCouldNotAddShareException extends HintException {
+ /**
+ * ProviderCouldNotAddShareException constructor.
+ *
+ * @since 14.0.0
+ *
+ * @param string $message
+ * @param string $hint
+ * @param int $code
+ * @param \Exception|null $previous
+ */
public function __construct($message, $hint = '', $code = Http::STATUS_BAD_REQUEST, \Exception $previous = null) {
parent::__construct($message, $hint, $code, $previous);
}
diff --git a/lib/public/Federation/Exceptions/ProviderDoesNotExistsException.php b/lib/public/Federation/Exceptions/ProviderDoesNotExistsException.php
index 8f760d6abf4..761fcaf809d 100644
--- a/lib/public/Federation/Exceptions/ProviderDoesNotExistsException.php
+++ b/lib/public/Federation/Exceptions/ProviderDoesNotExistsException.php
@@ -23,11 +23,20 @@ namespace OCP\Federation\Exceptions;
use OC\HintException;
+/**
+ * Class ProviderDoesNotExistsException
+ *
+ * @package OCP\Federation\Exceptions
+ *
+ * @since 14.0.0
+ */
class ProviderDoesNotExistsException extends HintException {
/**
* ProviderDoesNotExistsException constructor.
*
+ * @since 14.0.0
+ *
* @param string $providerId cloud federation provider ID
*/
public function __construct($providerId) {
diff --git a/lib/public/Federation/ICloudFederationFactory.php b/lib/public/Federation/ICloudFederationFactory.php
index 8c6925c2b61..5cb4dc3106a 100644
--- a/lib/public/Federation/ICloudFederationFactory.php
+++ b/lib/public/Federation/ICloudFederationFactory.php
@@ -21,6 +21,13 @@
namespace OCP\Federation;
+/**
+ * Interface ICloudFederationFactory
+ *
+ * @package OCP\Federation
+ *
+ * @since 14.0.0
+ */
interface ICloudFederationFactory {
/**
diff --git a/lib/public/Federation/ICloudFederationNotification.php b/lib/public/Federation/ICloudFederationNotification.php
index c68cd7b5e4d..c7ceb6d2399 100644
--- a/lib/public/Federation/ICloudFederationNotification.php
+++ b/lib/public/Federation/ICloudFederationNotification.php
@@ -21,6 +21,13 @@
namespace OCP\Federation;
+/**
+ * Interface ICloudFederationNotification
+ *
+ * @package OCP\Federation
+ *
+ * @since 14.0.0
+ */
interface ICloudFederationNotification {
/**
@@ -31,7 +38,6 @@ interface ICloudFederationNotification {
* @param $providerId id of the share
* @param array $notification , payload of the notification
*
- * @return
* @since 14.0.0
*/
public function setMessage($notificationType, $resourceType, $providerId, array $notification);
@@ -39,7 +45,7 @@ interface ICloudFederationNotification {
/**
* get message, ready to send out
*
- * @return string
+ * @return array
*
* @since 14.0.0
*/
diff --git a/lib/public/Federation/ICloudFederationShare.php b/lib/public/Federation/ICloudFederationShare.php
index b721ffb1681..fda934d9e8d 100644
--- a/lib/public/Federation/ICloudFederationShare.php
+++ b/lib/public/Federation/ICloudFederationShare.php
@@ -21,6 +21,13 @@
namespace OCP\Federation;
+/**
+ * Interface ICloudFederationShare
+ *
+ * @package OCP\Federation
+ *
+ * @since 14.0.0
+ */
interface ICloudFederationShare {
/**
diff --git a/lib/public/IServerContainer.php b/lib/public/IServerContainer.php
index ebe92274a49..639487660b6 100644
--- a/lib/public/IServerContainer.php
+++ b/lib/public/IServerContainer.php
@@ -557,6 +557,7 @@ interface IServerContainer extends IContainer {
/**
* @return \OCP\GlobalScale\IConfig
+ * @since 14.0.0
*/
public function getGlobalScaleConfig();