@@ -32,7 +32,6 @@ |
||
| 32 | 32 | use OCA\FederatedFileSharing\AddressHandler; |
| 33 | 33 | use OCA\FederatedFileSharing\FederatedShareProvider; |
| 34 | 34 | use OCA\FederatedFileSharing\Notifications; |
| 35 | -use OCA\FederatedFileSharing\OCM\CloudFederationProvider; |
|
| 36 | 35 | use OCA\FederatedFileSharing\TokenHandler; |
| 37 | 36 | use OCA\ShareByMail\Settings\SettingsManager; |
| 38 | 37 | use OCA\ShareByMail\ShareByMailProvider; |
@@ -48,235 +48,235 @@ |
||
| 48 | 48 | */ |
| 49 | 49 | class ProviderFactory implements IProviderFactory { |
| 50 | 50 | |
| 51 | - /** @var IServerContainer */ |
|
| 52 | - private $serverContainer; |
|
| 53 | - /** @var DefaultShareProvider */ |
|
| 54 | - private $defaultProvider = null; |
|
| 55 | - /** @var FederatedShareProvider */ |
|
| 56 | - private $federatedProvider = null; |
|
| 57 | - /** @var ShareByMailProvider */ |
|
| 58 | - private $shareByMailProvider; |
|
| 59 | - /** @var \OCA\Circles\ShareByCircleProvider */ |
|
| 60 | - private $shareByCircleProvider = null; |
|
| 61 | - /** @var bool */ |
|
| 62 | - private $circlesAreNotAvailable = false; |
|
| 63 | - |
|
| 64 | - /** |
|
| 65 | - * IProviderFactory constructor. |
|
| 66 | - * |
|
| 67 | - * @param IServerContainer $serverContainer |
|
| 68 | - */ |
|
| 69 | - public function __construct(IServerContainer $serverContainer) { |
|
| 70 | - $this->serverContainer = $serverContainer; |
|
| 71 | - } |
|
| 72 | - |
|
| 73 | - /** |
|
| 74 | - * Create the default share provider. |
|
| 75 | - * |
|
| 76 | - * @return DefaultShareProvider |
|
| 77 | - */ |
|
| 78 | - protected function defaultShareProvider() { |
|
| 79 | - if ($this->defaultProvider === null) { |
|
| 80 | - $this->defaultProvider = new DefaultShareProvider( |
|
| 81 | - $this->serverContainer->getDatabaseConnection(), |
|
| 82 | - $this->serverContainer->getUserManager(), |
|
| 83 | - $this->serverContainer->getGroupManager(), |
|
| 84 | - $this->serverContainer->getLazyRootFolder() |
|
| 85 | - ); |
|
| 86 | - } |
|
| 87 | - |
|
| 88 | - return $this->defaultProvider; |
|
| 89 | - } |
|
| 90 | - |
|
| 91 | - /** |
|
| 92 | - * Create the federated share provider |
|
| 93 | - * |
|
| 94 | - * @return FederatedShareProvider |
|
| 95 | - */ |
|
| 96 | - protected function federatedShareProvider() { |
|
| 97 | - if ($this->federatedProvider === null) { |
|
| 98 | - /* |
|
| 51 | + /** @var IServerContainer */ |
|
| 52 | + private $serverContainer; |
|
| 53 | + /** @var DefaultShareProvider */ |
|
| 54 | + private $defaultProvider = null; |
|
| 55 | + /** @var FederatedShareProvider */ |
|
| 56 | + private $federatedProvider = null; |
|
| 57 | + /** @var ShareByMailProvider */ |
|
| 58 | + private $shareByMailProvider; |
|
| 59 | + /** @var \OCA\Circles\ShareByCircleProvider */ |
|
| 60 | + private $shareByCircleProvider = null; |
|
| 61 | + /** @var bool */ |
|
| 62 | + private $circlesAreNotAvailable = false; |
|
| 63 | + |
|
| 64 | + /** |
|
| 65 | + * IProviderFactory constructor. |
|
| 66 | + * |
|
| 67 | + * @param IServerContainer $serverContainer |
|
| 68 | + */ |
|
| 69 | + public function __construct(IServerContainer $serverContainer) { |
|
| 70 | + $this->serverContainer = $serverContainer; |
|
| 71 | + } |
|
| 72 | + |
|
| 73 | + /** |
|
| 74 | + * Create the default share provider. |
|
| 75 | + * |
|
| 76 | + * @return DefaultShareProvider |
|
| 77 | + */ |
|
| 78 | + protected function defaultShareProvider() { |
|
| 79 | + if ($this->defaultProvider === null) { |
|
| 80 | + $this->defaultProvider = new DefaultShareProvider( |
|
| 81 | + $this->serverContainer->getDatabaseConnection(), |
|
| 82 | + $this->serverContainer->getUserManager(), |
|
| 83 | + $this->serverContainer->getGroupManager(), |
|
| 84 | + $this->serverContainer->getLazyRootFolder() |
|
| 85 | + ); |
|
| 86 | + } |
|
| 87 | + |
|
| 88 | + return $this->defaultProvider; |
|
| 89 | + } |
|
| 90 | + |
|
| 91 | + /** |
|
| 92 | + * Create the federated share provider |
|
| 93 | + * |
|
| 94 | + * @return FederatedShareProvider |
|
| 95 | + */ |
|
| 96 | + protected function federatedShareProvider() { |
|
| 97 | + if ($this->federatedProvider === null) { |
|
| 98 | + /* |
|
| 99 | 99 | * Check if the app is enabled |
| 100 | 100 | */ |
| 101 | - $appManager = $this->serverContainer->getAppManager(); |
|
| 102 | - if (!$appManager->isEnabledForUser('federatedfilesharing')) { |
|
| 103 | - return null; |
|
| 104 | - } |
|
| 101 | + $appManager = $this->serverContainer->getAppManager(); |
|
| 102 | + if (!$appManager->isEnabledForUser('federatedfilesharing')) { |
|
| 103 | + return null; |
|
| 104 | + } |
|
| 105 | 105 | |
| 106 | - /* |
|
| 106 | + /* |
|
| 107 | 107 | * TODO: add factory to federated sharing app |
| 108 | 108 | */ |
| 109 | - $l = $this->serverContainer->getL10N('federatedfilessharing'); |
|
| 110 | - $addressHandler = new AddressHandler( |
|
| 111 | - $this->serverContainer->getURLGenerator(), |
|
| 112 | - $l, |
|
| 113 | - $this->serverContainer->getCloudIdManager() |
|
| 114 | - ); |
|
| 115 | - $notifications = new Notifications( |
|
| 116 | - $addressHandler, |
|
| 117 | - $this->serverContainer->getHTTPClientService(), |
|
| 118 | - $this->serverContainer->query(\OCP\OCS\IDiscoveryService::class), |
|
| 119 | - $this->serverContainer->getJobList(), |
|
| 120 | - \OC::$server->getCloudFederationProviderManager(), |
|
| 121 | - \OC::$server->getCloudFederationFactory() |
|
| 122 | - ); |
|
| 123 | - $tokenHandler = new TokenHandler( |
|
| 124 | - $this->serverContainer->getSecureRandom() |
|
| 125 | - ); |
|
| 126 | - |
|
| 127 | - $this->federatedProvider = new FederatedShareProvider( |
|
| 128 | - $this->serverContainer->getDatabaseConnection(), |
|
| 129 | - $addressHandler, |
|
| 130 | - $notifications, |
|
| 131 | - $tokenHandler, |
|
| 132 | - $l, |
|
| 133 | - $this->serverContainer->getLogger(), |
|
| 134 | - $this->serverContainer->getLazyRootFolder(), |
|
| 135 | - $this->serverContainer->getConfig(), |
|
| 136 | - $this->serverContainer->getUserManager(), |
|
| 137 | - $this->serverContainer->getCloudIdManager(), |
|
| 138 | - $this->serverContainer->getGlobalScaleConfig() |
|
| 139 | - ); |
|
| 140 | - } |
|
| 141 | - |
|
| 142 | - return $this->federatedProvider; |
|
| 143 | - } |
|
| 144 | - |
|
| 145 | - /** |
|
| 146 | - * Create the federated share provider |
|
| 147 | - * |
|
| 148 | - * @return ShareByMailProvider |
|
| 149 | - */ |
|
| 150 | - protected function getShareByMailProvider() { |
|
| 151 | - if ($this->shareByMailProvider === null) { |
|
| 152 | - /* |
|
| 109 | + $l = $this->serverContainer->getL10N('federatedfilessharing'); |
|
| 110 | + $addressHandler = new AddressHandler( |
|
| 111 | + $this->serverContainer->getURLGenerator(), |
|
| 112 | + $l, |
|
| 113 | + $this->serverContainer->getCloudIdManager() |
|
| 114 | + ); |
|
| 115 | + $notifications = new Notifications( |
|
| 116 | + $addressHandler, |
|
| 117 | + $this->serverContainer->getHTTPClientService(), |
|
| 118 | + $this->serverContainer->query(\OCP\OCS\IDiscoveryService::class), |
|
| 119 | + $this->serverContainer->getJobList(), |
|
| 120 | + \OC::$server->getCloudFederationProviderManager(), |
|
| 121 | + \OC::$server->getCloudFederationFactory() |
|
| 122 | + ); |
|
| 123 | + $tokenHandler = new TokenHandler( |
|
| 124 | + $this->serverContainer->getSecureRandom() |
|
| 125 | + ); |
|
| 126 | + |
|
| 127 | + $this->federatedProvider = new FederatedShareProvider( |
|
| 128 | + $this->serverContainer->getDatabaseConnection(), |
|
| 129 | + $addressHandler, |
|
| 130 | + $notifications, |
|
| 131 | + $tokenHandler, |
|
| 132 | + $l, |
|
| 133 | + $this->serverContainer->getLogger(), |
|
| 134 | + $this->serverContainer->getLazyRootFolder(), |
|
| 135 | + $this->serverContainer->getConfig(), |
|
| 136 | + $this->serverContainer->getUserManager(), |
|
| 137 | + $this->serverContainer->getCloudIdManager(), |
|
| 138 | + $this->serverContainer->getGlobalScaleConfig() |
|
| 139 | + ); |
|
| 140 | + } |
|
| 141 | + |
|
| 142 | + return $this->federatedProvider; |
|
| 143 | + } |
|
| 144 | + |
|
| 145 | + /** |
|
| 146 | + * Create the federated share provider |
|
| 147 | + * |
|
| 148 | + * @return ShareByMailProvider |
|
| 149 | + */ |
|
| 150 | + protected function getShareByMailProvider() { |
|
| 151 | + if ($this->shareByMailProvider === null) { |
|
| 152 | + /* |
|
| 153 | 153 | * Check if the app is enabled |
| 154 | 154 | */ |
| 155 | - $appManager = $this->serverContainer->getAppManager(); |
|
| 156 | - if (!$appManager->isEnabledForUser('sharebymail')) { |
|
| 157 | - return null; |
|
| 158 | - } |
|
| 159 | - |
|
| 160 | - $settingsManager = new SettingsManager($this->serverContainer->getConfig()); |
|
| 161 | - |
|
| 162 | - $this->shareByMailProvider = new ShareByMailProvider( |
|
| 163 | - $this->serverContainer->getDatabaseConnection(), |
|
| 164 | - $this->serverContainer->getSecureRandom(), |
|
| 165 | - $this->serverContainer->getUserManager(), |
|
| 166 | - $this->serverContainer->getLazyRootFolder(), |
|
| 167 | - $this->serverContainer->getL10N('sharebymail'), |
|
| 168 | - $this->serverContainer->getLogger(), |
|
| 169 | - $this->serverContainer->getMailer(), |
|
| 170 | - $this->serverContainer->getURLGenerator(), |
|
| 171 | - $this->serverContainer->getActivityManager(), |
|
| 172 | - $settingsManager, |
|
| 173 | - $this->serverContainer->query(Defaults::class), |
|
| 174 | - $this->serverContainer->getHasher(), |
|
| 175 | - $this->serverContainer->query(CapabilitiesManager::class) |
|
| 176 | - ); |
|
| 177 | - } |
|
| 178 | - |
|
| 179 | - return $this->shareByMailProvider; |
|
| 180 | - } |
|
| 181 | - |
|
| 182 | - |
|
| 183 | - /** |
|
| 184 | - * Create the circle share provider |
|
| 185 | - * |
|
| 186 | - * @return FederatedShareProvider |
|
| 187 | - * |
|
| 188 | - * @suppress PhanUndeclaredClassMethod |
|
| 189 | - */ |
|
| 190 | - protected function getShareByCircleProvider() { |
|
| 191 | - |
|
| 192 | - if ($this->circlesAreNotAvailable) { |
|
| 193 | - return null; |
|
| 194 | - } |
|
| 195 | - |
|
| 196 | - if (!$this->serverContainer->getAppManager()->isEnabledForUser('circles') || |
|
| 197 | - !class_exists('\OCA\Circles\ShareByCircleProvider') |
|
| 198 | - ) { |
|
| 199 | - $this->circlesAreNotAvailable = true; |
|
| 200 | - return null; |
|
| 201 | - } |
|
| 202 | - |
|
| 203 | - if ($this->shareByCircleProvider === null) { |
|
| 204 | - |
|
| 205 | - $this->shareByCircleProvider = new \OCA\Circles\ShareByCircleProvider( |
|
| 206 | - $this->serverContainer->getDatabaseConnection(), |
|
| 207 | - $this->serverContainer->getSecureRandom(), |
|
| 208 | - $this->serverContainer->getUserManager(), |
|
| 209 | - $this->serverContainer->getLazyRootFolder(), |
|
| 210 | - $this->serverContainer->getL10N('circles'), |
|
| 211 | - $this->serverContainer->getLogger(), |
|
| 212 | - $this->serverContainer->getURLGenerator() |
|
| 213 | - ); |
|
| 214 | - } |
|
| 215 | - |
|
| 216 | - return $this->shareByCircleProvider; |
|
| 217 | - } |
|
| 218 | - |
|
| 219 | - |
|
| 220 | - /** |
|
| 221 | - * @inheritdoc |
|
| 222 | - */ |
|
| 223 | - public function getProvider($id) { |
|
| 224 | - $provider = null; |
|
| 225 | - if ($id === 'ocinternal') { |
|
| 226 | - $provider = $this->defaultShareProvider(); |
|
| 227 | - } else if ($id === 'ocFederatedSharing') { |
|
| 228 | - $provider = $this->federatedShareProvider(); |
|
| 229 | - } else if ($id === 'ocMailShare') { |
|
| 230 | - $provider = $this->getShareByMailProvider(); |
|
| 231 | - } else if ($id === 'ocCircleShare') { |
|
| 232 | - $provider = $this->getShareByCircleProvider(); |
|
| 233 | - } |
|
| 234 | - |
|
| 235 | - if ($provider === null) { |
|
| 236 | - throw new ProviderException('No provider with id .' . $id . ' found.'); |
|
| 237 | - } |
|
| 238 | - |
|
| 239 | - return $provider; |
|
| 240 | - } |
|
| 241 | - |
|
| 242 | - /** |
|
| 243 | - * @inheritdoc |
|
| 244 | - */ |
|
| 245 | - public function getProviderForType($shareType) { |
|
| 246 | - $provider = null; |
|
| 247 | - |
|
| 248 | - if ($shareType === \OCP\Share::SHARE_TYPE_USER || |
|
| 249 | - $shareType === \OCP\Share::SHARE_TYPE_GROUP || |
|
| 250 | - $shareType === \OCP\Share::SHARE_TYPE_LINK |
|
| 251 | - ) { |
|
| 252 | - $provider = $this->defaultShareProvider(); |
|
| 253 | - } else if ($shareType === \OCP\Share::SHARE_TYPE_REMOTE) { |
|
| 254 | - $provider = $this->federatedShareProvider(); |
|
| 255 | - } else if ($shareType === \OCP\Share::SHARE_TYPE_EMAIL) { |
|
| 256 | - $provider = $this->getShareByMailProvider(); |
|
| 257 | - } else if ($shareType === \OCP\Share::SHARE_TYPE_CIRCLE) { |
|
| 258 | - $provider = $this->getShareByCircleProvider(); |
|
| 259 | - } |
|
| 260 | - |
|
| 261 | - |
|
| 262 | - if ($provider === null) { |
|
| 263 | - throw new ProviderException('No share provider for share type ' . $shareType); |
|
| 264 | - } |
|
| 265 | - |
|
| 266 | - return $provider; |
|
| 267 | - } |
|
| 268 | - |
|
| 269 | - public function getAllProviders() { |
|
| 270 | - $shares = [$this->defaultShareProvider(), $this->federatedShareProvider()]; |
|
| 271 | - $shareByMail = $this->getShareByMailProvider(); |
|
| 272 | - if ($shareByMail !== null) { |
|
| 273 | - $shares[] = $shareByMail; |
|
| 274 | - } |
|
| 275 | - $shareByCircle = $this->getShareByCircleProvider(); |
|
| 276 | - if ($shareByCircle !== null) { |
|
| 277 | - $shares[] = $shareByCircle; |
|
| 278 | - } |
|
| 279 | - |
|
| 280 | - return $shares; |
|
| 281 | - } |
|
| 155 | + $appManager = $this->serverContainer->getAppManager(); |
|
| 156 | + if (!$appManager->isEnabledForUser('sharebymail')) { |
|
| 157 | + return null; |
|
| 158 | + } |
|
| 159 | + |
|
| 160 | + $settingsManager = new SettingsManager($this->serverContainer->getConfig()); |
|
| 161 | + |
|
| 162 | + $this->shareByMailProvider = new ShareByMailProvider( |
|
| 163 | + $this->serverContainer->getDatabaseConnection(), |
|
| 164 | + $this->serverContainer->getSecureRandom(), |
|
| 165 | + $this->serverContainer->getUserManager(), |
|
| 166 | + $this->serverContainer->getLazyRootFolder(), |
|
| 167 | + $this->serverContainer->getL10N('sharebymail'), |
|
| 168 | + $this->serverContainer->getLogger(), |
|
| 169 | + $this->serverContainer->getMailer(), |
|
| 170 | + $this->serverContainer->getURLGenerator(), |
|
| 171 | + $this->serverContainer->getActivityManager(), |
|
| 172 | + $settingsManager, |
|
| 173 | + $this->serverContainer->query(Defaults::class), |
|
| 174 | + $this->serverContainer->getHasher(), |
|
| 175 | + $this->serverContainer->query(CapabilitiesManager::class) |
|
| 176 | + ); |
|
| 177 | + } |
|
| 178 | + |
|
| 179 | + return $this->shareByMailProvider; |
|
| 180 | + } |
|
| 181 | + |
|
| 182 | + |
|
| 183 | + /** |
|
| 184 | + * Create the circle share provider |
|
| 185 | + * |
|
| 186 | + * @return FederatedShareProvider |
|
| 187 | + * |
|
| 188 | + * @suppress PhanUndeclaredClassMethod |
|
| 189 | + */ |
|
| 190 | + protected function getShareByCircleProvider() { |
|
| 191 | + |
|
| 192 | + if ($this->circlesAreNotAvailable) { |
|
| 193 | + return null; |
|
| 194 | + } |
|
| 195 | + |
|
| 196 | + if (!$this->serverContainer->getAppManager()->isEnabledForUser('circles') || |
|
| 197 | + !class_exists('\OCA\Circles\ShareByCircleProvider') |
|
| 198 | + ) { |
|
| 199 | + $this->circlesAreNotAvailable = true; |
|
| 200 | + return null; |
|
| 201 | + } |
|
| 202 | + |
|
| 203 | + if ($this->shareByCircleProvider === null) { |
|
| 204 | + |
|
| 205 | + $this->shareByCircleProvider = new \OCA\Circles\ShareByCircleProvider( |
|
| 206 | + $this->serverContainer->getDatabaseConnection(), |
|
| 207 | + $this->serverContainer->getSecureRandom(), |
|
| 208 | + $this->serverContainer->getUserManager(), |
|
| 209 | + $this->serverContainer->getLazyRootFolder(), |
|
| 210 | + $this->serverContainer->getL10N('circles'), |
|
| 211 | + $this->serverContainer->getLogger(), |
|
| 212 | + $this->serverContainer->getURLGenerator() |
|
| 213 | + ); |
|
| 214 | + } |
|
| 215 | + |
|
| 216 | + return $this->shareByCircleProvider; |
|
| 217 | + } |
|
| 218 | + |
|
| 219 | + |
|
| 220 | + /** |
|
| 221 | + * @inheritdoc |
|
| 222 | + */ |
|
| 223 | + public function getProvider($id) { |
|
| 224 | + $provider = null; |
|
| 225 | + if ($id === 'ocinternal') { |
|
| 226 | + $provider = $this->defaultShareProvider(); |
|
| 227 | + } else if ($id === 'ocFederatedSharing') { |
|
| 228 | + $provider = $this->federatedShareProvider(); |
|
| 229 | + } else if ($id === 'ocMailShare') { |
|
| 230 | + $provider = $this->getShareByMailProvider(); |
|
| 231 | + } else if ($id === 'ocCircleShare') { |
|
| 232 | + $provider = $this->getShareByCircleProvider(); |
|
| 233 | + } |
|
| 234 | + |
|
| 235 | + if ($provider === null) { |
|
| 236 | + throw new ProviderException('No provider with id .' . $id . ' found.'); |
|
| 237 | + } |
|
| 238 | + |
|
| 239 | + return $provider; |
|
| 240 | + } |
|
| 241 | + |
|
| 242 | + /** |
|
| 243 | + * @inheritdoc |
|
| 244 | + */ |
|
| 245 | + public function getProviderForType($shareType) { |
|
| 246 | + $provider = null; |
|
| 247 | + |
|
| 248 | + if ($shareType === \OCP\Share::SHARE_TYPE_USER || |
|
| 249 | + $shareType === \OCP\Share::SHARE_TYPE_GROUP || |
|
| 250 | + $shareType === \OCP\Share::SHARE_TYPE_LINK |
|
| 251 | + ) { |
|
| 252 | + $provider = $this->defaultShareProvider(); |
|
| 253 | + } else if ($shareType === \OCP\Share::SHARE_TYPE_REMOTE) { |
|
| 254 | + $provider = $this->federatedShareProvider(); |
|
| 255 | + } else if ($shareType === \OCP\Share::SHARE_TYPE_EMAIL) { |
|
| 256 | + $provider = $this->getShareByMailProvider(); |
|
| 257 | + } else if ($shareType === \OCP\Share::SHARE_TYPE_CIRCLE) { |
|
| 258 | + $provider = $this->getShareByCircleProvider(); |
|
| 259 | + } |
|
| 260 | + |
|
| 261 | + |
|
| 262 | + if ($provider === null) { |
|
| 263 | + throw new ProviderException('No share provider for share type ' . $shareType); |
|
| 264 | + } |
|
| 265 | + |
|
| 266 | + return $provider; |
|
| 267 | + } |
|
| 268 | + |
|
| 269 | + public function getAllProviders() { |
|
| 270 | + $shares = [$this->defaultShareProvider(), $this->federatedShareProvider()]; |
|
| 271 | + $shareByMail = $this->getShareByMailProvider(); |
|
| 272 | + if ($shareByMail !== null) { |
|
| 273 | + $shares[] = $shareByMail; |
|
| 274 | + } |
|
| 275 | + $shareByCircle = $this->getShareByCircleProvider(); |
|
| 276 | + if ($shareByCircle !== null) { |
|
| 277 | + $shares[] = $shareByCircle; |
|
| 278 | + } |
|
| 279 | + |
|
| 280 | + return $shares; |
|
| 281 | + } |
|
| 282 | 282 | } |
@@ -29,11 +29,11 @@ |
||
| 29 | 29 | $isEnabled = $server->getAppManager()->isEnabledForUser('cloud_federation_api'); |
| 30 | 30 | |
| 31 | 31 | if ($isEnabled) { |
| 32 | - $capabilities = new OCA\CloudFederationAPI\Capabilities($server->getURLGenerator()); |
|
| 33 | - header('Content-Type: application/json'); |
|
| 34 | - echo json_encode($capabilities->getCapabilities()['ocm']); |
|
| 32 | + $capabilities = new OCA\CloudFederationAPI\Capabilities($server->getURLGenerator()); |
|
| 33 | + header('Content-Type: application/json'); |
|
| 34 | + echo json_encode($capabilities->getCapabilities()['ocm']); |
|
| 35 | 35 | } else { |
| 36 | - header($_SERVER["SERVER_PROTOCOL"]." 501 Not Implemented", true, 501); |
|
| 37 | - exit("501 Not Implemented"); |
|
| 36 | + header($_SERVER["SERVER_PROTOCOL"]." 501 Not Implemented", true, 501); |
|
| 37 | + exit("501 Not Implemented"); |
|
| 38 | 38 | } |
| 39 | 39 | |
@@ -20,7 +20,7 @@ |
||
| 20 | 20 | */ |
| 21 | 21 | |
| 22 | 22 | |
| 23 | -require_once __DIR__ . '/../lib/base.php'; |
|
| 23 | +require_once __DIR__.'/../lib/base.php'; |
|
| 24 | 24 | |
| 25 | 25 | header('Content-Type: application/json'); |
| 26 | 26 | |
@@ -6,39 +6,39 @@ |
||
| 6 | 6 | |
| 7 | 7 | class ComposerStaticInitFederatedFileSharing |
| 8 | 8 | { |
| 9 | - public static $prefixLengthsPsr4 = array ( |
|
| 9 | + public static $prefixLengthsPsr4 = array( |
|
| 10 | 10 | 'O' => |
| 11 | - array ( |
|
| 11 | + array( |
|
| 12 | 12 | 'OCA\\FederatedFileSharing\\' => 25, |
| 13 | 13 | ), |
| 14 | 14 | ); |
| 15 | 15 | |
| 16 | - public static $prefixDirsPsr4 = array ( |
|
| 16 | + public static $prefixDirsPsr4 = array( |
|
| 17 | 17 | 'OCA\\FederatedFileSharing\\' => |
| 18 | - array ( |
|
| 19 | - 0 => __DIR__ . '/..' . '/../lib', |
|
| 18 | + array( |
|
| 19 | + 0 => __DIR__.'/..'.'/../lib', |
|
| 20 | 20 | ), |
| 21 | 21 | ); |
| 22 | 22 | |
| 23 | - public static $classMap = array ( |
|
| 24 | - 'OCA\\FederatedFileSharing\\AddressHandler' => __DIR__ . '/..' . '/../lib/AddressHandler.php', |
|
| 25 | - 'OCA\\FederatedFileSharing\\AppInfo\\Application' => __DIR__ . '/..' . '/../lib/AppInfo/Application.php', |
|
| 26 | - 'OCA\\FederatedFileSharing\\BackgroundJob\\RetryJob' => __DIR__ . '/..' . '/../lib/BackgroundJob/RetryJob.php', |
|
| 27 | - 'OCA\\FederatedFileSharing\\Controller\\MountPublicLinkController' => __DIR__ . '/..' . '/../lib/Controller/MountPublicLinkController.php', |
|
| 28 | - 'OCA\\FederatedFileSharing\\Controller\\RequestHandlerController' => __DIR__ . '/..' . '/../lib/Controller/RequestHandlerController.php', |
|
| 29 | - 'OCA\\FederatedFileSharing\\FederatedShareProvider' => __DIR__ . '/..' . '/../lib/FederatedShareProvider.php', |
|
| 30 | - 'OCA\\FederatedFileSharing\\Notifications' => __DIR__ . '/..' . '/../lib/Notifications.php', |
|
| 31 | - 'OCA\\FederatedFileSharing\\Notifier' => __DIR__ . '/..' . '/../lib/Notifier.php', |
|
| 32 | - 'OCA\\FederatedFileSharing\\OCM\\CloudFederationProviderFiles' => __DIR__ . '/..' . '/../lib/ocm/CloudFederationProviderFiles.php', |
|
| 33 | - 'OCA\\FederatedFileSharing\\Settings\\Admin' => __DIR__ . '/..' . '/../lib/Settings/Admin.php', |
|
| 34 | - 'OCA\\FederatedFileSharing\\Settings\\Personal' => __DIR__ . '/..' . '/../lib/Settings/Personal.php', |
|
| 35 | - 'OCA\\FederatedFileSharing\\Settings\\PersonalSection' => __DIR__ . '/..' . '/../lib/Settings/PersonalSection.php', |
|
| 36 | - 'OCA\\FederatedFileSharing\\TokenHandler' => __DIR__ . '/..' . '/../lib/TokenHandler.php', |
|
| 23 | + public static $classMap = array( |
|
| 24 | + 'OCA\\FederatedFileSharing\\AddressHandler' => __DIR__.'/..'.'/../lib/AddressHandler.php', |
|
| 25 | + 'OCA\\FederatedFileSharing\\AppInfo\\Application' => __DIR__.'/..'.'/../lib/AppInfo/Application.php', |
|
| 26 | + 'OCA\\FederatedFileSharing\\BackgroundJob\\RetryJob' => __DIR__.'/..'.'/../lib/BackgroundJob/RetryJob.php', |
|
| 27 | + 'OCA\\FederatedFileSharing\\Controller\\MountPublicLinkController' => __DIR__.'/..'.'/../lib/Controller/MountPublicLinkController.php', |
|
| 28 | + 'OCA\\FederatedFileSharing\\Controller\\RequestHandlerController' => __DIR__.'/..'.'/../lib/Controller/RequestHandlerController.php', |
|
| 29 | + 'OCA\\FederatedFileSharing\\FederatedShareProvider' => __DIR__.'/..'.'/../lib/FederatedShareProvider.php', |
|
| 30 | + 'OCA\\FederatedFileSharing\\Notifications' => __DIR__.'/..'.'/../lib/Notifications.php', |
|
| 31 | + 'OCA\\FederatedFileSharing\\Notifier' => __DIR__.'/..'.'/../lib/Notifier.php', |
|
| 32 | + 'OCA\\FederatedFileSharing\\OCM\\CloudFederationProviderFiles' => __DIR__.'/..'.'/../lib/ocm/CloudFederationProviderFiles.php', |
|
| 33 | + 'OCA\\FederatedFileSharing\\Settings\\Admin' => __DIR__.'/..'.'/../lib/Settings/Admin.php', |
|
| 34 | + 'OCA\\FederatedFileSharing\\Settings\\Personal' => __DIR__.'/..'.'/../lib/Settings/Personal.php', |
|
| 35 | + 'OCA\\FederatedFileSharing\\Settings\\PersonalSection' => __DIR__.'/..'.'/../lib/Settings/PersonalSection.php', |
|
| 36 | + 'OCA\\FederatedFileSharing\\TokenHandler' => __DIR__.'/..'.'/../lib/TokenHandler.php', |
|
| 37 | 37 | ); |
| 38 | 38 | |
| 39 | 39 | public static function getInitializer(ClassLoader $loader) |
| 40 | 40 | { |
| 41 | - return \Closure::bind(function () use ($loader) { |
|
| 41 | + return \Closure::bind(function() use ($loader) { |
|
| 42 | 42 | $loader->prefixLengthsPsr4 = ComposerStaticInitFederatedFileSharing::$prefixLengthsPsr4; |
| 43 | 43 | $loader->prefixDirsPsr4 = ComposerStaticInitFederatedFileSharing::$prefixDirsPsr4; |
| 44 | 44 | $loader->classMap = ComposerStaticInitFederatedFileSharing::$classMap; |
@@ -6,17 +6,17 @@ |
||
| 6 | 6 | $baseDir = $vendorDir; |
| 7 | 7 | |
| 8 | 8 | return array( |
| 9 | - 'OCA\\FederatedFileSharing\\AddressHandler' => $baseDir . '/../lib/AddressHandler.php', |
|
| 10 | - 'OCA\\FederatedFileSharing\\AppInfo\\Application' => $baseDir . '/../lib/AppInfo/Application.php', |
|
| 11 | - 'OCA\\FederatedFileSharing\\BackgroundJob\\RetryJob' => $baseDir . '/../lib/BackgroundJob/RetryJob.php', |
|
| 12 | - 'OCA\\FederatedFileSharing\\Controller\\MountPublicLinkController' => $baseDir . '/../lib/Controller/MountPublicLinkController.php', |
|
| 13 | - 'OCA\\FederatedFileSharing\\Controller\\RequestHandlerController' => $baseDir . '/../lib/Controller/RequestHandlerController.php', |
|
| 14 | - 'OCA\\FederatedFileSharing\\FederatedShareProvider' => $baseDir . '/../lib/FederatedShareProvider.php', |
|
| 15 | - 'OCA\\FederatedFileSharing\\Notifications' => $baseDir . '/../lib/Notifications.php', |
|
| 16 | - 'OCA\\FederatedFileSharing\\Notifier' => $baseDir . '/../lib/Notifier.php', |
|
| 17 | - 'OCA\\FederatedFileSharing\\OCM\\CloudFederationProviderFiles' => $baseDir . '/../lib/ocm/CloudFederationProviderFiles.php', |
|
| 18 | - 'OCA\\FederatedFileSharing\\Settings\\Admin' => $baseDir . '/../lib/Settings/Admin.php', |
|
| 19 | - 'OCA\\FederatedFileSharing\\Settings\\Personal' => $baseDir . '/../lib/Settings/Personal.php', |
|
| 20 | - 'OCA\\FederatedFileSharing\\Settings\\PersonalSection' => $baseDir . '/../lib/Settings/PersonalSection.php', |
|
| 21 | - 'OCA\\FederatedFileSharing\\TokenHandler' => $baseDir . '/../lib/TokenHandler.php', |
|
| 9 | + 'OCA\\FederatedFileSharing\\AddressHandler' => $baseDir.'/../lib/AddressHandler.php', |
|
| 10 | + 'OCA\\FederatedFileSharing\\AppInfo\\Application' => $baseDir.'/../lib/AppInfo/Application.php', |
|
| 11 | + 'OCA\\FederatedFileSharing\\BackgroundJob\\RetryJob' => $baseDir.'/../lib/BackgroundJob/RetryJob.php', |
|
| 12 | + 'OCA\\FederatedFileSharing\\Controller\\MountPublicLinkController' => $baseDir.'/../lib/Controller/MountPublicLinkController.php', |
|
| 13 | + 'OCA\\FederatedFileSharing\\Controller\\RequestHandlerController' => $baseDir.'/../lib/Controller/RequestHandlerController.php', |
|
| 14 | + 'OCA\\FederatedFileSharing\\FederatedShareProvider' => $baseDir.'/../lib/FederatedShareProvider.php', |
|
| 15 | + 'OCA\\FederatedFileSharing\\Notifications' => $baseDir.'/../lib/Notifications.php', |
|
| 16 | + 'OCA\\FederatedFileSharing\\Notifier' => $baseDir.'/../lib/Notifier.php', |
|
| 17 | + 'OCA\\FederatedFileSharing\\OCM\\CloudFederationProviderFiles' => $baseDir.'/../lib/ocm/CloudFederationProviderFiles.php', |
|
| 18 | + 'OCA\\FederatedFileSharing\\Settings\\Admin' => $baseDir.'/../lib/Settings/Admin.php', |
|
| 19 | + 'OCA\\FederatedFileSharing\\Settings\\Personal' => $baseDir.'/../lib/Settings/Personal.php', |
|
| 20 | + 'OCA\\FederatedFileSharing\\Settings\\PersonalSection' => $baseDir.'/../lib/Settings/PersonalSection.php', |
|
| 21 | + 'OCA\\FederatedFileSharing\\TokenHandler' => $baseDir.'/../lib/TokenHandler.php', |
|
| 22 | 22 | ); |
@@ -32,15 +32,15 @@ |
||
| 32 | 32 | */ |
| 33 | 33 | class Config { |
| 34 | 34 | |
| 35 | - public function __construct() { |
|
| 36 | - } |
|
| 35 | + public function __construct() { |
|
| 36 | + } |
|
| 37 | 37 | |
| 38 | - public function incomingRequestsEnabled() { |
|
| 39 | - return true; |
|
| 40 | - } |
|
| 38 | + public function incomingRequestsEnabled() { |
|
| 39 | + return true; |
|
| 40 | + } |
|
| 41 | 41 | |
| 42 | - public function outgoingRequestsEnabled() { |
|
| 43 | - return true; |
|
| 44 | - } |
|
| 42 | + public function outgoingRequestsEnabled() { |
|
| 43 | + return true; |
|
| 44 | + } |
|
| 45 | 45 | |
| 46 | 46 | } |
@@ -28,10 +28,10 @@ |
||
| 28 | 28 | |
| 29 | 29 | class Application extends App { |
| 30 | 30 | |
| 31 | - public function __construct() { |
|
| 32 | - parent::__construct('cloud_federation_api'); |
|
| 31 | + public function __construct() { |
|
| 32 | + parent::__construct('cloud_federation_api'); |
|
| 33 | 33 | |
| 34 | - $container = $this->getContainer(); |
|
| 35 | - $container->registerCapability(Capabilities::class); |
|
| 36 | - } |
|
| 34 | + $container = $this->getContainer(); |
|
| 35 | + $container->registerCapability(Capabilities::class); |
|
| 36 | + } |
|
| 37 | 37 | } |
@@ -26,9 +26,9 @@ |
||
| 26 | 26 | |
| 27 | 27 | class ProviderCouldNotAddShareException extends HintException { |
| 28 | 28 | |
| 29 | - public function __construct($message, $hint = '', $code = Http::STATUS_BAD_REQUEST, \Exception $previous = null) { |
|
| 30 | - parent::__construct($message, $hint, $code, $previous); |
|
| 31 | - } |
|
| 29 | + public function __construct($message, $hint = '', $code = Http::STATUS_BAD_REQUEST, \Exception $previous = null) { |
|
| 30 | + parent::__construct($message, $hint, $code, $previous); |
|
| 31 | + } |
|
| 32 | 32 | |
| 33 | 33 | |
| 34 | 34 | } |
@@ -25,16 +25,16 @@ |
||
| 25 | 25 | |
| 26 | 26 | class ProviderDoesNotExistsException extends HintException { |
| 27 | 27 | |
| 28 | - /** |
|
| 29 | - * ProviderDoesNotExistsException constructor. |
|
| 30 | - * |
|
| 31 | - * @param string $providerId cloud federation provider ID |
|
| 32 | - */ |
|
| 33 | - public function __construct($providerId) { |
|
| 34 | - $l = \OC::$server->getL10N('federation'); |
|
| 35 | - $message = 'Cloud Federation Provider with ID: "' . $providerId . '" does not exist.'; |
|
| 36 | - $hint = $l->t('Cloud Federation Provider with ID: "%s" does not exist.', [$providerId]); |
|
| 37 | - parent::__construct($message, $hint); |
|
| 38 | - } |
|
| 28 | + /** |
|
| 29 | + * ProviderDoesNotExistsException constructor. |
|
| 30 | + * |
|
| 31 | + * @param string $providerId cloud federation provider ID |
|
| 32 | + */ |
|
| 33 | + public function __construct($providerId) { |
|
| 34 | + $l = \OC::$server->getL10N('federation'); |
|
| 35 | + $message = 'Cloud Federation Provider with ID: "' . $providerId . '" does not exist.'; |
|
| 36 | + $hint = $l->t('Cloud Federation Provider with ID: "%s" does not exist.', [$providerId]); |
|
| 37 | + parent::__construct($message, $hint); |
|
| 38 | + } |
|
| 39 | 39 | |
| 40 | 40 | } |
@@ -32,7 +32,7 @@ |
||
| 32 | 32 | */ |
| 33 | 33 | public function __construct($providerId) { |
| 34 | 34 | $l = \OC::$server->getL10N('federation'); |
| 35 | - $message = 'Cloud Federation Provider with ID: "' . $providerId . '" does not exist.'; |
|
| 35 | + $message = 'Cloud Federation Provider with ID: "'.$providerId.'" does not exist.'; |
|
| 36 | 36 | $hint = $l->t('Cloud Federation Provider with ID: "%s" does not exist.', [$providerId]); |
| 37 | 37 | parent::__construct($message, $hint); |
| 38 | 38 | } |
@@ -25,17 +25,17 @@ |
||
| 25 | 25 | |
| 26 | 26 | class ProviderAlreadyExistsException extends HintException { |
| 27 | 27 | |
| 28 | - /** |
|
| 29 | - * ProviderAlreadyExistsException constructor. |
|
| 30 | - * |
|
| 31 | - * @param string $newProviderId cloud federation provider ID of the new provider |
|
| 32 | - * @param string $existingProviderName name of cloud federation provider which already use the same ID |
|
| 33 | - */ |
|
| 34 | - public function __construct($newProviderId, $existingProviderName) { |
|
| 35 | - $l = \OC::$server->getL10N('federation'); |
|
| 36 | - $message = 'Id "' . $newProviderId . '" already used by cloud federation provider "' . $existingProviderName . '"'; |
|
| 37 | - $hint = $l->t('Id "%s" already used by cloud federation provider "%s"', [$newProviderId, $existingProviderName]); |
|
| 38 | - parent::__construct($message, $hint); |
|
| 39 | - } |
|
| 28 | + /** |
|
| 29 | + * ProviderAlreadyExistsException constructor. |
|
| 30 | + * |
|
| 31 | + * @param string $newProviderId cloud federation provider ID of the new provider |
|
| 32 | + * @param string $existingProviderName name of cloud federation provider which already use the same ID |
|
| 33 | + */ |
|
| 34 | + public function __construct($newProviderId, $existingProviderName) { |
|
| 35 | + $l = \OC::$server->getL10N('federation'); |
|
| 36 | + $message = 'Id "' . $newProviderId . '" already used by cloud federation provider "' . $existingProviderName . '"'; |
|
| 37 | + $hint = $l->t('Id "%s" already used by cloud federation provider "%s"', [$newProviderId, $existingProviderName]); |
|
| 38 | + parent::__construct($message, $hint); |
|
| 39 | + } |
|
| 40 | 40 | |
| 41 | 41 | } |
@@ -33,7 +33,7 @@ |
||
| 33 | 33 | */ |
| 34 | 34 | public function __construct($newProviderId, $existingProviderName) { |
| 35 | 35 | $l = \OC::$server->getL10N('federation'); |
| 36 | - $message = 'Id "' . $newProviderId . '" already used by cloud federation provider "' . $existingProviderName . '"'; |
|
| 36 | + $message = 'Id "'.$newProviderId.'" already used by cloud federation provider "'.$existingProviderName.'"'; |
|
| 37 | 37 | $hint = $l->t('Id "%s" already used by cloud federation provider "%s"', [$newProviderId, $existingProviderName]); |
| 38 | 38 | parent::__construct($message, $hint); |
| 39 | 39 | } |