@@ -39,114 +39,114 @@ |
||
| 39 | 39 | |
| 40 | 40 | class Application extends App { |
| 41 | 41 | |
| 42 | - /** @var FederatedShareProvider */ |
|
| 43 | - protected $federatedShareProvider; |
|
| 42 | + /** @var FederatedShareProvider */ |
|
| 43 | + protected $federatedShareProvider; |
|
| 44 | 44 | |
| 45 | - public function __construct() { |
|
| 46 | - parent::__construct('federatedfilesharing'); |
|
| 45 | + public function __construct() { |
|
| 46 | + parent::__construct('federatedfilesharing'); |
|
| 47 | 47 | |
| 48 | - $container = $this->getContainer(); |
|
| 49 | - $server = $container->getServer(); |
|
| 48 | + $container = $this->getContainer(); |
|
| 49 | + $server = $container->getServer(); |
|
| 50 | 50 | |
| 51 | - $cloudFederationManager = $server->getCloudFederationProviderManager(); |
|
| 52 | - $cloudFederationManager->addCloudFederationProvider('file', |
|
| 53 | - 'Federated Files Sharing', |
|
| 54 | - function() use ($container) { |
|
| 55 | - $server = $container->getServer(); |
|
| 56 | - return new CloudFederationProviderFiles( |
|
| 57 | - $server->getAppManager(), |
|
| 58 | - $server->query(FederatedShareProvider::class), |
|
| 59 | - $server->query(AddressHandler::class), |
|
| 60 | - $server->getLogger(), |
|
| 61 | - $server->getUserManager(), |
|
| 62 | - $server->getCloudIdManager(), |
|
| 63 | - $server->getActivityManager(), |
|
| 64 | - $server->getNotificationManager(), |
|
| 65 | - $server->getURLGenerator(), |
|
| 66 | - $server->getCloudFederationFactory(), |
|
| 67 | - $server->getCloudFederationProviderManager(), |
|
| 68 | - $server->getDatabaseConnection() |
|
| 69 | - ); |
|
| 70 | - }); |
|
| 51 | + $cloudFederationManager = $server->getCloudFederationProviderManager(); |
|
| 52 | + $cloudFederationManager->addCloudFederationProvider('file', |
|
| 53 | + 'Federated Files Sharing', |
|
| 54 | + function() use ($container) { |
|
| 55 | + $server = $container->getServer(); |
|
| 56 | + return new CloudFederationProviderFiles( |
|
| 57 | + $server->getAppManager(), |
|
| 58 | + $server->query(FederatedShareProvider::class), |
|
| 59 | + $server->query(AddressHandler::class), |
|
| 60 | + $server->getLogger(), |
|
| 61 | + $server->getUserManager(), |
|
| 62 | + $server->getCloudIdManager(), |
|
| 63 | + $server->getActivityManager(), |
|
| 64 | + $server->getNotificationManager(), |
|
| 65 | + $server->getURLGenerator(), |
|
| 66 | + $server->getCloudFederationFactory(), |
|
| 67 | + $server->getCloudFederationProviderManager(), |
|
| 68 | + $server->getDatabaseConnection() |
|
| 69 | + ); |
|
| 70 | + }); |
|
| 71 | 71 | |
| 72 | - $container->registerService('RequestHandlerController', function(SimpleContainer $c) use ($server) { |
|
| 73 | - $addressHandler = new AddressHandler( |
|
| 74 | - $server->getURLGenerator(), |
|
| 75 | - $server->getL10N('federatedfilesharing'), |
|
| 76 | - $server->getCloudIdManager() |
|
| 77 | - ); |
|
| 78 | - $notification = new Notifications( |
|
| 79 | - $addressHandler, |
|
| 80 | - $server->getHTTPClientService(), |
|
| 81 | - $server->query(\OCP\OCS\IDiscoveryService::class), |
|
| 82 | - \OC::$server->getJobList(), |
|
| 83 | - \OC::$server->getCloudFederationProviderManager(), |
|
| 84 | - \OC::$server->getCloudFederationFactory() |
|
| 85 | - ); |
|
| 86 | - return new RequestHandlerController( |
|
| 87 | - $c->query('AppName'), |
|
| 88 | - $server->getRequest(), |
|
| 89 | - $this->getFederatedShareProvider(), |
|
| 90 | - $server->getDatabaseConnection(), |
|
| 91 | - $server->getShareManager(), |
|
| 92 | - $notification, |
|
| 93 | - $addressHandler, |
|
| 94 | - $server->getUserManager(), |
|
| 95 | - $server->getCloudIdManager(), |
|
| 96 | - $server->getLogger(), |
|
| 97 | - $server->getCloudFederationFactory(), |
|
| 98 | - $server->getCloudFederationProviderManager() |
|
| 99 | - ); |
|
| 100 | - }); |
|
| 101 | - } |
|
| 72 | + $container->registerService('RequestHandlerController', function(SimpleContainer $c) use ($server) { |
|
| 73 | + $addressHandler = new AddressHandler( |
|
| 74 | + $server->getURLGenerator(), |
|
| 75 | + $server->getL10N('federatedfilesharing'), |
|
| 76 | + $server->getCloudIdManager() |
|
| 77 | + ); |
|
| 78 | + $notification = new Notifications( |
|
| 79 | + $addressHandler, |
|
| 80 | + $server->getHTTPClientService(), |
|
| 81 | + $server->query(\OCP\OCS\IDiscoveryService::class), |
|
| 82 | + \OC::$server->getJobList(), |
|
| 83 | + \OC::$server->getCloudFederationProviderManager(), |
|
| 84 | + \OC::$server->getCloudFederationFactory() |
|
| 85 | + ); |
|
| 86 | + return new RequestHandlerController( |
|
| 87 | + $c->query('AppName'), |
|
| 88 | + $server->getRequest(), |
|
| 89 | + $this->getFederatedShareProvider(), |
|
| 90 | + $server->getDatabaseConnection(), |
|
| 91 | + $server->getShareManager(), |
|
| 92 | + $notification, |
|
| 93 | + $addressHandler, |
|
| 94 | + $server->getUserManager(), |
|
| 95 | + $server->getCloudIdManager(), |
|
| 96 | + $server->getLogger(), |
|
| 97 | + $server->getCloudFederationFactory(), |
|
| 98 | + $server->getCloudFederationProviderManager() |
|
| 99 | + ); |
|
| 100 | + }); |
|
| 101 | + } |
|
| 102 | 102 | |
| 103 | - /** |
|
| 104 | - * get instance of federated share provider |
|
| 105 | - * |
|
| 106 | - * @return FederatedShareProvider |
|
| 107 | - */ |
|
| 108 | - public function getFederatedShareProvider() { |
|
| 109 | - if ($this->federatedShareProvider === null) { |
|
| 110 | - $this->initFederatedShareProvider(); |
|
| 111 | - } |
|
| 112 | - return $this->federatedShareProvider; |
|
| 113 | - } |
|
| 103 | + /** |
|
| 104 | + * get instance of federated share provider |
|
| 105 | + * |
|
| 106 | + * @return FederatedShareProvider |
|
| 107 | + */ |
|
| 108 | + public function getFederatedShareProvider() { |
|
| 109 | + if ($this->federatedShareProvider === null) { |
|
| 110 | + $this->initFederatedShareProvider(); |
|
| 111 | + } |
|
| 112 | + return $this->federatedShareProvider; |
|
| 113 | + } |
|
| 114 | 114 | |
| 115 | - /** |
|
| 116 | - * initialize federated share provider |
|
| 117 | - */ |
|
| 118 | - protected function initFederatedShareProvider() { |
|
| 119 | - $c = $this->getContainer(); |
|
| 120 | - $addressHandler = new \OCA\FederatedFileSharing\AddressHandler( |
|
| 121 | - \OC::$server->getURLGenerator(), |
|
| 122 | - \OC::$server->getL10N('federatedfilesharing'), |
|
| 123 | - \OC::$server->getCloudIdManager() |
|
| 124 | - ); |
|
| 125 | - $notifications = new \OCA\FederatedFileSharing\Notifications( |
|
| 126 | - $addressHandler, |
|
| 127 | - \OC::$server->getHTTPClientService(), |
|
| 128 | - \OC::$server->query(\OCP\OCS\IDiscoveryService::class), |
|
| 129 | - \OC::$server->getJobList(), |
|
| 130 | - \OC::$server->getCloudFederationProviderManager(), |
|
| 131 | - \OC::$server->getCloudFederationFactory() |
|
| 132 | - ); |
|
| 133 | - $tokenHandler = new \OCA\FederatedFileSharing\TokenHandler( |
|
| 134 | - \OC::$server->getSecureRandom() |
|
| 135 | - ); |
|
| 115 | + /** |
|
| 116 | + * initialize federated share provider |
|
| 117 | + */ |
|
| 118 | + protected function initFederatedShareProvider() { |
|
| 119 | + $c = $this->getContainer(); |
|
| 120 | + $addressHandler = new \OCA\FederatedFileSharing\AddressHandler( |
|
| 121 | + \OC::$server->getURLGenerator(), |
|
| 122 | + \OC::$server->getL10N('federatedfilesharing'), |
|
| 123 | + \OC::$server->getCloudIdManager() |
|
| 124 | + ); |
|
| 125 | + $notifications = new \OCA\FederatedFileSharing\Notifications( |
|
| 126 | + $addressHandler, |
|
| 127 | + \OC::$server->getHTTPClientService(), |
|
| 128 | + \OC::$server->query(\OCP\OCS\IDiscoveryService::class), |
|
| 129 | + \OC::$server->getJobList(), |
|
| 130 | + \OC::$server->getCloudFederationProviderManager(), |
|
| 131 | + \OC::$server->getCloudFederationFactory() |
|
| 132 | + ); |
|
| 133 | + $tokenHandler = new \OCA\FederatedFileSharing\TokenHandler( |
|
| 134 | + \OC::$server->getSecureRandom() |
|
| 135 | + ); |
|
| 136 | 136 | |
| 137 | - $this->federatedShareProvider = new \OCA\FederatedFileSharing\FederatedShareProvider( |
|
| 138 | - \OC::$server->getDatabaseConnection(), |
|
| 139 | - $addressHandler, |
|
| 140 | - $notifications, |
|
| 141 | - $tokenHandler, |
|
| 142 | - \OC::$server->getL10N('federatedfilesharing'), |
|
| 143 | - \OC::$server->getLogger(), |
|
| 144 | - \OC::$server->getLazyRootFolder(), |
|
| 145 | - \OC::$server->getConfig(), |
|
| 146 | - \OC::$server->getUserManager(), |
|
| 147 | - \OC::$server->getCloudIdManager(), |
|
| 148 | - $c->query(IConfig::class) |
|
| 149 | - ); |
|
| 150 | - } |
|
| 137 | + $this->federatedShareProvider = new \OCA\FederatedFileSharing\FederatedShareProvider( |
|
| 138 | + \OC::$server->getDatabaseConnection(), |
|
| 139 | + $addressHandler, |
|
| 140 | + $notifications, |
|
| 141 | + $tokenHandler, |
|
| 142 | + \OC::$server->getL10N('federatedfilesharing'), |
|
| 143 | + \OC::$server->getLogger(), |
|
| 144 | + \OC::$server->getLazyRootFolder(), |
|
| 145 | + \OC::$server->getConfig(), |
|
| 146 | + \OC::$server->getUserManager(), |
|
| 147 | + \OC::$server->getCloudIdManager(), |
|
| 148 | + $c->query(IConfig::class) |
|
| 149 | + ); |
|
| 150 | + } |
|
| 151 | 151 | |
| 152 | 152 | } |
@@ -32,36 +32,36 @@ |
||
| 32 | 32 | */ |
| 33 | 33 | class CloudFederationNotification implements ICloudFederationNotification { |
| 34 | 34 | |
| 35 | - private $message = []; |
|
| 35 | + private $message = []; |
|
| 36 | 36 | |
| 37 | - /** |
|
| 38 | - * add a message to the notification |
|
| 39 | - * |
|
| 40 | - * @param string $notificationType (e.g. SHARE_ACCEPTED) |
|
| 41 | - * @param string $resourceType (e.g. file, calendar, contact,...) |
|
| 42 | - * @param string $providerId id of the share |
|
| 43 | - * @param array $notification payload of the notification |
|
| 44 | - * |
|
| 45 | - * @since 14.0.0 |
|
| 46 | - */ |
|
| 47 | - public function setMessage($notificationType, $resourceType, $providerId, array $notification) { |
|
| 48 | - $this->message = [ |
|
| 49 | - 'notificationType' => $notificationType, |
|
| 50 | - 'resourceType' => $resourceType, |
|
| 51 | - 'providerId' => $providerId, |
|
| 52 | - 'notification' => $notification, |
|
| 53 | - ]; |
|
| 37 | + /** |
|
| 38 | + * add a message to the notification |
|
| 39 | + * |
|
| 40 | + * @param string $notificationType (e.g. SHARE_ACCEPTED) |
|
| 41 | + * @param string $resourceType (e.g. file, calendar, contact,...) |
|
| 42 | + * @param string $providerId id of the share |
|
| 43 | + * @param array $notification payload of the notification |
|
| 44 | + * |
|
| 45 | + * @since 14.0.0 |
|
| 46 | + */ |
|
| 47 | + public function setMessage($notificationType, $resourceType, $providerId, array $notification) { |
|
| 48 | + $this->message = [ |
|
| 49 | + 'notificationType' => $notificationType, |
|
| 50 | + 'resourceType' => $resourceType, |
|
| 51 | + 'providerId' => $providerId, |
|
| 52 | + 'notification' => $notification, |
|
| 53 | + ]; |
|
| 54 | 54 | |
| 55 | - } |
|
| 55 | + } |
|
| 56 | 56 | |
| 57 | - /** |
|
| 58 | - * get message, ready to send out |
|
| 59 | - * |
|
| 60 | - * @return array |
|
| 61 | - * |
|
| 62 | - * @since 14.0.0 |
|
| 63 | - */ |
|
| 64 | - public function getMessage() { |
|
| 65 | - return $this->message; |
|
| 66 | - } |
|
| 57 | + /** |
|
| 58 | + * get message, ready to send out |
|
| 59 | + * |
|
| 60 | + * @return array |
|
| 61 | + * |
|
| 62 | + * @since 14.0.0 |
|
| 63 | + */ |
|
| 64 | + public function getMessage() { |
|
| 65 | + return $this->message; |
|
| 66 | + } |
|
| 67 | 67 | } |
@@ -30,24 +30,24 @@ |
||
| 30 | 30 | */ |
| 31 | 31 | interface ICloudFederationNotification { |
| 32 | 32 | |
| 33 | - /** |
|
| 34 | - * add a message to the notification |
|
| 35 | - * |
|
| 36 | - * @param string $notificationType (e.g. SHARE_ACCEPTED) |
|
| 37 | - * @param string $resourceType (e.g. file, calendar, contact,...) |
|
| 38 | - * @param $providerId id of the share |
|
| 39 | - * @param array $notification , payload of the notification |
|
| 40 | - * |
|
| 41 | - * @since 14.0.0 |
|
| 42 | - */ |
|
| 43 | - public function setMessage($notificationType, $resourceType, $providerId, array $notification); |
|
| 33 | + /** |
|
| 34 | + * add a message to the notification |
|
| 35 | + * |
|
| 36 | + * @param string $notificationType (e.g. SHARE_ACCEPTED) |
|
| 37 | + * @param string $resourceType (e.g. file, calendar, contact,...) |
|
| 38 | + * @param $providerId id of the share |
|
| 39 | + * @param array $notification , payload of the notification |
|
| 40 | + * |
|
| 41 | + * @since 14.0.0 |
|
| 42 | + */ |
|
| 43 | + public function setMessage($notificationType, $resourceType, $providerId, array $notification); |
|
| 44 | 44 | |
| 45 | - /** |
|
| 46 | - * get message, ready to send out |
|
| 47 | - * |
|
| 48 | - * @return array |
|
| 49 | - * |
|
| 50 | - * @since 14.0.0 |
|
| 51 | - */ |
|
| 52 | - public function getMessage(); |
|
| 45 | + /** |
|
| 46 | + * get message, ready to send out |
|
| 47 | + * |
|
| 48 | + * @return array |
|
| 49 | + * |
|
| 50 | + * @since 14.0.0 |
|
| 51 | + */ |
|
| 52 | + public function getMessage(); |
|
| 53 | 53 | } |
@@ -30,221 +30,221 @@ |
||
| 30 | 30 | */ |
| 31 | 31 | interface ICloudFederationShare { |
| 32 | 32 | |
| 33 | - /** |
|
| 34 | - * set uid of the recipient |
|
| 35 | - * |
|
| 36 | - * @param string $user |
|
| 37 | - * |
|
| 38 | - * @since 14.0.0 |
|
| 39 | - */ |
|
| 40 | - public function setShareWith($user); |
|
| 41 | - |
|
| 42 | - /** |
|
| 43 | - * set resource name (e.g. file, calendar, contact,...) |
|
| 44 | - * |
|
| 45 | - * @param string $name |
|
| 46 | - * |
|
| 47 | - * @since 14.0.0 |
|
| 48 | - */ |
|
| 49 | - public function setResourceName($name); |
|
| 50 | - |
|
| 51 | - /** |
|
| 52 | - * set resource type (e.g. file, calendar, contact,...) |
|
| 53 | - * |
|
| 54 | - * @param string $resourceType |
|
| 55 | - * |
|
| 56 | - * @since 14.0.0 |
|
| 57 | - */ |
|
| 58 | - public function setResourceType($resourceType); |
|
| 59 | - |
|
| 60 | - /** |
|
| 61 | - * set resource description (optional) |
|
| 62 | - * |
|
| 63 | - * @param string $description |
|
| 64 | - * |
|
| 65 | - * @since 14.0.0 |
|
| 66 | - */ |
|
| 67 | - public function setDescription($description); |
|
| 68 | - |
|
| 69 | - /** |
|
| 70 | - * set provider ID (e.g. file ID) |
|
| 71 | - * |
|
| 72 | - * @param string $providerId |
|
| 73 | - * |
|
| 74 | - * @since 14.0.0 |
|
| 75 | - */ |
|
| 76 | - public function setProviderId($providerId); |
|
| 77 | - |
|
| 78 | - /** |
|
| 79 | - * set owner UID |
|
| 80 | - * |
|
| 81 | - * @param string $owner |
|
| 82 | - * |
|
| 83 | - * @since 14.0.0 |
|
| 84 | - */ |
|
| 85 | - public function setOwner($owner); |
|
| 86 | - |
|
| 87 | - /** |
|
| 88 | - * set owner display name |
|
| 89 | - * |
|
| 90 | - * @param string $ownerDisplayName |
|
| 91 | - * |
|
| 92 | - * @since 14.0.0 |
|
| 93 | - */ |
|
| 94 | - public function setOwnerDisplayName($ownerDisplayName); |
|
| 95 | - |
|
| 96 | - /** |
|
| 97 | - * set UID of the user who sends the share |
|
| 98 | - * |
|
| 99 | - * @param string $sharedBy |
|
| 100 | - * |
|
| 101 | - * @since 14.0.0 |
|
| 102 | - */ |
|
| 103 | - public function setSharedBy($sharedBy); |
|
| 104 | - |
|
| 105 | - /** |
|
| 106 | - * set display name of the user who sends the share |
|
| 107 | - * |
|
| 108 | - * @param $sharedByDisplayName |
|
| 109 | - * |
|
| 110 | - * @since 14.0.0 |
|
| 111 | - */ |
|
| 112 | - public function setSharedByDisplayName($sharedByDisplayName); |
|
| 113 | - |
|
| 114 | - /** |
|
| 115 | - * set protocol specification |
|
| 116 | - * |
|
| 117 | - * @param array $protocol |
|
| 118 | - * |
|
| 119 | - * @since 14.0.0 |
|
| 120 | - */ |
|
| 121 | - public function setProtocol(array $protocol); |
|
| 122 | - |
|
| 123 | - /** |
|
| 124 | - * share type (group or user) |
|
| 125 | - * |
|
| 126 | - * @param string $shareType |
|
| 127 | - * |
|
| 128 | - * @since 14.0.0 |
|
| 129 | - */ |
|
| 130 | - public function setShareType($shareType); |
|
| 131 | - |
|
| 132 | - /** |
|
| 133 | - * get the whole share, ready to send out |
|
| 134 | - * |
|
| 135 | - * @return array |
|
| 136 | - * |
|
| 137 | - * @since 14.0.0 |
|
| 138 | - */ |
|
| 139 | - public function getShare(); |
|
| 140 | - |
|
| 141 | - /** |
|
| 142 | - * get uid of the recipient |
|
| 143 | - * |
|
| 144 | - * @return string |
|
| 145 | - * |
|
| 146 | - * @since 14.0.0 |
|
| 147 | - */ |
|
| 148 | - public function getShareWith(); |
|
| 149 | - |
|
| 150 | - /** |
|
| 151 | - * get resource name (e.g. file, calendar, contact,...) |
|
| 152 | - * |
|
| 153 | - * @return string |
|
| 154 | - * |
|
| 155 | - * @since 14.0.0 |
|
| 156 | - */ |
|
| 157 | - public function getResourceName(); |
|
| 158 | - |
|
| 159 | - /** |
|
| 160 | - * get resource type (e.g. file, calendar, contact,...) |
|
| 161 | - * |
|
| 162 | - * @return string |
|
| 163 | - * |
|
| 164 | - * @since 14.0.0 |
|
| 165 | - */ |
|
| 166 | - public function getResourceType(); |
|
| 167 | - |
|
| 168 | - /** |
|
| 169 | - * get resource description (optional) |
|
| 170 | - * |
|
| 171 | - * @return string |
|
| 172 | - * |
|
| 173 | - * @since 14.0.0 |
|
| 174 | - */ |
|
| 175 | - public function getDescription(); |
|
| 176 | - |
|
| 177 | - /** |
|
| 178 | - * get provider ID (e.g. file ID) |
|
| 179 | - * |
|
| 180 | - * @return string |
|
| 181 | - * |
|
| 182 | - * @since 14.0.0 |
|
| 183 | - */ |
|
| 184 | - public function getProviderId(); |
|
| 185 | - |
|
| 186 | - /** |
|
| 187 | - * get owner UID |
|
| 188 | - * |
|
| 189 | - * @return string |
|
| 190 | - * |
|
| 191 | - * @since 14.0.0 |
|
| 192 | - */ |
|
| 193 | - public function getOwner(); |
|
| 194 | - |
|
| 195 | - /** |
|
| 196 | - * get owner display name |
|
| 197 | - * |
|
| 198 | - * @return string |
|
| 199 | - * |
|
| 200 | - * @since 14.0.0 |
|
| 201 | - */ |
|
| 202 | - public function getOwnerDisplayName(); |
|
| 203 | - |
|
| 204 | - /** |
|
| 205 | - * get UID of the user who sends the share |
|
| 206 | - * |
|
| 207 | - * @return string |
|
| 208 | - * |
|
| 209 | - * @since 14.0.0 |
|
| 210 | - */ |
|
| 211 | - public function getSharedBy(); |
|
| 212 | - |
|
| 213 | - /** |
|
| 214 | - * get display name of the user who sends the share |
|
| 215 | - * |
|
| 216 | - * @return string |
|
| 217 | - * |
|
| 218 | - * @since 14.0.0 |
|
| 219 | - */ |
|
| 220 | - public function getSharedByDisplayName(); |
|
| 221 | - |
|
| 222 | - /** |
|
| 223 | - * get share type (group or user) |
|
| 224 | - * |
|
| 225 | - * @return string |
|
| 226 | - * |
|
| 227 | - * @since 14.0.0 |
|
| 228 | - */ |
|
| 229 | - public function getShareType(); |
|
| 230 | - |
|
| 231 | - /** |
|
| 232 | - * get share Secret |
|
| 233 | - * |
|
| 234 | - * @return string |
|
| 235 | - * |
|
| 236 | - * @since 14.0.0 |
|
| 237 | - */ |
|
| 238 | - public function getShareSecret(); |
|
| 239 | - |
|
| 240 | - |
|
| 241 | - /** |
|
| 242 | - * get protocol specification |
|
| 243 | - * |
|
| 244 | - * @return array |
|
| 245 | - * |
|
| 246 | - * @since 14.0.0 |
|
| 247 | - */ |
|
| 248 | - public function getProtocol(); |
|
| 33 | + /** |
|
| 34 | + * set uid of the recipient |
|
| 35 | + * |
|
| 36 | + * @param string $user |
|
| 37 | + * |
|
| 38 | + * @since 14.0.0 |
|
| 39 | + */ |
|
| 40 | + public function setShareWith($user); |
|
| 41 | + |
|
| 42 | + /** |
|
| 43 | + * set resource name (e.g. file, calendar, contact,...) |
|
| 44 | + * |
|
| 45 | + * @param string $name |
|
| 46 | + * |
|
| 47 | + * @since 14.0.0 |
|
| 48 | + */ |
|
| 49 | + public function setResourceName($name); |
|
| 50 | + |
|
| 51 | + /** |
|
| 52 | + * set resource type (e.g. file, calendar, contact,...) |
|
| 53 | + * |
|
| 54 | + * @param string $resourceType |
|
| 55 | + * |
|
| 56 | + * @since 14.0.0 |
|
| 57 | + */ |
|
| 58 | + public function setResourceType($resourceType); |
|
| 59 | + |
|
| 60 | + /** |
|
| 61 | + * set resource description (optional) |
|
| 62 | + * |
|
| 63 | + * @param string $description |
|
| 64 | + * |
|
| 65 | + * @since 14.0.0 |
|
| 66 | + */ |
|
| 67 | + public function setDescription($description); |
|
| 68 | + |
|
| 69 | + /** |
|
| 70 | + * set provider ID (e.g. file ID) |
|
| 71 | + * |
|
| 72 | + * @param string $providerId |
|
| 73 | + * |
|
| 74 | + * @since 14.0.0 |
|
| 75 | + */ |
|
| 76 | + public function setProviderId($providerId); |
|
| 77 | + |
|
| 78 | + /** |
|
| 79 | + * set owner UID |
|
| 80 | + * |
|
| 81 | + * @param string $owner |
|
| 82 | + * |
|
| 83 | + * @since 14.0.0 |
|
| 84 | + */ |
|
| 85 | + public function setOwner($owner); |
|
| 86 | + |
|
| 87 | + /** |
|
| 88 | + * set owner display name |
|
| 89 | + * |
|
| 90 | + * @param string $ownerDisplayName |
|
| 91 | + * |
|
| 92 | + * @since 14.0.0 |
|
| 93 | + */ |
|
| 94 | + public function setOwnerDisplayName($ownerDisplayName); |
|
| 95 | + |
|
| 96 | + /** |
|
| 97 | + * set UID of the user who sends the share |
|
| 98 | + * |
|
| 99 | + * @param string $sharedBy |
|
| 100 | + * |
|
| 101 | + * @since 14.0.0 |
|
| 102 | + */ |
|
| 103 | + public function setSharedBy($sharedBy); |
|
| 104 | + |
|
| 105 | + /** |
|
| 106 | + * set display name of the user who sends the share |
|
| 107 | + * |
|
| 108 | + * @param $sharedByDisplayName |
|
| 109 | + * |
|
| 110 | + * @since 14.0.0 |
|
| 111 | + */ |
|
| 112 | + public function setSharedByDisplayName($sharedByDisplayName); |
|
| 113 | + |
|
| 114 | + /** |
|
| 115 | + * set protocol specification |
|
| 116 | + * |
|
| 117 | + * @param array $protocol |
|
| 118 | + * |
|
| 119 | + * @since 14.0.0 |
|
| 120 | + */ |
|
| 121 | + public function setProtocol(array $protocol); |
|
| 122 | + |
|
| 123 | + /** |
|
| 124 | + * share type (group or user) |
|
| 125 | + * |
|
| 126 | + * @param string $shareType |
|
| 127 | + * |
|
| 128 | + * @since 14.0.0 |
|
| 129 | + */ |
|
| 130 | + public function setShareType($shareType); |
|
| 131 | + |
|
| 132 | + /** |
|
| 133 | + * get the whole share, ready to send out |
|
| 134 | + * |
|
| 135 | + * @return array |
|
| 136 | + * |
|
| 137 | + * @since 14.0.0 |
|
| 138 | + */ |
|
| 139 | + public function getShare(); |
|
| 140 | + |
|
| 141 | + /** |
|
| 142 | + * get uid of the recipient |
|
| 143 | + * |
|
| 144 | + * @return string |
|
| 145 | + * |
|
| 146 | + * @since 14.0.0 |
|
| 147 | + */ |
|
| 148 | + public function getShareWith(); |
|
| 149 | + |
|
| 150 | + /** |
|
| 151 | + * get resource name (e.g. file, calendar, contact,...) |
|
| 152 | + * |
|
| 153 | + * @return string |
|
| 154 | + * |
|
| 155 | + * @since 14.0.0 |
|
| 156 | + */ |
|
| 157 | + public function getResourceName(); |
|
| 158 | + |
|
| 159 | + /** |
|
| 160 | + * get resource type (e.g. file, calendar, contact,...) |
|
| 161 | + * |
|
| 162 | + * @return string |
|
| 163 | + * |
|
| 164 | + * @since 14.0.0 |
|
| 165 | + */ |
|
| 166 | + public function getResourceType(); |
|
| 167 | + |
|
| 168 | + /** |
|
| 169 | + * get resource description (optional) |
|
| 170 | + * |
|
| 171 | + * @return string |
|
| 172 | + * |
|
| 173 | + * @since 14.0.0 |
|
| 174 | + */ |
|
| 175 | + public function getDescription(); |
|
| 176 | + |
|
| 177 | + /** |
|
| 178 | + * get provider ID (e.g. file ID) |
|
| 179 | + * |
|
| 180 | + * @return string |
|
| 181 | + * |
|
| 182 | + * @since 14.0.0 |
|
| 183 | + */ |
|
| 184 | + public function getProviderId(); |
|
| 185 | + |
|
| 186 | + /** |
|
| 187 | + * get owner UID |
|
| 188 | + * |
|
| 189 | + * @return string |
|
| 190 | + * |
|
| 191 | + * @since 14.0.0 |
|
| 192 | + */ |
|
| 193 | + public function getOwner(); |
|
| 194 | + |
|
| 195 | + /** |
|
| 196 | + * get owner display name |
|
| 197 | + * |
|
| 198 | + * @return string |
|
| 199 | + * |
|
| 200 | + * @since 14.0.0 |
|
| 201 | + */ |
|
| 202 | + public function getOwnerDisplayName(); |
|
| 203 | + |
|
| 204 | + /** |
|
| 205 | + * get UID of the user who sends the share |
|
| 206 | + * |
|
| 207 | + * @return string |
|
| 208 | + * |
|
| 209 | + * @since 14.0.0 |
|
| 210 | + */ |
|
| 211 | + public function getSharedBy(); |
|
| 212 | + |
|
| 213 | + /** |
|
| 214 | + * get display name of the user who sends the share |
|
| 215 | + * |
|
| 216 | + * @return string |
|
| 217 | + * |
|
| 218 | + * @since 14.0.0 |
|
| 219 | + */ |
|
| 220 | + public function getSharedByDisplayName(); |
|
| 221 | + |
|
| 222 | + /** |
|
| 223 | + * get share type (group or user) |
|
| 224 | + * |
|
| 225 | + * @return string |
|
| 226 | + * |
|
| 227 | + * @since 14.0.0 |
|
| 228 | + */ |
|
| 229 | + public function getShareType(); |
|
| 230 | + |
|
| 231 | + /** |
|
| 232 | + * get share Secret |
|
| 233 | + * |
|
| 234 | + * @return string |
|
| 235 | + * |
|
| 236 | + * @since 14.0.0 |
|
| 237 | + */ |
|
| 238 | + public function getShareSecret(); |
|
| 239 | + |
|
| 240 | + |
|
| 241 | + /** |
|
| 242 | + * get protocol specification |
|
| 243 | + * |
|
| 244 | + * @return array |
|
| 245 | + * |
|
| 246 | + * @since 14.0.0 |
|
| 247 | + */ |
|
| 248 | + public function getProtocol(); |
|
| 249 | 249 | |
| 250 | 250 | } |
@@ -32,19 +32,19 @@ |
||
| 32 | 32 | */ |
| 33 | 33 | class ProviderAlreadyExistsException extends HintException { |
| 34 | 34 | |
| 35 | - /** |
|
| 36 | - * ProviderAlreadyExistsException constructor. |
|
| 37 | - * |
|
| 38 | - * @since 14.0.0 |
|
| 39 | - * |
|
| 40 | - * @param string $newProviderId cloud federation provider ID of the new provider |
|
| 41 | - * @param string $existingProviderName name of cloud federation provider which already use the same ID |
|
| 42 | - */ |
|
| 43 | - public function __construct($newProviderId, $existingProviderName) { |
|
| 44 | - $l = \OC::$server->getL10N('federation'); |
|
| 45 | - $message = 'Id "' . $newProviderId . '" already used by cloud federation provider "' . $existingProviderName . '"'; |
|
| 46 | - $hint = $l->t('Id "%s" already used by cloud federation provider "%s"', [$newProviderId, $existingProviderName]); |
|
| 47 | - parent::__construct($message, $hint); |
|
| 48 | - } |
|
| 35 | + /** |
|
| 36 | + * ProviderAlreadyExistsException constructor. |
|
| 37 | + * |
|
| 38 | + * @since 14.0.0 |
|
| 39 | + * |
|
| 40 | + * @param string $newProviderId cloud federation provider ID of the new provider |
|
| 41 | + * @param string $existingProviderName name of cloud federation provider which already use the same ID |
|
| 42 | + */ |
|
| 43 | + public function __construct($newProviderId, $existingProviderName) { |
|
| 44 | + $l = \OC::$server->getL10N('federation'); |
|
| 45 | + $message = 'Id "' . $newProviderId . '" already used by cloud federation provider "' . $existingProviderName . '"'; |
|
| 46 | + $hint = $l->t('Id "%s" already used by cloud federation provider "%s"', [$newProviderId, $existingProviderName]); |
|
| 47 | + parent::__construct($message, $hint); |
|
| 48 | + } |
|
| 49 | 49 | |
| 50 | 50 | } |
@@ -32,46 +32,46 @@ |
||
| 32 | 32 | */ |
| 33 | 33 | class BadRequestException extends HintException { |
| 34 | 34 | |
| 35 | - private $parameterList; |
|
| 35 | + private $parameterList; |
|
| 36 | 36 | |
| 37 | - /** |
|
| 38 | - * BadRequestException constructor. |
|
| 39 | - * |
|
| 40 | - * @since 14.0.0 |
|
| 41 | - * |
|
| 42 | - * @param array $missingParameters |
|
| 43 | - */ |
|
| 44 | - public function __construct(array $missingParameters) { |
|
| 45 | - $l = \OC::$server->getL10N('federation'); |
|
| 46 | - $this->parameterList = $missingParameters; |
|
| 47 | - $parameterList = implode(',', $missingParameters); |
|
| 48 | - $message = 'Parameters missing in order to complete the request. Missing Parameters: ' . $parameterList; |
|
| 49 | - $hint = $l->t('Parameters missing in order to complete the request. Missing Parameters: "%s"', [$parameterList]); |
|
| 50 | - parent::__construct($message, $hint); |
|
| 51 | - } |
|
| 37 | + /** |
|
| 38 | + * BadRequestException constructor. |
|
| 39 | + * |
|
| 40 | + * @since 14.0.0 |
|
| 41 | + * |
|
| 42 | + * @param array $missingParameters |
|
| 43 | + */ |
|
| 44 | + public function __construct(array $missingParameters) { |
|
| 45 | + $l = \OC::$server->getL10N('federation'); |
|
| 46 | + $this->parameterList = $missingParameters; |
|
| 47 | + $parameterList = implode(',', $missingParameters); |
|
| 48 | + $message = 'Parameters missing in order to complete the request. Missing Parameters: ' . $parameterList; |
|
| 49 | + $hint = $l->t('Parameters missing in order to complete the request. Missing Parameters: "%s"', [$parameterList]); |
|
| 50 | + parent::__construct($message, $hint); |
|
| 51 | + } |
|
| 52 | 52 | |
| 53 | - /** |
|
| 54 | - * get array with the return message as defined in the OCM API |
|
| 55 | - * |
|
| 56 | - * @since 14.0.0 |
|
| 57 | - * |
|
| 58 | - * @return array |
|
| 59 | - */ |
|
| 60 | - public function getReturnMessage() { |
|
| 61 | - $result = [ |
|
| 62 | - 'message' => 'RESOURCE_NOT_FOUND', |
|
| 63 | - 'validationErrors' =>[ |
|
| 64 | - ] |
|
| 65 | - ]; |
|
| 53 | + /** |
|
| 54 | + * get array with the return message as defined in the OCM API |
|
| 55 | + * |
|
| 56 | + * @since 14.0.0 |
|
| 57 | + * |
|
| 58 | + * @return array |
|
| 59 | + */ |
|
| 60 | + public function getReturnMessage() { |
|
| 61 | + $result = [ |
|
| 62 | + 'message' => 'RESOURCE_NOT_FOUND', |
|
| 63 | + 'validationErrors' =>[ |
|
| 64 | + ] |
|
| 65 | + ]; |
|
| 66 | 66 | |
| 67 | - foreach ($this->parameterList as $missingParameter) { |
|
| 68 | - $result['validationErrors'] = [ |
|
| 69 | - 'name' => $missingParameter, |
|
| 70 | - 'message' => 'NOT_FOUND' |
|
| 71 | - ]; |
|
| 72 | - } |
|
| 67 | + foreach ($this->parameterList as $missingParameter) { |
|
| 68 | + $result['validationErrors'] = [ |
|
| 69 | + 'name' => $missingParameter, |
|
| 70 | + 'message' => 'NOT_FOUND' |
|
| 71 | + ]; |
|
| 72 | + } |
|
| 73 | 73 | |
| 74 | - return $result; |
|
| 75 | - } |
|
| 74 | + return $result; |
|
| 75 | + } |
|
| 76 | 76 | |
| 77 | 77 | } |
@@ -33,19 +33,19 @@ |
||
| 33 | 33 | */ |
| 34 | 34 | class ProviderCouldNotAddShareException extends HintException { |
| 35 | 35 | |
| 36 | - /** |
|
| 37 | - * ProviderCouldNotAddShareException constructor. |
|
| 38 | - * |
|
| 39 | - * @since 14.0.0 |
|
| 40 | - * |
|
| 41 | - * @param string $message |
|
| 42 | - * @param string $hint |
|
| 43 | - * @param int $code |
|
| 44 | - * @param \Exception|null $previous |
|
| 45 | - */ |
|
| 46 | - public function __construct($message, $hint = '', $code = Http::STATUS_BAD_REQUEST, \Exception $previous = null) { |
|
| 47 | - parent::__construct($message, $hint, $code, $previous); |
|
| 48 | - } |
|
| 36 | + /** |
|
| 37 | + * ProviderCouldNotAddShareException constructor. |
|
| 38 | + * |
|
| 39 | + * @since 14.0.0 |
|
| 40 | + * |
|
| 41 | + * @param string $message |
|
| 42 | + * @param string $hint |
|
| 43 | + * @param int $code |
|
| 44 | + * @param \Exception|null $previous |
|
| 45 | + */ |
|
| 46 | + public function __construct($message, $hint = '', $code = Http::STATUS_BAD_REQUEST, \Exception $previous = null) { |
|
| 47 | + parent::__construct($message, $hint, $code, $previous); |
|
| 48 | + } |
|
| 49 | 49 | |
| 50 | 50 | |
| 51 | 51 | } |
@@ -32,18 +32,18 @@ |
||
| 32 | 32 | */ |
| 33 | 33 | class ProviderDoesNotExistsException extends HintException { |
| 34 | 34 | |
| 35 | - /** |
|
| 36 | - * ProviderDoesNotExistsException constructor. |
|
| 37 | - * |
|
| 38 | - * @since 14.0.0 |
|
| 39 | - * |
|
| 40 | - * @param string $providerId cloud federation provider ID |
|
| 41 | - */ |
|
| 42 | - public function __construct($providerId) { |
|
| 43 | - $l = \OC::$server->getL10N('federation'); |
|
| 44 | - $message = 'Cloud Federation Provider with ID: "' . $providerId . '" does not exist.'; |
|
| 45 | - $hint = $l->t('Cloud Federation Provider with ID: "%s" does not exist.', [$providerId]); |
|
| 46 | - parent::__construct($message, $hint); |
|
| 47 | - } |
|
| 35 | + /** |
|
| 36 | + * ProviderDoesNotExistsException constructor. |
|
| 37 | + * |
|
| 38 | + * @since 14.0.0 |
|
| 39 | + * |
|
| 40 | + * @param string $providerId cloud federation provider ID |
|
| 41 | + */ |
|
| 42 | + public function __construct($providerId) { |
|
| 43 | + $l = \OC::$server->getL10N('federation'); |
|
| 44 | + $message = 'Cloud Federation Provider with ID: "' . $providerId . '" does not exist.'; |
|
| 45 | + $hint = $l->t('Cloud Federation Provider with ID: "%s" does not exist.', [$providerId]); |
|
| 46 | + parent::__construct($message, $hint); |
|
| 47 | + } |
|
| 48 | 48 | |
| 49 | 49 | } |
@@ -32,17 +32,17 @@ |
||
| 32 | 32 | */ |
| 33 | 33 | class ActionNotSupportedException extends HintException { |
| 34 | 34 | |
| 35 | - /** |
|
| 36 | - * ActionNotSupportedException constructor. |
|
| 37 | - * |
|
| 38 | - * @since 14.0.0 |
|
| 39 | - * |
|
| 40 | - */ |
|
| 41 | - public function __construct($action) { |
|
| 42 | - $l = \OC::$server->getL10N('federation'); |
|
| 43 | - $message = 'Action "' . $action . '" not supported or implemented.'; |
|
| 44 | - $hint = $l->t('Action "%s" not supported or implemented.', [$action]); |
|
| 45 | - parent::__construct($message, $hint); |
|
| 46 | - } |
|
| 35 | + /** |
|
| 36 | + * ActionNotSupportedException constructor. |
|
| 37 | + * |
|
| 38 | + * @since 14.0.0 |
|
| 39 | + * |
|
| 40 | + */ |
|
| 41 | + public function __construct($action) { |
|
| 42 | + $l = \OC::$server->getL10N('federation'); |
|
| 43 | + $message = 'Action "' . $action . '" not supported or implemented.'; |
|
| 44 | + $hint = $l->t('Action "%s" not supported or implemented.', [$action]); |
|
| 45 | + parent::__construct($message, $hint); |
|
| 46 | + } |
|
| 47 | 47 | |
| 48 | 48 | } |