Completed
Pull Request — master (#9345)
by Björn
26:01 queued 08:55
created
core/routes.php 1 patch
Indentation   +92 added lines, -92 removed lines patch added patch discarded remove patch
@@ -36,47 +36,47 @@  discard block
 block discarded – undo
36 36
 
37 37
 $application = new Application();
38 38
 $application->registerRoutes($this, [
39
-	'routes' => [
40
-		['name' => 'lost#email', 'url' => '/lostpassword/email', 'verb' => 'POST'],
41
-		['name' => 'lost#resetform', 'url' => '/lostpassword/reset/form/{token}/{userId}', 'verb' => 'GET'],
42
-		['name' => 'lost#setPassword', 'url' => '/lostpassword/set/{token}/{userId}', 'verb' => 'POST'],
43
-		['name' => 'user#getDisplayNames', 'url' => '/displaynames', 'verb' => 'POST'],
44
-		['name' => 'avatar#getAvatar', 'url' => '/avatar/{userId}/{size}', 'verb' => 'GET'],
45
-		['name' => 'avatar#deleteAvatar', 'url' => '/avatar/', 'verb' => 'DELETE'],
46
-		['name' => 'avatar#postCroppedAvatar', 'url' => '/avatar/cropped', 'verb' => 'POST'],
47
-		['name' => 'avatar#getTmpAvatar', 'url' => '/avatar/tmp', 'verb' => 'GET'],
48
-		['name' => 'avatar#postAvatar', 'url' => '/avatar/', 'verb' => 'POST'],
49
-		['name' => 'CSRFToken#index', 'url' => '/csrftoken', 'verb' => 'GET'],
50
-		['name' => 'login#tryLogin', 'url' => '/login', 'verb' => 'POST'],
51
-		['name' => 'login#confirmPassword', 'url' => '/login/confirm', 'verb' => 'POST'],
52
-		['name' => 'login#showLoginForm', 'url' => '/login', 'verb' => 'GET'],
53
-		['name' => 'login#logout', 'url' => '/logout', 'verb' => 'GET'],
54
-		['name' => 'ClientFlowLogin#showAuthPickerPage', 'url' => '/login/flow', 'verb' => 'GET'],
55
-		['name' => 'ClientFlowLogin#redirectPage', 'url' => '/login/flow/redirect', 'verb' => 'GET'],
56
-		['name' => 'ClientFlowLogin#generateAppPassword', 'url' => '/login/flow', 'verb' => 'POST'],
57
-		['name' => 'ClientFlowLogin#grantPage', 'url' => '/login/flow/grant', 'verb' => 'GET'],
58
-		['name' => 'TwoFactorChallenge#selectChallenge', 'url' => '/login/selectchallenge', 'verb' => 'GET'],
59
-		['name' => 'TwoFactorChallenge#showChallenge', 'url' => '/login/challenge/{challengeProviderId}', 'verb' => 'GET'],
60
-		['name' => 'TwoFactorChallenge#solveChallenge', 'url' => '/login/challenge/{challengeProviderId}', 'verb' => 'POST'],
61
-		['name' => 'OCJS#getConfig', 'url' => '/core/js/oc.js', 'verb' => 'GET'],
62
-		['name' => 'Preview#getPreviewByFileId', 'url' => '/core/preview', 'verb' => 'GET'],
63
-		['name' => 'Preview#getPreview', 'url' => '/core/preview.png', 'verb' => 'GET'],
64
-		['name' => 'Css#getCss', 'url' => '/css/{appName}/{fileName}', 'verb' => 'GET'],
65
-		['name' => 'Js#getJs', 'url' => '/js/{appName}/{fileName}', 'verb' => 'GET'],
66
-		['name' => 'contactsMenu#index', 'url' => '/contactsmenu/contacts', 'verb' => 'POST'],
67
-		['name' => 'contactsMenu#findOne', 'url' => '/contactsmenu/findOne', 'verb' => 'POST'],
68
-		['name' => 'WalledGarden#get', 'url' => '/204', 'verb' => 'GET'],
69
-		['name' => 'Search#search', 'url' => '/core/search', 'verb' => 'GET'],
70
-	],
71
-	'ocs' => [
72
-		['root' => '/cloud', 'name' => 'OCS#getCapabilities', 'url' => '/capabilities', 'verb' => 'GET'],
73
-		['root' => '', 'name' => 'OCS#getConfig', 'url' => '/config', 'verb' => 'GET'],
74
-		['root' => '/person', 'name' => 'OCS#personCheck', 'url' => '/check', 'verb' => 'POST'],
75
-		['root' => '/identityproof', 'name' => 'OCS#getIdentityProof', 'url' => '/key/{cloudId}', 'verb' => 'GET'],
76
-		['root' => '/core', 'name' => 'Navigation#getAppsNavigation', 'url' => '/navigation/apps', 'verb' => 'GET'],
77
-		['root' => '/core', 'name' => 'Navigation#getSettingsNavigation', 'url' => '/navigation/settings', 'verb' => 'GET'],
78
-		['root' => '/core', 'name' => 'AutoComplete#get', 'url' => '/autocomplete/get', 'verb' => 'GET'],
79
-	],
39
+    'routes' => [
40
+        ['name' => 'lost#email', 'url' => '/lostpassword/email', 'verb' => 'POST'],
41
+        ['name' => 'lost#resetform', 'url' => '/lostpassword/reset/form/{token}/{userId}', 'verb' => 'GET'],
42
+        ['name' => 'lost#setPassword', 'url' => '/lostpassword/set/{token}/{userId}', 'verb' => 'POST'],
43
+        ['name' => 'user#getDisplayNames', 'url' => '/displaynames', 'verb' => 'POST'],
44
+        ['name' => 'avatar#getAvatar', 'url' => '/avatar/{userId}/{size}', 'verb' => 'GET'],
45
+        ['name' => 'avatar#deleteAvatar', 'url' => '/avatar/', 'verb' => 'DELETE'],
46
+        ['name' => 'avatar#postCroppedAvatar', 'url' => '/avatar/cropped', 'verb' => 'POST'],
47
+        ['name' => 'avatar#getTmpAvatar', 'url' => '/avatar/tmp', 'verb' => 'GET'],
48
+        ['name' => 'avatar#postAvatar', 'url' => '/avatar/', 'verb' => 'POST'],
49
+        ['name' => 'CSRFToken#index', 'url' => '/csrftoken', 'verb' => 'GET'],
50
+        ['name' => 'login#tryLogin', 'url' => '/login', 'verb' => 'POST'],
51
+        ['name' => 'login#confirmPassword', 'url' => '/login/confirm', 'verb' => 'POST'],
52
+        ['name' => 'login#showLoginForm', 'url' => '/login', 'verb' => 'GET'],
53
+        ['name' => 'login#logout', 'url' => '/logout', 'verb' => 'GET'],
54
+        ['name' => 'ClientFlowLogin#showAuthPickerPage', 'url' => '/login/flow', 'verb' => 'GET'],
55
+        ['name' => 'ClientFlowLogin#redirectPage', 'url' => '/login/flow/redirect', 'verb' => 'GET'],
56
+        ['name' => 'ClientFlowLogin#generateAppPassword', 'url' => '/login/flow', 'verb' => 'POST'],
57
+        ['name' => 'ClientFlowLogin#grantPage', 'url' => '/login/flow/grant', 'verb' => 'GET'],
58
+        ['name' => 'TwoFactorChallenge#selectChallenge', 'url' => '/login/selectchallenge', 'verb' => 'GET'],
59
+        ['name' => 'TwoFactorChallenge#showChallenge', 'url' => '/login/challenge/{challengeProviderId}', 'verb' => 'GET'],
60
+        ['name' => 'TwoFactorChallenge#solveChallenge', 'url' => '/login/challenge/{challengeProviderId}', 'verb' => 'POST'],
61
+        ['name' => 'OCJS#getConfig', 'url' => '/core/js/oc.js', 'verb' => 'GET'],
62
+        ['name' => 'Preview#getPreviewByFileId', 'url' => '/core/preview', 'verb' => 'GET'],
63
+        ['name' => 'Preview#getPreview', 'url' => '/core/preview.png', 'verb' => 'GET'],
64
+        ['name' => 'Css#getCss', 'url' => '/css/{appName}/{fileName}', 'verb' => 'GET'],
65
+        ['name' => 'Js#getJs', 'url' => '/js/{appName}/{fileName}', 'verb' => 'GET'],
66
+        ['name' => 'contactsMenu#index', 'url' => '/contactsmenu/contacts', 'verb' => 'POST'],
67
+        ['name' => 'contactsMenu#findOne', 'url' => '/contactsmenu/findOne', 'verb' => 'POST'],
68
+        ['name' => 'WalledGarden#get', 'url' => '/204', 'verb' => 'GET'],
69
+        ['name' => 'Search#search', 'url' => '/core/search', 'verb' => 'GET'],
70
+    ],
71
+    'ocs' => [
72
+        ['root' => '/cloud', 'name' => 'OCS#getCapabilities', 'url' => '/capabilities', 'verb' => 'GET'],
73
+        ['root' => '', 'name' => 'OCS#getConfig', 'url' => '/config', 'verb' => 'GET'],
74
+        ['root' => '/person', 'name' => 'OCS#personCheck', 'url' => '/check', 'verb' => 'POST'],
75
+        ['root' => '/identityproof', 'name' => 'OCS#getIdentityProof', 'url' => '/key/{cloudId}', 'verb' => 'GET'],
76
+        ['root' => '/core', 'name' => 'Navigation#getAppsNavigation', 'url' => '/navigation/apps', 'verb' => 'GET'],
77
+        ['root' => '/core', 'name' => 'Navigation#getSettingsNavigation', 'url' => '/navigation/settings', 'verb' => 'GET'],
78
+        ['root' => '/core', 'name' => 'AutoComplete#get', 'url' => '/autocomplete/get', 'verb' => 'GET'],
79
+    ],
80 80
 ]);
81 81
 
82 82
 // Post installation check
@@ -85,12 +85,12 @@  discard block
 block discarded – undo
85 85
 // Core ajax actions
86 86
 // Routing
87 87
 $this->create('core_ajax_update', '/core/ajax/update.php')
88
-	->actionInclude('core/ajax/update.php');
88
+    ->actionInclude('core/ajax/update.php');
89 89
 
90 90
 // File routes
91 91
 $this->create('files.viewcontroller.showFile', '/f/{fileid}')->action(function($urlParams) {
92
-	$app = new \OCA\Files\AppInfo\Application($urlParams);
93
-	$app->dispatch('ViewController', 'index');
92
+    $app = new \OCA\Files\AppInfo\Application($urlParams);
93
+    $app->dispatch('ViewController', 'index');
94 94
 });
95 95
 
96 96
 // Call routes
@@ -99,12 +99,12 @@  discard block
 block discarded – undo
99 99
  * @suppress PhanUndeclaredClassMethod
100 100
  */
101 101
 $this->create('spreed.pagecontroller.showCall', '/call/{token}')->action(function($urlParams) {
102
-	if (class_exists(\OCA\Spreed\AppInfo\Application::class, false)) {
103
-		$app = new \OCA\Spreed\AppInfo\Application($urlParams);
104
-		$app->dispatch('PageController', 'index');
105
-	} else {
106
-		throw new \OC\HintException('App spreed is not enabled');
107
-	}
102
+    if (class_exists(\OCA\Spreed\AppInfo\Application::class, false)) {
103
+        $app = new \OCA\Spreed\AppInfo\Application($urlParams);
104
+        $app->dispatch('PageController', 'index');
105
+    } else {
106
+        throw new \OC\HintException('App spreed is not enabled');
107
+    }
108 108
 });
109 109
 
110 110
 // OCM routes
@@ -113,12 +113,12 @@  discard block
 block discarded – undo
113 113
  * @suppress PhanUndeclaredClassMethod
114 114
  */
115 115
 $this->create('cloud_federation_api.requesthandlercontroller.addShare', '/ocm/shares')->post()->action(function($urlParams) {
116
-	if (class_exists(\OCA\CloudFederationAPI\AppInfo\Application::class, false)) {
117
-		$app = new \OCA\CloudFederationAPI\AppInfo\Application($urlParams);
118
-		$app->dispatch('RequestHandlerController', 'addShare');
119
-	} else {
120
-		throw new \OC\HintException('Cloud Federation API not enabled');
121
-	}
116
+    if (class_exists(\OCA\CloudFederationAPI\AppInfo\Application::class, false)) {
117
+        $app = new \OCA\CloudFederationAPI\AppInfo\Application($urlParams);
118
+        $app->dispatch('RequestHandlerController', 'addShare');
119
+    } else {
120
+        throw new \OC\HintException('Cloud Federation API not enabled');
121
+    }
122 122
 });
123 123
 
124 124
 /**
@@ -126,53 +126,53 @@  discard block
 block discarded – undo
126 126
  * @suppress PhanUndeclaredClassMethod
127 127
  */
128 128
 $this->create('cloud_federation_api.requesthandlercontroller.receiveNotification', '/ocm/notifications')->post()->action(function($urlParams) {
129
-	if (class_exists(\OCA\CloudFederationAPI\AppInfo\Application::class, false)) {
130
-		$app = new \OCA\CloudFederationAPI\AppInfo\Application($urlParams);
131
-		$app->dispatch('RequestHandlerController', 'receiveNotification');
132
-	} else {
133
-		throw new \OC\HintException('Cloud Federation API not enabled');
134
-	}
129
+    if (class_exists(\OCA\CloudFederationAPI\AppInfo\Application::class, false)) {
130
+        $app = new \OCA\CloudFederationAPI\AppInfo\Application($urlParams);
131
+        $app->dispatch('RequestHandlerController', 'receiveNotification');
132
+    } else {
133
+        throw new \OC\HintException('Cloud Federation API not enabled');
134
+    }
135 135
 });
136 136
 
137 137
 
138 138
 // Sharing routes
139 139
 $this->create('files_sharing.sharecontroller.showShare', '/s/{token}')->action(function($urlParams) {
140
-	if (class_exists(\OCA\Files_Sharing\AppInfo\Application::class, false)) {
141
-		$app = new \OCA\Files_Sharing\AppInfo\Application($urlParams);
142
-		$app->dispatch('ShareController', 'showShare');
143
-	} else {
144
-		throw new \OC\HintException('App file sharing is not enabled');
145
-	}
140
+    if (class_exists(\OCA\Files_Sharing\AppInfo\Application::class, false)) {
141
+        $app = new \OCA\Files_Sharing\AppInfo\Application($urlParams);
142
+        $app->dispatch('ShareController', 'showShare');
143
+    } else {
144
+        throw new \OC\HintException('App file sharing is not enabled');
145
+    }
146 146
 });
147 147
 $this->create('files_sharing.sharecontroller.authenticate', '/s/{token}/authenticate/{redirect}')->post()->action(function($urlParams) {
148
-	if (class_exists(\OCA\Files_Sharing\AppInfo\Application::class, false)) {
149
-		$app = new \OCA\Files_Sharing\AppInfo\Application($urlParams);
150
-		$app->dispatch('ShareController', 'authenticate');
151
-	} else {
152
-		throw new \OC\HintException('App file sharing is not enabled');
153
-	}
148
+    if (class_exists(\OCA\Files_Sharing\AppInfo\Application::class, false)) {
149
+        $app = new \OCA\Files_Sharing\AppInfo\Application($urlParams);
150
+        $app->dispatch('ShareController', 'authenticate');
151
+    } else {
152
+        throw new \OC\HintException('App file sharing is not enabled');
153
+    }
154 154
 });
155 155
 $this->create('files_sharing.sharecontroller.showAuthenticate', '/s/{token}/authenticate/{redirect}')->get()->action(function($urlParams) {
156
-	if (class_exists(\OCA\Files_Sharing\AppInfo\Application::class, false)) {
157
-		$app = new \OCA\Files_Sharing\AppInfo\Application($urlParams);
158
-		$app->dispatch('ShareController', 'showAuthenticate');
159
-	} else {
160
-		throw new \OC\HintException('App file sharing is not enabled');
161
-	}
156
+    if (class_exists(\OCA\Files_Sharing\AppInfo\Application::class, false)) {
157
+        $app = new \OCA\Files_Sharing\AppInfo\Application($urlParams);
158
+        $app->dispatch('ShareController', 'showAuthenticate');
159
+    } else {
160
+        throw new \OC\HintException('App file sharing is not enabled');
161
+    }
162 162
 });
163 163
 $this->create('files_sharing.sharecontroller.downloadShare', '/s/{token}/download')->get()->action(function($urlParams) {
164
-	if (class_exists(\OCA\Files_Sharing\AppInfo\Application::class, false)) {
165
-		$app = new \OCA\Files_Sharing\AppInfo\Application($urlParams);
166
-		$app->dispatch('ShareController', 'downloadShare');
167
-	} else {
168
-		throw new \OC\HintException('App file sharing is not enabled');
169
-	}
164
+    if (class_exists(\OCA\Files_Sharing\AppInfo\Application::class, false)) {
165
+        $app = new \OCA\Files_Sharing\AppInfo\Application($urlParams);
166
+        $app->dispatch('ShareController', 'downloadShare');
167
+    } else {
168
+        throw new \OC\HintException('App file sharing is not enabled');
169
+    }
170 170
 });
171 171
 $this->create('files_sharing.publicpreview.directLink', '/s/{token}/preview')->get()->action(function($urlParams) {
172
-	if (class_exists(\OCA\Files_Sharing\AppInfo\Application::class, false)) {
173
-		$app = new \OCA\Files_Sharing\AppInfo\Application($urlParams);
174
-		$app->dispatch('PublicPreviewController', 'directLink');
175
-	} else {
176
-		throw new \OC\HintException('App file sharing is not enabled');
177
-	}
172
+    if (class_exists(\OCA\Files_Sharing\AppInfo\Application::class, false)) {
173
+        $app = new \OCA\Files_Sharing\AppInfo\Application($urlParams);
174
+        $app->dispatch('PublicPreviewController', 'directLink');
175
+    } else {
176
+        throw new \OC\HintException('App file sharing is not enabled');
177
+    }
178 178
 });
Please login to merge, or discard this patch.
lib/public/IServerContainer.php 1 patch
Indentation   +505 added lines, -505 removed lines patch added patch discarded remove patch
@@ -60,509 +60,509 @@
 block discarded – undo
60 60
  */
61 61
 interface IServerContainer extends IContainer {
62 62
 
63
-	/**
64
-	 * The calendar manager will act as a broker between consumers for calendar information and
65
-	 * providers which actual deliver the calendar information.
66
-	 *
67
-	 * @return \OCP\Calendar\IManager
68
-	 * @since 13.0.0
69
-	 */
70
-	public function getCalendarManager();
71
-
72
-	/**
73
-	 * The contacts manager will act as a broker between consumers for contacts information and
74
-	 * providers which actual deliver the contact information.
75
-	 *
76
-	 * @return \OCP\Contacts\IManager
77
-	 * @since 6.0.0
78
-	 */
79
-	public function getContactsManager();
80
-
81
-	/**
82
-	 * The current request object holding all information about the request currently being processed
83
-	 * is returned from this method.
84
-	 * In case the current execution was not initiated by a web request null is returned
85
-	 *
86
-	 * @return \OCP\IRequest
87
-	 * @since 6.0.0
88
-	 */
89
-	public function getRequest();
90
-
91
-	/**
92
-	 * Returns the preview manager which can create preview images for a given file
93
-	 *
94
-	 * @return \OCP\IPreview
95
-	 * @since 6.0.0
96
-	 */
97
-	public function getPreviewManager();
98
-
99
-	/**
100
-	 * Returns the tag manager which can get and set tags for different object types
101
-	 *
102
-	 * @see \OCP\ITagManager::load()
103
-	 * @return \OCP\ITagManager
104
-	 * @since 6.0.0
105
-	 */
106
-	public function getTagManager();
107
-
108
-	/**
109
-	 * Returns the root folder of ownCloud's data directory
110
-	 *
111
-	 * @return \OCP\Files\IRootFolder
112
-	 * @since 6.0.0 - between 6.0.0 and 8.0.0 this returned \OCP\Files\Folder
113
-	 */
114
-	public function getRootFolder();
115
-
116
-	/**
117
-	 * Returns a view to ownCloud's files folder
118
-	 *
119
-	 * @param string $userId user ID
120
-	 * @return \OCP\Files\Folder
121
-	 * @since 6.0.0 - parameter $userId was added in 8.0.0
122
-	 * @see getUserFolder in \OCP\Files\IRootFolder
123
-	 */
124
-	public function getUserFolder($userId = null);
125
-
126
-	/**
127
-	 * Returns an app-specific view in ownClouds data directory
128
-	 *
129
-	 * @return \OCP\Files\Folder
130
-	 * @since 6.0.0
131
-	 * @deprecated 9.2.0 use IAppData
132
-	 */
133
-	public function getAppFolder();
134
-
135
-	/**
136
-	 * Returns a user manager
137
-	 *
138
-	 * @return \OCP\IUserManager
139
-	 * @since 8.0.0
140
-	 */
141
-	public function getUserManager();
142
-
143
-	/**
144
-	 * Returns a group manager
145
-	 *
146
-	 * @return \OCP\IGroupManager
147
-	 * @since 8.0.0
148
-	 */
149
-	public function getGroupManager();
150
-
151
-	/**
152
-	 * Returns the user session
153
-	 *
154
-	 * @return \OCP\IUserSession
155
-	 * @since 6.0.0
156
-	 */
157
-	public function getUserSession();
158
-
159
-	/**
160
-	 * Returns the navigation manager
161
-	 *
162
-	 * @return \OCP\INavigationManager
163
-	 * @since 6.0.0
164
-	 */
165
-	public function getNavigationManager();
166
-
167
-	/**
168
-	 * Returns the config manager
169
-	 *
170
-	 * @return \OCP\IConfig
171
-	 * @since 6.0.0
172
-	 */
173
-	public function getConfig();
174
-
175
-	/**
176
-	 * Returns a Crypto instance
177
-	 *
178
-	 * @return \OCP\Security\ICrypto
179
-	 * @since 8.0.0
180
-	 */
181
-	public function getCrypto();
182
-
183
-	/**
184
-	 * Returns a Hasher instance
185
-	 *
186
-	 * @return \OCP\Security\IHasher
187
-	 * @since 8.0.0
188
-	 */
189
-	public function getHasher();
190
-
191
-	/**
192
-	 * Returns a SecureRandom instance
193
-	 *
194
-	 * @return \OCP\Security\ISecureRandom
195
-	 * @since 8.1.0
196
-	 */
197
-	public function getSecureRandom();
198
-
199
-	/**
200
-	 * Returns a CredentialsManager instance
201
-	 *
202
-	 * @return \OCP\Security\ICredentialsManager
203
-	 * @since 9.0.0
204
-	 */
205
-	public function getCredentialsManager();
206
-
207
-	/**
208
-	 * Returns the app config manager
209
-	 *
210
-	 * @return \OCP\IAppConfig
211
-	 * @since 7.0.0
212
-	 */
213
-	public function getAppConfig();
214
-
215
-	/**
216
-	 * @return \OCP\L10N\IFactory
217
-	 * @since 8.2.0
218
-	 */
219
-	public function getL10NFactory();
220
-
221
-	/**
222
-	 * get an L10N instance
223
-	 * @param string $app appid
224
-	 * @param string $lang
225
-	 * @return \OCP\IL10N
226
-	 * @since 6.0.0 - parameter $lang was added in 8.0.0
227
-	 */
228
-	public function getL10N($app, $lang = null);
229
-
230
-	/**
231
-	 * @return \OC\Encryption\Manager
232
-	 * @since 8.1.0
233
-	 */
234
-	public function getEncryptionManager();
235
-
236
-	/**
237
-	 * @return \OC\Encryption\File
238
-	 * @since 8.1.0
239
-	 */
240
-	public function getEncryptionFilesHelper();
241
-
242
-	/**
243
-	 * @return \OCP\Encryption\Keys\IStorage
244
-	 * @since 8.1.0
245
-	 */
246
-	public function getEncryptionKeyStorage();
247
-
248
-	/**
249
-	 * Returns the URL generator
250
-	 *
251
-	 * @return \OCP\IURLGenerator
252
-	 * @since 6.0.0
253
-	 */
254
-	public function getURLGenerator();
255
-
256
-	/**
257
-	 * Returns an ICache instance
258
-	 *
259
-	 * @return \OCP\ICache
260
-	 * @since 6.0.0
261
-	 */
262
-	public function getCache();
263
-
264
-	/**
265
-	 * Returns an \OCP\CacheFactory instance
266
-	 *
267
-	 * @return \OCP\ICacheFactory
268
-	 * @since 7.0.0
269
-	 */
270
-	public function getMemCacheFactory();
271
-
272
-	/**
273
-	 * Returns the current session
274
-	 *
275
-	 * @return \OCP\ISession
276
-	 * @since 6.0.0
277
-	 */
278
-	public function getSession();
279
-
280
-	/**
281
-	 * Returns the activity manager
282
-	 *
283
-	 * @return \OCP\Activity\IManager
284
-	 * @since 6.0.0
285
-	 */
286
-	public function getActivityManager();
287
-
288
-	/**
289
-	 * Returns the current session
290
-	 *
291
-	 * @return \OCP\IDBConnection
292
-	 * @since 6.0.0
293
-	 */
294
-	public function getDatabaseConnection();
295
-
296
-	/**
297
-	 * Returns an avatar manager, used for avatar functionality
298
-	 *
299
-	 * @return \OCP\IAvatarManager
300
-	 * @since 6.0.0
301
-	 */
302
-	public function getAvatarManager();
303
-
304
-	/**
305
-	 * Returns an job list for controlling background jobs
306
-	 *
307
-	 * @return \OCP\BackgroundJob\IJobList
308
-	 * @since 7.0.0
309
-	 */
310
-	public function getJobList();
311
-
312
-	/**
313
-	 * Returns a logger instance
314
-	 *
315
-	 * @return \OCP\ILogger
316
-	 * @since 8.0.0
317
-	 */
318
-	public function getLogger();
319
-
320
-	/**
321
-	 * returns a log factory instance
322
-	 *
323
-	 * @return ILogFactory
324
-	 * @since 14.0.0
325
-	 */
326
-	public function getLogFactory();
327
-
328
-	/**
329
-	 * Returns a router for generating and matching urls
330
-	 *
331
-	 * @return \OCP\Route\IRouter
332
-	 * @since 7.0.0
333
-	 */
334
-	public function getRouter();
335
-
336
-	/**
337
-	 * Returns a search instance
338
-	 *
339
-	 * @return \OCP\ISearch
340
-	 * @since 7.0.0
341
-	 */
342
-	public function getSearch();
343
-
344
-	/**
345
-	 * Get the certificate manager for the user
346
-	 *
347
-	 * @param string $userId (optional) if not specified the current loggedin user is used, use null to get the system certificate manager
348
-	 * @return \OCP\ICertificateManager | null if $userId is null and no user is logged in
349
-	 * @since 8.0.0
350
-	 */
351
-	public function getCertificateManager($userId = null);
352
-
353
-	/**
354
-	 * Create a new event source
355
-	 *
356
-	 * @return \OCP\IEventSource
357
-	 * @since 8.0.0
358
-	 */
359
-	public function createEventSource();
360
-
361
-	/**
362
-	 * Returns an instance of the HTTP client service
363
-	 *
364
-	 * @return \OCP\Http\Client\IClientService
365
-	 * @since 8.1.0
366
-	 */
367
-	public function getHTTPClientService();
368
-
369
-	/**
370
-	 * Get the active event logger
371
-	 *
372
-	 * @return \OCP\Diagnostics\IEventLogger
373
-	 * @since 8.0.0
374
-	 */
375
-	public function getEventLogger();
376
-
377
-	/**
378
-	 * Get the active query logger
379
-	 *
380
-	 * The returned logger only logs data when debug mode is enabled
381
-	 *
382
-	 * @return \OCP\Diagnostics\IQueryLogger
383
-	 * @since 8.0.0
384
-	 */
385
-	public function getQueryLogger();
386
-
387
-	/**
388
-	 * Get the manager for temporary files and folders
389
-	 *
390
-	 * @return \OCP\ITempManager
391
-	 * @since 8.0.0
392
-	 */
393
-	public function getTempManager();
394
-
395
-	/**
396
-	 * Get the app manager
397
-	 *
398
-	 * @return \OCP\App\IAppManager
399
-	 * @since 8.0.0
400
-	 */
401
-	public function getAppManager();
402
-
403
-	/**
404
-	 * Get the webroot
405
-	 *
406
-	 * @return string
407
-	 * @since 8.0.0
408
-	 */
409
-	public function getWebRoot();
410
-
411
-	/**
412
-	 * @return \OCP\Files\Config\IMountProviderCollection
413
-	 * @since 8.0.0
414
-	 */
415
-	public function getMountProviderCollection();
416
-
417
-	/**
418
-	 * Get the IniWrapper
419
-	 *
420
-	 * @return \bantu\IniGetWrapper\IniGetWrapper
421
-	 * @since 8.0.0
422
-	 */
423
-	public function getIniWrapper();
424
-	/**
425
-	 * @return \OCP\Command\IBus
426
-	 * @since 8.1.0
427
-	 */
428
-	public function getCommandBus();
429
-
430
-	/**
431
-	 * Creates a new mailer
432
-	 *
433
-	 * @return \OCP\Mail\IMailer
434
-	 * @since 8.1.0
435
-	 */
436
-	public function getMailer();
437
-
438
-	/**
439
-	 * Get the locking provider
440
-	 *
441
-	 * @return \OCP\Lock\ILockingProvider
442
-	 * @since 8.1.0
443
-	 */
444
-	public function getLockingProvider();
445
-
446
-	/**
447
-	 * @return \OCP\Files\Mount\IMountManager
448
-	 * @since 8.2.0
449
-	 */
450
-	public function getMountManager();
451
-
452
-	/**
453
-	 * Get the MimeTypeDetector
454
-	 *
455
-	 * @return \OCP\Files\IMimeTypeDetector
456
-	 * @since 8.2.0
457
-	 */
458
-	public function getMimeTypeDetector();
459
-
460
-	/**
461
-	 * Get the MimeTypeLoader
462
-	 *
463
-	 * @return \OCP\Files\IMimeTypeLoader
464
-	 * @since 8.2.0
465
-	 */
466
-	public function getMimeTypeLoader();
467
-
468
-	/**
469
-	 * Get the EventDispatcher
470
-	 *
471
-	 * @return EventDispatcherInterface
472
-	 * @since 8.2.0
473
-	 */
474
-	public function getEventDispatcher();
475
-
476
-	/**
477
-	 * Get the Notification Manager
478
-	 *
479
-	 * @return \OCP\Notification\IManager
480
-	 * @since 9.0.0
481
-	 */
482
-	public function getNotificationManager();
483
-
484
-	/**
485
-	 * @return \OCP\Comments\ICommentsManager
486
-	 * @since 9.0.0
487
-	 */
488
-	public function getCommentsManager();
489
-
490
-	/**
491
-	 * Returns the system-tag manager
492
-	 *
493
-	 * @return \OCP\SystemTag\ISystemTagManager
494
-	 *
495
-	 * @since 9.0.0
496
-	 */
497
-	public function getSystemTagManager();
498
-
499
-	/**
500
-	 * Returns the system-tag object mapper
501
-	 *
502
-	 * @return \OCP\SystemTag\ISystemTagObjectMapper
503
-	 *
504
-	 * @since 9.0.0
505
-	 */
506
-	public function getSystemTagObjectMapper();
507
-
508
-	/**
509
-	 * Returns the share manager
510
-	 *
511
-	 * @return \OCP\Share\IManager
512
-	 * @since 9.0.0
513
-	 */
514
-	public function getShareManager();
515
-
516
-	/**
517
-	 * @return IContentSecurityPolicyManager
518
-	 * @since 9.0.0
519
-	 */
520
-	public function getContentSecurityPolicyManager();
521
-
522
-	/**
523
-	 * @return \OCP\IDateTimeZone
524
-	 * @since 8.0.0
525
-	 */
526
-	public function getDateTimeZone();
527
-
528
-	/**
529
-	 * @return \OCP\IDateTimeFormatter
530
-	 * @since 8.0.0
531
-	 */
532
-	public function getDateTimeFormatter();
533
-
534
-	/**
535
-	 * @return \OCP\Federation\ICloudIdManager
536
-	 * @since 12.0.0
537
-	 */
538
-	public function getCloudIdManager();
539
-
540
-	/**
541
-	 * @return \OCP\GlobalScale\IConfig
542
-	 */
543
-	public function getGlobalScaleConfig();
544
-
545
-	/**
546
-	 * @return ICloudFederationFactory
547
-	 * @since 14.0.0
548
-	 */
549
-	public function getCloudFederationFactory();
550
-
551
-	/**
552
-	 * @return ICloudFederationProviderManager
553
-	 * @since 14.0.0
554
-	 */
555
-	public function getCloudFederationProviderManager();
556
-
557
-	/**
558
-	 * @return \OCP\Remote\Api\IApiFactory
559
-	 * @since 13.0.0
560
-	 */
561
-	public function getRemoteApiFactory();
562
-
563
-	/**
564
-	 * @return \OCP\Remote\IInstanceFactory
565
-	 * @since 13.0.0
566
-	 */
567
-	public function getRemoteInstanceFactory();
63
+    /**
64
+     * The calendar manager will act as a broker between consumers for calendar information and
65
+     * providers which actual deliver the calendar information.
66
+     *
67
+     * @return \OCP\Calendar\IManager
68
+     * @since 13.0.0
69
+     */
70
+    public function getCalendarManager();
71
+
72
+    /**
73
+     * The contacts manager will act as a broker between consumers for contacts information and
74
+     * providers which actual deliver the contact information.
75
+     *
76
+     * @return \OCP\Contacts\IManager
77
+     * @since 6.0.0
78
+     */
79
+    public function getContactsManager();
80
+
81
+    /**
82
+     * The current request object holding all information about the request currently being processed
83
+     * is returned from this method.
84
+     * In case the current execution was not initiated by a web request null is returned
85
+     *
86
+     * @return \OCP\IRequest
87
+     * @since 6.0.0
88
+     */
89
+    public function getRequest();
90
+
91
+    /**
92
+     * Returns the preview manager which can create preview images for a given file
93
+     *
94
+     * @return \OCP\IPreview
95
+     * @since 6.0.0
96
+     */
97
+    public function getPreviewManager();
98
+
99
+    /**
100
+     * Returns the tag manager which can get and set tags for different object types
101
+     *
102
+     * @see \OCP\ITagManager::load()
103
+     * @return \OCP\ITagManager
104
+     * @since 6.0.0
105
+     */
106
+    public function getTagManager();
107
+
108
+    /**
109
+     * Returns the root folder of ownCloud's data directory
110
+     *
111
+     * @return \OCP\Files\IRootFolder
112
+     * @since 6.0.0 - between 6.0.0 and 8.0.0 this returned \OCP\Files\Folder
113
+     */
114
+    public function getRootFolder();
115
+
116
+    /**
117
+     * Returns a view to ownCloud's files folder
118
+     *
119
+     * @param string $userId user ID
120
+     * @return \OCP\Files\Folder
121
+     * @since 6.0.0 - parameter $userId was added in 8.0.0
122
+     * @see getUserFolder in \OCP\Files\IRootFolder
123
+     */
124
+    public function getUserFolder($userId = null);
125
+
126
+    /**
127
+     * Returns an app-specific view in ownClouds data directory
128
+     *
129
+     * @return \OCP\Files\Folder
130
+     * @since 6.0.0
131
+     * @deprecated 9.2.0 use IAppData
132
+     */
133
+    public function getAppFolder();
134
+
135
+    /**
136
+     * Returns a user manager
137
+     *
138
+     * @return \OCP\IUserManager
139
+     * @since 8.0.0
140
+     */
141
+    public function getUserManager();
142
+
143
+    /**
144
+     * Returns a group manager
145
+     *
146
+     * @return \OCP\IGroupManager
147
+     * @since 8.0.0
148
+     */
149
+    public function getGroupManager();
150
+
151
+    /**
152
+     * Returns the user session
153
+     *
154
+     * @return \OCP\IUserSession
155
+     * @since 6.0.0
156
+     */
157
+    public function getUserSession();
158
+
159
+    /**
160
+     * Returns the navigation manager
161
+     *
162
+     * @return \OCP\INavigationManager
163
+     * @since 6.0.0
164
+     */
165
+    public function getNavigationManager();
166
+
167
+    /**
168
+     * Returns the config manager
169
+     *
170
+     * @return \OCP\IConfig
171
+     * @since 6.0.0
172
+     */
173
+    public function getConfig();
174
+
175
+    /**
176
+     * Returns a Crypto instance
177
+     *
178
+     * @return \OCP\Security\ICrypto
179
+     * @since 8.0.0
180
+     */
181
+    public function getCrypto();
182
+
183
+    /**
184
+     * Returns a Hasher instance
185
+     *
186
+     * @return \OCP\Security\IHasher
187
+     * @since 8.0.0
188
+     */
189
+    public function getHasher();
190
+
191
+    /**
192
+     * Returns a SecureRandom instance
193
+     *
194
+     * @return \OCP\Security\ISecureRandom
195
+     * @since 8.1.0
196
+     */
197
+    public function getSecureRandom();
198
+
199
+    /**
200
+     * Returns a CredentialsManager instance
201
+     *
202
+     * @return \OCP\Security\ICredentialsManager
203
+     * @since 9.0.0
204
+     */
205
+    public function getCredentialsManager();
206
+
207
+    /**
208
+     * Returns the app config manager
209
+     *
210
+     * @return \OCP\IAppConfig
211
+     * @since 7.0.0
212
+     */
213
+    public function getAppConfig();
214
+
215
+    /**
216
+     * @return \OCP\L10N\IFactory
217
+     * @since 8.2.0
218
+     */
219
+    public function getL10NFactory();
220
+
221
+    /**
222
+     * get an L10N instance
223
+     * @param string $app appid
224
+     * @param string $lang
225
+     * @return \OCP\IL10N
226
+     * @since 6.0.0 - parameter $lang was added in 8.0.0
227
+     */
228
+    public function getL10N($app, $lang = null);
229
+
230
+    /**
231
+     * @return \OC\Encryption\Manager
232
+     * @since 8.1.0
233
+     */
234
+    public function getEncryptionManager();
235
+
236
+    /**
237
+     * @return \OC\Encryption\File
238
+     * @since 8.1.0
239
+     */
240
+    public function getEncryptionFilesHelper();
241
+
242
+    /**
243
+     * @return \OCP\Encryption\Keys\IStorage
244
+     * @since 8.1.0
245
+     */
246
+    public function getEncryptionKeyStorage();
247
+
248
+    /**
249
+     * Returns the URL generator
250
+     *
251
+     * @return \OCP\IURLGenerator
252
+     * @since 6.0.0
253
+     */
254
+    public function getURLGenerator();
255
+
256
+    /**
257
+     * Returns an ICache instance
258
+     *
259
+     * @return \OCP\ICache
260
+     * @since 6.0.0
261
+     */
262
+    public function getCache();
263
+
264
+    /**
265
+     * Returns an \OCP\CacheFactory instance
266
+     *
267
+     * @return \OCP\ICacheFactory
268
+     * @since 7.0.0
269
+     */
270
+    public function getMemCacheFactory();
271
+
272
+    /**
273
+     * Returns the current session
274
+     *
275
+     * @return \OCP\ISession
276
+     * @since 6.0.0
277
+     */
278
+    public function getSession();
279
+
280
+    /**
281
+     * Returns the activity manager
282
+     *
283
+     * @return \OCP\Activity\IManager
284
+     * @since 6.0.0
285
+     */
286
+    public function getActivityManager();
287
+
288
+    /**
289
+     * Returns the current session
290
+     *
291
+     * @return \OCP\IDBConnection
292
+     * @since 6.0.0
293
+     */
294
+    public function getDatabaseConnection();
295
+
296
+    /**
297
+     * Returns an avatar manager, used for avatar functionality
298
+     *
299
+     * @return \OCP\IAvatarManager
300
+     * @since 6.0.0
301
+     */
302
+    public function getAvatarManager();
303
+
304
+    /**
305
+     * Returns an job list for controlling background jobs
306
+     *
307
+     * @return \OCP\BackgroundJob\IJobList
308
+     * @since 7.0.0
309
+     */
310
+    public function getJobList();
311
+
312
+    /**
313
+     * Returns a logger instance
314
+     *
315
+     * @return \OCP\ILogger
316
+     * @since 8.0.0
317
+     */
318
+    public function getLogger();
319
+
320
+    /**
321
+     * returns a log factory instance
322
+     *
323
+     * @return ILogFactory
324
+     * @since 14.0.0
325
+     */
326
+    public function getLogFactory();
327
+
328
+    /**
329
+     * Returns a router for generating and matching urls
330
+     *
331
+     * @return \OCP\Route\IRouter
332
+     * @since 7.0.0
333
+     */
334
+    public function getRouter();
335
+
336
+    /**
337
+     * Returns a search instance
338
+     *
339
+     * @return \OCP\ISearch
340
+     * @since 7.0.0
341
+     */
342
+    public function getSearch();
343
+
344
+    /**
345
+     * Get the certificate manager for the user
346
+     *
347
+     * @param string $userId (optional) if not specified the current loggedin user is used, use null to get the system certificate manager
348
+     * @return \OCP\ICertificateManager | null if $userId is null and no user is logged in
349
+     * @since 8.0.0
350
+     */
351
+    public function getCertificateManager($userId = null);
352
+
353
+    /**
354
+     * Create a new event source
355
+     *
356
+     * @return \OCP\IEventSource
357
+     * @since 8.0.0
358
+     */
359
+    public function createEventSource();
360
+
361
+    /**
362
+     * Returns an instance of the HTTP client service
363
+     *
364
+     * @return \OCP\Http\Client\IClientService
365
+     * @since 8.1.0
366
+     */
367
+    public function getHTTPClientService();
368
+
369
+    /**
370
+     * Get the active event logger
371
+     *
372
+     * @return \OCP\Diagnostics\IEventLogger
373
+     * @since 8.0.0
374
+     */
375
+    public function getEventLogger();
376
+
377
+    /**
378
+     * Get the active query logger
379
+     *
380
+     * The returned logger only logs data when debug mode is enabled
381
+     *
382
+     * @return \OCP\Diagnostics\IQueryLogger
383
+     * @since 8.0.0
384
+     */
385
+    public function getQueryLogger();
386
+
387
+    /**
388
+     * Get the manager for temporary files and folders
389
+     *
390
+     * @return \OCP\ITempManager
391
+     * @since 8.0.0
392
+     */
393
+    public function getTempManager();
394
+
395
+    /**
396
+     * Get the app manager
397
+     *
398
+     * @return \OCP\App\IAppManager
399
+     * @since 8.0.0
400
+     */
401
+    public function getAppManager();
402
+
403
+    /**
404
+     * Get the webroot
405
+     *
406
+     * @return string
407
+     * @since 8.0.0
408
+     */
409
+    public function getWebRoot();
410
+
411
+    /**
412
+     * @return \OCP\Files\Config\IMountProviderCollection
413
+     * @since 8.0.0
414
+     */
415
+    public function getMountProviderCollection();
416
+
417
+    /**
418
+     * Get the IniWrapper
419
+     *
420
+     * @return \bantu\IniGetWrapper\IniGetWrapper
421
+     * @since 8.0.0
422
+     */
423
+    public function getIniWrapper();
424
+    /**
425
+     * @return \OCP\Command\IBus
426
+     * @since 8.1.0
427
+     */
428
+    public function getCommandBus();
429
+
430
+    /**
431
+     * Creates a new mailer
432
+     *
433
+     * @return \OCP\Mail\IMailer
434
+     * @since 8.1.0
435
+     */
436
+    public function getMailer();
437
+
438
+    /**
439
+     * Get the locking provider
440
+     *
441
+     * @return \OCP\Lock\ILockingProvider
442
+     * @since 8.1.0
443
+     */
444
+    public function getLockingProvider();
445
+
446
+    /**
447
+     * @return \OCP\Files\Mount\IMountManager
448
+     * @since 8.2.0
449
+     */
450
+    public function getMountManager();
451
+
452
+    /**
453
+     * Get the MimeTypeDetector
454
+     *
455
+     * @return \OCP\Files\IMimeTypeDetector
456
+     * @since 8.2.0
457
+     */
458
+    public function getMimeTypeDetector();
459
+
460
+    /**
461
+     * Get the MimeTypeLoader
462
+     *
463
+     * @return \OCP\Files\IMimeTypeLoader
464
+     * @since 8.2.0
465
+     */
466
+    public function getMimeTypeLoader();
467
+
468
+    /**
469
+     * Get the EventDispatcher
470
+     *
471
+     * @return EventDispatcherInterface
472
+     * @since 8.2.0
473
+     */
474
+    public function getEventDispatcher();
475
+
476
+    /**
477
+     * Get the Notification Manager
478
+     *
479
+     * @return \OCP\Notification\IManager
480
+     * @since 9.0.0
481
+     */
482
+    public function getNotificationManager();
483
+
484
+    /**
485
+     * @return \OCP\Comments\ICommentsManager
486
+     * @since 9.0.0
487
+     */
488
+    public function getCommentsManager();
489
+
490
+    /**
491
+     * Returns the system-tag manager
492
+     *
493
+     * @return \OCP\SystemTag\ISystemTagManager
494
+     *
495
+     * @since 9.0.0
496
+     */
497
+    public function getSystemTagManager();
498
+
499
+    /**
500
+     * Returns the system-tag object mapper
501
+     *
502
+     * @return \OCP\SystemTag\ISystemTagObjectMapper
503
+     *
504
+     * @since 9.0.0
505
+     */
506
+    public function getSystemTagObjectMapper();
507
+
508
+    /**
509
+     * Returns the share manager
510
+     *
511
+     * @return \OCP\Share\IManager
512
+     * @since 9.0.0
513
+     */
514
+    public function getShareManager();
515
+
516
+    /**
517
+     * @return IContentSecurityPolicyManager
518
+     * @since 9.0.0
519
+     */
520
+    public function getContentSecurityPolicyManager();
521
+
522
+    /**
523
+     * @return \OCP\IDateTimeZone
524
+     * @since 8.0.0
525
+     */
526
+    public function getDateTimeZone();
527
+
528
+    /**
529
+     * @return \OCP\IDateTimeFormatter
530
+     * @since 8.0.0
531
+     */
532
+    public function getDateTimeFormatter();
533
+
534
+    /**
535
+     * @return \OCP\Federation\ICloudIdManager
536
+     * @since 12.0.0
537
+     */
538
+    public function getCloudIdManager();
539
+
540
+    /**
541
+     * @return \OCP\GlobalScale\IConfig
542
+     */
543
+    public function getGlobalScaleConfig();
544
+
545
+    /**
546
+     * @return ICloudFederationFactory
547
+     * @since 14.0.0
548
+     */
549
+    public function getCloudFederationFactory();
550
+
551
+    /**
552
+     * @return ICloudFederationProviderManager
553
+     * @since 14.0.0
554
+     */
555
+    public function getCloudFederationProviderManager();
556
+
557
+    /**
558
+     * @return \OCP\Remote\Api\IApiFactory
559
+     * @since 13.0.0
560
+     */
561
+    public function getRemoteApiFactory();
562
+
563
+    /**
564
+     * @return \OCP\Remote\IInstanceFactory
565
+     * @since 13.0.0
566
+     */
567
+    public function getRemoteInstanceFactory();
568 568
 }
Please login to merge, or discard this patch.
apps/federatedfilesharing/lib/Notifications.php 1 patch
Indentation   +354 added lines, -354 removed lines patch added patch discarded remove patch
@@ -33,358 +33,358 @@
 block discarded – undo
33 33
 use OCP\OCS\IDiscoveryService;
34 34
 
35 35
 class Notifications {
36
-	const RESPONSE_FORMAT = 'json'; // default response format for ocs calls
37
-
38
-	/** @var AddressHandler */
39
-	private $addressHandler;
40
-
41
-	/** @var IClientService */
42
-	private $httpClientService;
43
-
44
-	/** @var IDiscoveryService */
45
-	private $discoveryService;
46
-
47
-	/** @var IJobList  */
48
-	private $jobList;
49
-
50
-	/** @var ICloudFederationProviderManager */
51
-	private $federationProviderManager;
52
-
53
-	/** @var ICloudFederationFactory */
54
-	private $cloudFederationFactory;
55
-
56
-	/**
57
-	 * @param AddressHandler $addressHandler
58
-	 * @param IClientService $httpClientService
59
-	 * @param IDiscoveryService $discoveryService
60
-	 * @param IJobList $jobList
61
-	 * @param ICloudFederationProviderManager $federationProviderManager
62
-	 * @param ICloudFederationFactory $cloudFederationFactory
63
-	 */
64
-	public function __construct(
65
-		AddressHandler $addressHandler,
66
-		IClientService $httpClientService,
67
-		IDiscoveryService $discoveryService,
68
-		IJobList $jobList,
69
-		ICloudFederationProviderManager $federationProviderManager,
70
-		ICloudFederationFactory $cloudFederationFactory
71
-	) {
72
-		$this->addressHandler = $addressHandler;
73
-		$this->httpClientService = $httpClientService;
74
-		$this->discoveryService = $discoveryService;
75
-		$this->jobList = $jobList;
76
-		$this->federationProviderManager = $federationProviderManager;
77
-		$this->cloudFederationFactory = $cloudFederationFactory;
78
-	}
79
-
80
-	/**
81
-	 * send server-to-server share to remote server
82
-	 *
83
-	 * @param string $token
84
-	 * @param string $shareWith
85
-	 * @param string $name
86
-	 * @param int $remote_id
87
-	 * @param string $owner
88
-	 * @param string $ownerFederatedId
89
-	 * @param string $sharedBy
90
-	 * @param string $sharedByFederatedId
91
-	 * @return bool
92
-	 * @throws \OC\HintException
93
-	 * @throws \OC\ServerNotAvailableException
94
-	 */
95
-	public function sendRemoteShare($token, $shareWith, $name, $remote_id, $owner, $ownerFederatedId, $sharedBy, $sharedByFederatedId) {
96
-
97
-		list($user, $remote) = $this->addressHandler->splitUserRemote($shareWith);
98
-
99
-		if ($user && $remote) {
100
-			$local = $this->addressHandler->generateRemoteURL();
101
-
102
-			$fields = array(
103
-				'shareWith' => $user,
104
-				'token' => $token,
105
-				'name' => $name,
106
-				'remoteId' => $remote_id,
107
-				'owner' => $owner,
108
-				'ownerFederatedId' => $ownerFederatedId,
109
-				'sharedBy' => $sharedBy,
110
-				'sharedByFederatedId' => $sharedByFederatedId,
111
-				'remote' => $local,
112
-			);
113
-
114
-			$result = $this->tryHttpPostToShareEndpoint($remote, '', $fields);
115
-			$status = json_decode($result['result'], true);
116
-
117
-			$ocsStatus = isset($status['ocs']);
118
-			$ocsSuccess = $ocsStatus && ($status['ocs']['meta']['statuscode'] === 100 || $status['ocs']['meta']['statuscode'] === 200);
119
-
120
-			if ($result['success'] && (!$ocsStatus ||$ocsSuccess)) {
121
-				\OC_Hook::emit('OCP\Share', 'federated_share_added', ['server' => $remote]);
122
-				return true;
123
-			}
124
-
125
-		}
126
-
127
-		return false;
128
-	}
129
-
130
-	/**
131
-	 * ask owner to re-share the file with the given user
132
-	 *
133
-	 * @param string $token
134
-	 * @param int $id remote Id
135
-	 * @param int $shareId internal share Id
136
-	 * @param string $remote remote address of the owner
137
-	 * @param string $shareWith
138
-	 * @param int $permission
139
-	 * @return bool
140
-	 * @throws \OC\HintException
141
-	 * @throws \OC\ServerNotAvailableException
142
-	 */
143
-	public function requestReShare($token, $id, $shareId, $remote, $shareWith, $permission) {
144
-
145
-		$fields = array(
146
-			'shareWith' => $shareWith,
147
-			'token' => $token,
148
-			'permission' => $permission,
149
-			'remoteId' => $shareId
150
-		);
151
-
152
-		$result = $this->tryHttpPostToShareEndpoint(rtrim($remote, '/'), '/' . $id . '/reshare', $fields);
153
-		$status = json_decode($result['result'], true);
154
-
155
-		$httpRequestSuccessful = $result['success'];
156
-		$ocsCallSuccessful = $status['ocs']['meta']['statuscode'] === 100 || $status['ocs']['meta']['statuscode'] === 200;
157
-		$validToken = isset($status['ocs']['data']['token']) && is_string($status['ocs']['data']['token']);
158
-		$validRemoteId = isset($status['ocs']['data']['remoteId']);
159
-
160
-		if ($httpRequestSuccessful && $ocsCallSuccessful && $validToken && $validRemoteId) {
161
-			return [
162
-				$status['ocs']['data']['token'],
163
-				(int)$status['ocs']['data']['remoteId']
164
-			];
165
-		}
166
-
167
-		return false;
168
-	}
169
-
170
-	/**
171
-	 * send server-to-server unshare to remote server
172
-	 *
173
-	 * @param string $remote url
174
-	 * @param int $id share id
175
-	 * @param string $token
176
-	 * @return bool
177
-	 */
178
-	public function sendRemoteUnShare($remote, $id, $token) {
179
-		$this->sendUpdateToRemote($remote, $id, $token, 'unshare');
180
-	}
181
-
182
-	/**
183
-	 * send server-to-server unshare to remote server
184
-	 *
185
-	 * @param string $remote url
186
-	 * @param int $id share id
187
-	 * @param string $token
188
-	 * @return bool
189
-	 */
190
-	public function sendRevokeShare($remote, $id, $token) {
191
-		$this->sendUpdateToRemote($remote, $id, $token, 'revoke');
192
-	}
193
-
194
-	/**
195
-	 * send notification to remote server if the permissions was changed
196
-	 *
197
-	 * @param string $remote
198
-	 * @param int $remoteId
199
-	 * @param string $token
200
-	 * @param int $permissions
201
-	 * @return bool
202
-	 */
203
-	public function sendPermissionChange($remote, $remoteId, $token, $permissions) {
204
-		$this->sendUpdateToRemote($remote, $remoteId, $token, 'permissions', ['permissions' => $permissions]);
205
-	}
206
-
207
-	/**
208
-	 * forward accept reShare to remote server
209
-	 *
210
-	 * @param string $remote
211
-	 * @param int $remoteId
212
-	 * @param string $token
213
-	 */
214
-	public function sendAcceptShare($remote, $remoteId, $token) {
215
-		$this->sendUpdateToRemote($remote, $remoteId, $token, 'accept');
216
-	}
217
-
218
-	/**
219
-	 * forward decline reShare to remote server
220
-	 *
221
-	 * @param string $remote
222
-	 * @param int $remoteId
223
-	 * @param string $token
224
-	 */
225
-	public function sendDeclineShare($remote, $remoteId, $token) {
226
-		$this->sendUpdateToRemote($remote, $remoteId, $token, 'decline');
227
-	}
228
-
229
-	/**
230
-	 * inform remote server whether server-to-server share was accepted/declined
231
-	 *
232
-	 * @param string $remote
233
-	 * @param string $token
234
-	 * @param int $remoteId Share id on the remote host
235
-	 * @param string $action possible actions: accept, decline, unshare, revoke, permissions
236
-	 * @param array $data
237
-	 * @param int $try
238
-	 * @return boolean
239
-	 */
240
-	public function sendUpdateToRemote($remote, $remoteId, $token, $action, $data = [], $try = 0) {
241
-
242
-		$fields = array('token' => $token);
243
-		foreach ($data as $key => $value) {
244
-			$fields[$key] = $value;
245
-		}
246
-
247
-		$result = $this->tryHttpPostToShareEndpoint(rtrim($remote, '/'), '/' . $remoteId . '/' . $action, $fields);
248
-		$status = json_decode($result['result'], true);
249
-
250
-		if ($result['success'] &&
251
-			($status['ocs']['meta']['statuscode'] === 100 ||
252
-				$status['ocs']['meta']['statuscode'] === 200
253
-			)
254
-		) {
255
-			return true;
256
-		} elseif ($try === 0) {
257
-			// only add new job on first try
258
-			$this->jobList->add('OCA\FederatedFileSharing\BackgroundJob\RetryJob',
259
-				[
260
-					'remote' => $remote,
261
-					'remoteId' => $remoteId,
262
-					'token' => $token,
263
-					'action' => $action,
264
-					'data' => json_encode($data),
265
-					'try' => $try,
266
-					'lastRun' => $this->getTimestamp()
267
-				]
268
-			);
269
-		}
270
-
271
-		return false;
272
-	}
273
-
274
-
275
-	/**
276
-	 * return current timestamp
277
-	 *
278
-	 * @return int
279
-	 */
280
-	protected function getTimestamp() {
281
-		return time();
282
-	}
283
-
284
-	/**
285
-	 * try http post with the given protocol, if no protocol is given we pick
286
-	 * the secure one (https)
287
-	 *
288
-	 * @param string $remoteDomain
289
-	 * @param string $urlSuffix
290
-	 * @param array $fields post parameters
291
-	 * @param string $action define the action (possible values: share, reshare, accept, decline, unshare, revoke, permissions)
292
-	 * @return array
293
-	 * @throws \Exception
294
-	 */
295
-	protected function tryHttpPostToShareEndpoint($remoteDomain, $urlSuffix, array $fields, $action="share") {
296
-
297
-		if ($this->addressHandler->urlContainProtocol($remoteDomain) === false) {
298
-			$remoteDomain = 'https://' . $remoteDomain;
299
-		}
300
-
301
-		$result = [
302
-			'success' => false,
303
-			'result' => '',
304
-		];
305
-
306
-		// if possible we use the new OCM API
307
-		$ocmResult = $this->tryOCMEndPoint($remoteDomain, $fields, $action);
308
-		if ($ocmResult) {
309
-			$result['success'] = true;
310
-			return $result;
311
-		}
312
-
313
-		// Fall back to old API
314
-		$client = $this->httpClientService->newClient();
315
-		$federationEndpoints = $this->discoveryService->discover($remoteDomain, 'FEDERATED_SHARING');
316
-		$endpoint = isset($federationEndpoints['share']) ? $federationEndpoints['share'] : '/ocs/v2.php/cloud/shares';
317
-		try {
318
-			$response = $client->post($remoteDomain . $endpoint . $urlSuffix . '?format=' . self::RESPONSE_FORMAT, [
319
-				'body' => $fields,
320
-				'timeout' => 10,
321
-				'connect_timeout' => 10,
322
-			]);
323
-			$result['result'] = $response->getBody();
324
-			$result['success'] = true;
325
-		} catch (\Exception $e) {
326
-			// if flat re-sharing is not supported by the remote server
327
-			// we re-throw the exception and fall back to the old behaviour.
328
-			// (flat re-shares has been introduced in Nextcloud 9.1)
329
-			if ($e->getCode() === Http::STATUS_INTERNAL_SERVER_ERROR) {
330
-				throw $e;
331
-			}
332
-		}
333
-
334
-		return $result;
335
-	}
336
-
337
-	/**
338
-	 * check if server supports the new OCM api and ask for the correct end-point
339
-	 *
340
-	 * @param string $url
341
-	 * @return string
342
-	 */
343
-	protected function getOCMEndPoint($url) {
344
-		$client = $this->httpClientService->newClient();
345
-		try {
346
-			$response = $client->get($url, ['timeout' => 10, 'connect_timeout' => 10]);
347
-		} catch (\Exception $e) {
348
-			return '';
349
-		}
350
-
351
-		$result = $response->getBody();
352
-		$result = json_decode($result, true);
353
-
354
-		if (isset($result['end-point'])) {
355
-			return $result['end-point'];
356
-		}
357
-
358
-		return '';
359
-	}
360
-
361
-	/**
362
-	 * send action regarding federated sharing to the remote server using the OCM API
363
-	 *
364
-	 * @param $remoteDomain
365
-	 * @param $fields
366
-	 * @param $action
367
-	 *
368
-	 * @return bool
369
-	 */
370
-	protected function tryOCMEndPoint($remoteDomain, $fields, $action) {
371
-		switch ($action) {
372
-			case 'share':
373
-				$share = $this->cloudFederationFactory->getCloudFederationShare(
374
-					$fields['shareWith'] . '@' . $remoteDomain,
375
-					$fields['name'],
376
-					'',
377
-					$fields['remoteId'],
378
-					$fields['ownerFederatedId'],
379
-					$fields['owner'],
380
-					$fields['sharedByFederatedId'],
381
-					$fields['sharedBy'],
382
-					['name' => 'webdav', 'options' => ['access_token' => $fields['token'], 'permissions' => ['read', 'write', 'share']]],
383
-					'user',
384
-					'file'
385
-				);
386
-				return $this->federationProviderManager->sendShare($share);
387
-		}
388
-
389
-	}
36
+    const RESPONSE_FORMAT = 'json'; // default response format for ocs calls
37
+
38
+    /** @var AddressHandler */
39
+    private $addressHandler;
40
+
41
+    /** @var IClientService */
42
+    private $httpClientService;
43
+
44
+    /** @var IDiscoveryService */
45
+    private $discoveryService;
46
+
47
+    /** @var IJobList  */
48
+    private $jobList;
49
+
50
+    /** @var ICloudFederationProviderManager */
51
+    private $federationProviderManager;
52
+
53
+    /** @var ICloudFederationFactory */
54
+    private $cloudFederationFactory;
55
+
56
+    /**
57
+     * @param AddressHandler $addressHandler
58
+     * @param IClientService $httpClientService
59
+     * @param IDiscoveryService $discoveryService
60
+     * @param IJobList $jobList
61
+     * @param ICloudFederationProviderManager $federationProviderManager
62
+     * @param ICloudFederationFactory $cloudFederationFactory
63
+     */
64
+    public function __construct(
65
+        AddressHandler $addressHandler,
66
+        IClientService $httpClientService,
67
+        IDiscoveryService $discoveryService,
68
+        IJobList $jobList,
69
+        ICloudFederationProviderManager $federationProviderManager,
70
+        ICloudFederationFactory $cloudFederationFactory
71
+    ) {
72
+        $this->addressHandler = $addressHandler;
73
+        $this->httpClientService = $httpClientService;
74
+        $this->discoveryService = $discoveryService;
75
+        $this->jobList = $jobList;
76
+        $this->federationProviderManager = $federationProviderManager;
77
+        $this->cloudFederationFactory = $cloudFederationFactory;
78
+    }
79
+
80
+    /**
81
+     * send server-to-server share to remote server
82
+     *
83
+     * @param string $token
84
+     * @param string $shareWith
85
+     * @param string $name
86
+     * @param int $remote_id
87
+     * @param string $owner
88
+     * @param string $ownerFederatedId
89
+     * @param string $sharedBy
90
+     * @param string $sharedByFederatedId
91
+     * @return bool
92
+     * @throws \OC\HintException
93
+     * @throws \OC\ServerNotAvailableException
94
+     */
95
+    public function sendRemoteShare($token, $shareWith, $name, $remote_id, $owner, $ownerFederatedId, $sharedBy, $sharedByFederatedId) {
96
+
97
+        list($user, $remote) = $this->addressHandler->splitUserRemote($shareWith);
98
+
99
+        if ($user && $remote) {
100
+            $local = $this->addressHandler->generateRemoteURL();
101
+
102
+            $fields = array(
103
+                'shareWith' => $user,
104
+                'token' => $token,
105
+                'name' => $name,
106
+                'remoteId' => $remote_id,
107
+                'owner' => $owner,
108
+                'ownerFederatedId' => $ownerFederatedId,
109
+                'sharedBy' => $sharedBy,
110
+                'sharedByFederatedId' => $sharedByFederatedId,
111
+                'remote' => $local,
112
+            );
113
+
114
+            $result = $this->tryHttpPostToShareEndpoint($remote, '', $fields);
115
+            $status = json_decode($result['result'], true);
116
+
117
+            $ocsStatus = isset($status['ocs']);
118
+            $ocsSuccess = $ocsStatus && ($status['ocs']['meta']['statuscode'] === 100 || $status['ocs']['meta']['statuscode'] === 200);
119
+
120
+            if ($result['success'] && (!$ocsStatus ||$ocsSuccess)) {
121
+                \OC_Hook::emit('OCP\Share', 'federated_share_added', ['server' => $remote]);
122
+                return true;
123
+            }
124
+
125
+        }
126
+
127
+        return false;
128
+    }
129
+
130
+    /**
131
+     * ask owner to re-share the file with the given user
132
+     *
133
+     * @param string $token
134
+     * @param int $id remote Id
135
+     * @param int $shareId internal share Id
136
+     * @param string $remote remote address of the owner
137
+     * @param string $shareWith
138
+     * @param int $permission
139
+     * @return bool
140
+     * @throws \OC\HintException
141
+     * @throws \OC\ServerNotAvailableException
142
+     */
143
+    public function requestReShare($token, $id, $shareId, $remote, $shareWith, $permission) {
144
+
145
+        $fields = array(
146
+            'shareWith' => $shareWith,
147
+            'token' => $token,
148
+            'permission' => $permission,
149
+            'remoteId' => $shareId
150
+        );
151
+
152
+        $result = $this->tryHttpPostToShareEndpoint(rtrim($remote, '/'), '/' . $id . '/reshare', $fields);
153
+        $status = json_decode($result['result'], true);
154
+
155
+        $httpRequestSuccessful = $result['success'];
156
+        $ocsCallSuccessful = $status['ocs']['meta']['statuscode'] === 100 || $status['ocs']['meta']['statuscode'] === 200;
157
+        $validToken = isset($status['ocs']['data']['token']) && is_string($status['ocs']['data']['token']);
158
+        $validRemoteId = isset($status['ocs']['data']['remoteId']);
159
+
160
+        if ($httpRequestSuccessful && $ocsCallSuccessful && $validToken && $validRemoteId) {
161
+            return [
162
+                $status['ocs']['data']['token'],
163
+                (int)$status['ocs']['data']['remoteId']
164
+            ];
165
+        }
166
+
167
+        return false;
168
+    }
169
+
170
+    /**
171
+     * send server-to-server unshare to remote server
172
+     *
173
+     * @param string $remote url
174
+     * @param int $id share id
175
+     * @param string $token
176
+     * @return bool
177
+     */
178
+    public function sendRemoteUnShare($remote, $id, $token) {
179
+        $this->sendUpdateToRemote($remote, $id, $token, 'unshare');
180
+    }
181
+
182
+    /**
183
+     * send server-to-server unshare to remote server
184
+     *
185
+     * @param string $remote url
186
+     * @param int $id share id
187
+     * @param string $token
188
+     * @return bool
189
+     */
190
+    public function sendRevokeShare($remote, $id, $token) {
191
+        $this->sendUpdateToRemote($remote, $id, $token, 'revoke');
192
+    }
193
+
194
+    /**
195
+     * send notification to remote server if the permissions was changed
196
+     *
197
+     * @param string $remote
198
+     * @param int $remoteId
199
+     * @param string $token
200
+     * @param int $permissions
201
+     * @return bool
202
+     */
203
+    public function sendPermissionChange($remote, $remoteId, $token, $permissions) {
204
+        $this->sendUpdateToRemote($remote, $remoteId, $token, 'permissions', ['permissions' => $permissions]);
205
+    }
206
+
207
+    /**
208
+     * forward accept reShare to remote server
209
+     *
210
+     * @param string $remote
211
+     * @param int $remoteId
212
+     * @param string $token
213
+     */
214
+    public function sendAcceptShare($remote, $remoteId, $token) {
215
+        $this->sendUpdateToRemote($remote, $remoteId, $token, 'accept');
216
+    }
217
+
218
+    /**
219
+     * forward decline reShare to remote server
220
+     *
221
+     * @param string $remote
222
+     * @param int $remoteId
223
+     * @param string $token
224
+     */
225
+    public function sendDeclineShare($remote, $remoteId, $token) {
226
+        $this->sendUpdateToRemote($remote, $remoteId, $token, 'decline');
227
+    }
228
+
229
+    /**
230
+     * inform remote server whether server-to-server share was accepted/declined
231
+     *
232
+     * @param string $remote
233
+     * @param string $token
234
+     * @param int $remoteId Share id on the remote host
235
+     * @param string $action possible actions: accept, decline, unshare, revoke, permissions
236
+     * @param array $data
237
+     * @param int $try
238
+     * @return boolean
239
+     */
240
+    public function sendUpdateToRemote($remote, $remoteId, $token, $action, $data = [], $try = 0) {
241
+
242
+        $fields = array('token' => $token);
243
+        foreach ($data as $key => $value) {
244
+            $fields[$key] = $value;
245
+        }
246
+
247
+        $result = $this->tryHttpPostToShareEndpoint(rtrim($remote, '/'), '/' . $remoteId . '/' . $action, $fields);
248
+        $status = json_decode($result['result'], true);
249
+
250
+        if ($result['success'] &&
251
+            ($status['ocs']['meta']['statuscode'] === 100 ||
252
+                $status['ocs']['meta']['statuscode'] === 200
253
+            )
254
+        ) {
255
+            return true;
256
+        } elseif ($try === 0) {
257
+            // only add new job on first try
258
+            $this->jobList->add('OCA\FederatedFileSharing\BackgroundJob\RetryJob',
259
+                [
260
+                    'remote' => $remote,
261
+                    'remoteId' => $remoteId,
262
+                    'token' => $token,
263
+                    'action' => $action,
264
+                    'data' => json_encode($data),
265
+                    'try' => $try,
266
+                    'lastRun' => $this->getTimestamp()
267
+                ]
268
+            );
269
+        }
270
+
271
+        return false;
272
+    }
273
+
274
+
275
+    /**
276
+     * return current timestamp
277
+     *
278
+     * @return int
279
+     */
280
+    protected function getTimestamp() {
281
+        return time();
282
+    }
283
+
284
+    /**
285
+     * try http post with the given protocol, if no protocol is given we pick
286
+     * the secure one (https)
287
+     *
288
+     * @param string $remoteDomain
289
+     * @param string $urlSuffix
290
+     * @param array $fields post parameters
291
+     * @param string $action define the action (possible values: share, reshare, accept, decline, unshare, revoke, permissions)
292
+     * @return array
293
+     * @throws \Exception
294
+     */
295
+    protected function tryHttpPostToShareEndpoint($remoteDomain, $urlSuffix, array $fields, $action="share") {
296
+
297
+        if ($this->addressHandler->urlContainProtocol($remoteDomain) === false) {
298
+            $remoteDomain = 'https://' . $remoteDomain;
299
+        }
300
+
301
+        $result = [
302
+            'success' => false,
303
+            'result' => '',
304
+        ];
305
+
306
+        // if possible we use the new OCM API
307
+        $ocmResult = $this->tryOCMEndPoint($remoteDomain, $fields, $action);
308
+        if ($ocmResult) {
309
+            $result['success'] = true;
310
+            return $result;
311
+        }
312
+
313
+        // Fall back to old API
314
+        $client = $this->httpClientService->newClient();
315
+        $federationEndpoints = $this->discoveryService->discover($remoteDomain, 'FEDERATED_SHARING');
316
+        $endpoint = isset($federationEndpoints['share']) ? $federationEndpoints['share'] : '/ocs/v2.php/cloud/shares';
317
+        try {
318
+            $response = $client->post($remoteDomain . $endpoint . $urlSuffix . '?format=' . self::RESPONSE_FORMAT, [
319
+                'body' => $fields,
320
+                'timeout' => 10,
321
+                'connect_timeout' => 10,
322
+            ]);
323
+            $result['result'] = $response->getBody();
324
+            $result['success'] = true;
325
+        } catch (\Exception $e) {
326
+            // if flat re-sharing is not supported by the remote server
327
+            // we re-throw the exception and fall back to the old behaviour.
328
+            // (flat re-shares has been introduced in Nextcloud 9.1)
329
+            if ($e->getCode() === Http::STATUS_INTERNAL_SERVER_ERROR) {
330
+                throw $e;
331
+            }
332
+        }
333
+
334
+        return $result;
335
+    }
336
+
337
+    /**
338
+     * check if server supports the new OCM api and ask for the correct end-point
339
+     *
340
+     * @param string $url
341
+     * @return string
342
+     */
343
+    protected function getOCMEndPoint($url) {
344
+        $client = $this->httpClientService->newClient();
345
+        try {
346
+            $response = $client->get($url, ['timeout' => 10, 'connect_timeout' => 10]);
347
+        } catch (\Exception $e) {
348
+            return '';
349
+        }
350
+
351
+        $result = $response->getBody();
352
+        $result = json_decode($result, true);
353
+
354
+        if (isset($result['end-point'])) {
355
+            return $result['end-point'];
356
+        }
357
+
358
+        return '';
359
+    }
360
+
361
+    /**
362
+     * send action regarding federated sharing to the remote server using the OCM API
363
+     *
364
+     * @param $remoteDomain
365
+     * @param $fields
366
+     * @param $action
367
+     *
368
+     * @return bool
369
+     */
370
+    protected function tryOCMEndPoint($remoteDomain, $fields, $action) {
371
+        switch ($action) {
372
+            case 'share':
373
+                $share = $this->cloudFederationFactory->getCloudFederationShare(
374
+                    $fields['shareWith'] . '@' . $remoteDomain,
375
+                    $fields['name'],
376
+                    '',
377
+                    $fields['remoteId'],
378
+                    $fields['ownerFederatedId'],
379
+                    $fields['owner'],
380
+                    $fields['sharedByFederatedId'],
381
+                    $fields['sharedBy'],
382
+                    ['name' => 'webdav', 'options' => ['access_token' => $fields['token'], 'permissions' => ['read', 'write', 'share']]],
383
+                    'user',
384
+                    'file'
385
+                );
386
+                return $this->federationProviderManager->sendShare($share);
387
+        }
388
+
389
+    }
390 390
 }
Please login to merge, or discard this patch.
apps/federatedfilesharing/lib/BackgroundJob/RetryJob.php 1 patch
Indentation   +100 added lines, -100 removed lines patch added patch discarded remove patch
@@ -45,105 +45,105 @@
 block discarded – undo
45 45
  */
46 46
 class RetryJob extends Job {
47 47
 
48
-	/** @var  bool */
49
-	private $retainJob = true;
50
-
51
-	/** @var Notifications */
52
-	private $notifications;
53
-
54
-	/** @var int max number of attempts to send the request */
55
-	private $maxTry = 20;
56
-
57
-	/** @var int how much time should be between two tries (10 minutes) */
58
-	private $interval = 600;
59
-
60
-	/**
61
-	 * UnShare constructor.
62
-	 *
63
-	 * @param Notifications $notifications
64
-	 */
65
-	public function __construct(Notifications $notifications = null) {
66
-		if ($notifications) {
67
-			$this->notifications = $notifications;
68
-		} else {
69
-			$addressHandler = new AddressHandler(
70
-				\OC::$server->getURLGenerator(),
71
-				\OC::$server->getL10N('federatedfilesharing'),
72
-				\OC::$server->getCloudIdManager()
73
-			);
74
-			$this->notifications = new Notifications(
75
-				$addressHandler,
76
-				\OC::$server->getHTTPClientService(),
77
-				\OC::$server->query(\OCP\OCS\IDiscoveryService::class),
78
-				\OC::$server->getJobList(),
79
-				\OC::$server->getCloudFederationProviderManager(),
80
-				\OC::$server->getCloudFederationFactory()
81
-			);
82
-		}
83
-
84
-	}
85
-
86
-	/**
87
-	 * run the job, then remove it from the jobList
88
-	 *
89
-	 * @param JobList $jobList
90
-	 * @param ILogger|null $logger
91
-	 */
92
-	public function execute($jobList, ILogger $logger = null) {
93
-
94
-		if ($this->shouldRun($this->argument)) {
95
-			parent::execute($jobList, $logger);
96
-			$jobList->remove($this, $this->argument);
97
-			if ($this->retainJob) {
98
-				$this->reAddJob($jobList, $this->argument);
99
-			}
100
-		}
101
-	}
102
-
103
-	protected function run($argument) {
104
-		$remote = $argument['remote'];
105
-		$remoteId = $argument['remoteId'];
106
-		$token = $argument['token'];
107
-		$action = $argument['action'];
108
-		$data = json_decode($argument['data'], true);
109
-		$try = (int)$argument['try'] + 1;
110
-
111
-		$result = $this->notifications->sendUpdateToRemote($remote, $remoteId, $token, $action, $data, $try);
112
-
113
-		if ($result === true || $try > $this->maxTry) {
114
-			$this->retainJob = false;
115
-		}
116
-	}
117
-
118
-	/**
119
-	 * re-add background job with new arguments
120
-	 *
121
-	 * @param IJobList $jobList
122
-	 * @param array $argument
123
-	 */
124
-	protected function reAddJob(IJobList $jobList, array $argument) {
125
-		$jobList->add(RetryJob::class,
126
-			[
127
-				'remote' => $argument['remote'],
128
-				'remoteId' => $argument['remoteId'],
129
-				'token' => $argument['token'],
130
-				'data' => $argument['data'],
131
-				'action' => $argument['action'],
132
-				'try' => (int)$argument['try'] + 1,
133
-				'lastRun' => time()
134
-			]
135
-		);
136
-	}
137
-
138
-	/**
139
-	 * test if it is time for the next run
140
-	 *
141
-	 * @param array $argument
142
-	 * @return bool
143
-	 */
144
-	protected function shouldRun(array $argument) {
145
-		$lastRun = (int)$argument['lastRun'];
146
-		return ((time() - $lastRun) > $this->interval);
147
-	}
48
+    /** @var  bool */
49
+    private $retainJob = true;
50
+
51
+    /** @var Notifications */
52
+    private $notifications;
53
+
54
+    /** @var int max number of attempts to send the request */
55
+    private $maxTry = 20;
56
+
57
+    /** @var int how much time should be between two tries (10 minutes) */
58
+    private $interval = 600;
59
+
60
+    /**
61
+     * UnShare constructor.
62
+     *
63
+     * @param Notifications $notifications
64
+     */
65
+    public function __construct(Notifications $notifications = null) {
66
+        if ($notifications) {
67
+            $this->notifications = $notifications;
68
+        } else {
69
+            $addressHandler = new AddressHandler(
70
+                \OC::$server->getURLGenerator(),
71
+                \OC::$server->getL10N('federatedfilesharing'),
72
+                \OC::$server->getCloudIdManager()
73
+            );
74
+            $this->notifications = new Notifications(
75
+                $addressHandler,
76
+                \OC::$server->getHTTPClientService(),
77
+                \OC::$server->query(\OCP\OCS\IDiscoveryService::class),
78
+                \OC::$server->getJobList(),
79
+                \OC::$server->getCloudFederationProviderManager(),
80
+                \OC::$server->getCloudFederationFactory()
81
+            );
82
+        }
83
+
84
+    }
85
+
86
+    /**
87
+     * run the job, then remove it from the jobList
88
+     *
89
+     * @param JobList $jobList
90
+     * @param ILogger|null $logger
91
+     */
92
+    public function execute($jobList, ILogger $logger = null) {
93
+
94
+        if ($this->shouldRun($this->argument)) {
95
+            parent::execute($jobList, $logger);
96
+            $jobList->remove($this, $this->argument);
97
+            if ($this->retainJob) {
98
+                $this->reAddJob($jobList, $this->argument);
99
+            }
100
+        }
101
+    }
102
+
103
+    protected function run($argument) {
104
+        $remote = $argument['remote'];
105
+        $remoteId = $argument['remoteId'];
106
+        $token = $argument['token'];
107
+        $action = $argument['action'];
108
+        $data = json_decode($argument['data'], true);
109
+        $try = (int)$argument['try'] + 1;
110
+
111
+        $result = $this->notifications->sendUpdateToRemote($remote, $remoteId, $token, $action, $data, $try);
112
+
113
+        if ($result === true || $try > $this->maxTry) {
114
+            $this->retainJob = false;
115
+        }
116
+    }
117
+
118
+    /**
119
+     * re-add background job with new arguments
120
+     *
121
+     * @param IJobList $jobList
122
+     * @param array $argument
123
+     */
124
+    protected function reAddJob(IJobList $jobList, array $argument) {
125
+        $jobList->add(RetryJob::class,
126
+            [
127
+                'remote' => $argument['remote'],
128
+                'remoteId' => $argument['remoteId'],
129
+                'token' => $argument['token'],
130
+                'data' => $argument['data'],
131
+                'action' => $argument['action'],
132
+                'try' => (int)$argument['try'] + 1,
133
+                'lastRun' => time()
134
+            ]
135
+        );
136
+    }
137
+
138
+    /**
139
+     * test if it is time for the next run
140
+     *
141
+     * @param array $argument
142
+     * @return bool
143
+     */
144
+    protected function shouldRun(array $argument) {
145
+        $lastRun = (int)$argument['lastRun'];
146
+        return ((time() - $lastRun) > $this->interval);
147
+    }
148 148
 
149 149
 }
Please login to merge, or discard this patch.
apps/federatedfilesharing/lib/AppInfo/Application.php 1 patch
Indentation   +99 added lines, -99 removed lines patch added patch discarded remove patch
@@ -39,111 +39,111 @@
 block discarded – undo
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
-				);
67
-			});
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
+                );
67
+            });
68 68
 
69
-		$container->registerService('RequestHandlerController', function(SimpleContainer $c) use ($server) {
70
-			$addressHandler = new AddressHandler(
71
-				$server->getURLGenerator(),
72
-				$server->getL10N('federatedfilesharing'),
73
-				$server->getCloudIdManager()
74
-			);
75
-			$notification = new Notifications(
76
-				$addressHandler,
77
-				$server->getHTTPClientService(),
78
-				$server->query(\OCP\OCS\IDiscoveryService::class),
79
-				\OC::$server->getJobList(),
80
-				\OC::$server->getCloudFederationProviderManager(),
81
-				\OC::$server->getCloudFederationFactory()
82
-			);
83
-			return new RequestHandlerController(
84
-				$c->query('AppName'),
85
-				$server->getRequest(),
86
-				$this->getFederatedShareProvider(),
87
-				$server->getDatabaseConnection(),
88
-				$server->getShareManager(),
89
-				$notification,
90
-				$addressHandler,
91
-				$server->getUserManager(),
92
-				$server->getCloudIdManager(),
93
-				$server->getLogger(),
94
-				$server->getCloudFederationFactory(),
95
-				$server->getCloudFederationProviderManager()
96
-			);
97
-		});
98
-	}
69
+        $container->registerService('RequestHandlerController', function(SimpleContainer $c) use ($server) {
70
+            $addressHandler = new AddressHandler(
71
+                $server->getURLGenerator(),
72
+                $server->getL10N('federatedfilesharing'),
73
+                $server->getCloudIdManager()
74
+            );
75
+            $notification = new Notifications(
76
+                $addressHandler,
77
+                $server->getHTTPClientService(),
78
+                $server->query(\OCP\OCS\IDiscoveryService::class),
79
+                \OC::$server->getJobList(),
80
+                \OC::$server->getCloudFederationProviderManager(),
81
+                \OC::$server->getCloudFederationFactory()
82
+            );
83
+            return new RequestHandlerController(
84
+                $c->query('AppName'),
85
+                $server->getRequest(),
86
+                $this->getFederatedShareProvider(),
87
+                $server->getDatabaseConnection(),
88
+                $server->getShareManager(),
89
+                $notification,
90
+                $addressHandler,
91
+                $server->getUserManager(),
92
+                $server->getCloudIdManager(),
93
+                $server->getLogger(),
94
+                $server->getCloudFederationFactory(),
95
+                $server->getCloudFederationProviderManager()
96
+            );
97
+        });
98
+    }
99 99
 
100
-	/**
101
-	 * get instance of federated share provider
102
-	 *
103
-	 * @return FederatedShareProvider
104
-	 */
105
-	public function getFederatedShareProvider() {
106
-		if ($this->federatedShareProvider === null) {
107
-			$this->initFederatedShareProvider();
108
-		}
109
-		return $this->federatedShareProvider;
110
-	}
100
+    /**
101
+     * get instance of federated share provider
102
+     *
103
+     * @return FederatedShareProvider
104
+     */
105
+    public function getFederatedShareProvider() {
106
+        if ($this->federatedShareProvider === null) {
107
+            $this->initFederatedShareProvider();
108
+        }
109
+        return $this->federatedShareProvider;
110
+    }
111 111
 
112
-	/**
113
-	 * initialize federated share provider
114
-	 */
115
-	protected function initFederatedShareProvider() {
116
-		$c = $this->getContainer();
117
-		$addressHandler = new \OCA\FederatedFileSharing\AddressHandler(
118
-			\OC::$server->getURLGenerator(),
119
-			\OC::$server->getL10N('federatedfilesharing'),
120
-			\OC::$server->getCloudIdManager()
121
-		);
122
-		$notifications = new \OCA\FederatedFileSharing\Notifications(
123
-			$addressHandler,
124
-			\OC::$server->getHTTPClientService(),
125
-			\OC::$server->query(\OCP\OCS\IDiscoveryService::class),
126
-			\OC::$server->getJobList(),
127
-			\OC::$server->getCloudFederationProviderManager(),
128
-			\OC::$server->getCloudFederationFactory()
129
-		);
130
-		$tokenHandler = new \OCA\FederatedFileSharing\TokenHandler(
131
-			\OC::$server->getSecureRandom()
132
-		);
112
+    /**
113
+     * initialize federated share provider
114
+     */
115
+    protected function initFederatedShareProvider() {
116
+        $c = $this->getContainer();
117
+        $addressHandler = new \OCA\FederatedFileSharing\AddressHandler(
118
+            \OC::$server->getURLGenerator(),
119
+            \OC::$server->getL10N('federatedfilesharing'),
120
+            \OC::$server->getCloudIdManager()
121
+        );
122
+        $notifications = new \OCA\FederatedFileSharing\Notifications(
123
+            $addressHandler,
124
+            \OC::$server->getHTTPClientService(),
125
+            \OC::$server->query(\OCP\OCS\IDiscoveryService::class),
126
+            \OC::$server->getJobList(),
127
+            \OC::$server->getCloudFederationProviderManager(),
128
+            \OC::$server->getCloudFederationFactory()
129
+        );
130
+        $tokenHandler = new \OCA\FederatedFileSharing\TokenHandler(
131
+            \OC::$server->getSecureRandom()
132
+        );
133 133
 
134
-		$this->federatedShareProvider = new \OCA\FederatedFileSharing\FederatedShareProvider(
135
-			\OC::$server->getDatabaseConnection(),
136
-			$addressHandler,
137
-			$notifications,
138
-			$tokenHandler,
139
-			\OC::$server->getL10N('federatedfilesharing'),
140
-			\OC::$server->getLogger(),
141
-			\OC::$server->getLazyRootFolder(),
142
-			\OC::$server->getConfig(),
143
-			\OC::$server->getUserManager(),
144
-			\OC::$server->getCloudIdManager(),
145
-			$c->query(IConfig::class)
146
-		);
147
-	}
134
+        $this->federatedShareProvider = new \OCA\FederatedFileSharing\FederatedShareProvider(
135
+            \OC::$server->getDatabaseConnection(),
136
+            $addressHandler,
137
+            $notifications,
138
+            $tokenHandler,
139
+            \OC::$server->getL10N('federatedfilesharing'),
140
+            \OC::$server->getLogger(),
141
+            \OC::$server->getLazyRootFolder(),
142
+            \OC::$server->getConfig(),
143
+            \OC::$server->getUserManager(),
144
+            \OC::$server->getCloudIdManager(),
145
+            $c->query(IConfig::class)
146
+        );
147
+    }
148 148
 
149 149
 }
Please login to merge, or discard this patch.
lib/private/Federation/CloudFederationShare.php 1 patch
Indentation   +283 added lines, -283 removed lines patch added patch discarded remove patch
@@ -25,312 +25,312 @@
 block discarded – undo
25 25
 
26 26
 class CloudFederationShare implements ICloudFederationShare {
27 27
 
28
-	private $share = [
29
-		'shareWith' => '',
30
-		'shareType' => '',
31
-		'name' => '',
32
-		'resourceType' => '',
33
-		'description' => '',
34
-		'providerId' => '',
35
-		'owner' => '',
36
-		'ownerDisplayName' => '',
37
-		'sharedBy' => '',
38
-		'sharedByDisplayName' => '',
39
-		'protocol' => []
40
-	];
28
+    private $share = [
29
+        'shareWith' => '',
30
+        'shareType' => '',
31
+        'name' => '',
32
+        'resourceType' => '',
33
+        'description' => '',
34
+        'providerId' => '',
35
+        'owner' => '',
36
+        'ownerDisplayName' => '',
37
+        'sharedBy' => '',
38
+        'sharedByDisplayName' => '',
39
+        'protocol' => []
40
+    ];
41 41
 
42
-	/**
43
-	 * get a CloudFederationShare Object to prepare a share you want to send
44
-	 *
45
-	 * @param string $shareWith
46
-	 * @param string $name resource name (e.g. document.odt)
47
-	 * @param string $description share description (optional)
48
-	 * @param string $providerId resource UID on the provider side
49
-	 * @param string $owner provider specific UID of the user who owns the resource
50
-	 * @param string $ownerDisplayName display name of the user who shared the item
51
-	 * @param string $sharedBy provider specific UID of the user who shared the resource
52
-	 * @param string $sharedByDisplayName display name of the user who shared the resource
53
-	 * @param array $protocol (e,.g. ['name' => 'webdav', 'options' => ['username' => 'john', 'permissions' => 31]])
54
-	 * @param string $shareType ('group' or 'user' share)
55
-	 * @param $resourceType ('file', 'calendar',...)
56
-	 *
57
-	 */
58
-	public function __construct($shareWith = '',
59
-								$name = '',
60
-								$description = '',
61
-								$providerId = '',
62
-								$owner = '',
63
-								$ownerDisplayName = '',
64
-								$sharedBy = '',
65
-								$sharedByDisplayName = '',
66
-								$protocol = [],
67
-								$shareType = '',
68
-								$resourceType = ''
69
-	) {
70
-		$this->setShareWith($shareWith);
71
-		$this->setResourceName($name);
72
-		$this->setDescription($description);
73
-		$this->setProviderId($providerId);
74
-		$this->setOwner($owner);
75
-		$this->setOwnerDisplayName($ownerDisplayName);
76
-		$this->setSharedBy($sharedBy);
77
-		$this->setSharedByDisplayName($sharedByDisplayName);
78
-		$this->setProtocol($protocol);
79
-		$this->setShareType($shareType);
80
-		$this->setResourceType($resourceType);
42
+    /**
43
+     * get a CloudFederationShare Object to prepare a share you want to send
44
+     *
45
+     * @param string $shareWith
46
+     * @param string $name resource name (e.g. document.odt)
47
+     * @param string $description share description (optional)
48
+     * @param string $providerId resource UID on the provider side
49
+     * @param string $owner provider specific UID of the user who owns the resource
50
+     * @param string $ownerDisplayName display name of the user who shared the item
51
+     * @param string $sharedBy provider specific UID of the user who shared the resource
52
+     * @param string $sharedByDisplayName display name of the user who shared the resource
53
+     * @param array $protocol (e,.g. ['name' => 'webdav', 'options' => ['username' => 'john', 'permissions' => 31]])
54
+     * @param string $shareType ('group' or 'user' share)
55
+     * @param $resourceType ('file', 'calendar',...)
56
+     *
57
+     */
58
+    public function __construct($shareWith = '',
59
+                                $name = '',
60
+                                $description = '',
61
+                                $providerId = '',
62
+                                $owner = '',
63
+                                $ownerDisplayName = '',
64
+                                $sharedBy = '',
65
+                                $sharedByDisplayName = '',
66
+                                $protocol = [],
67
+                                $shareType = '',
68
+                                $resourceType = ''
69
+    ) {
70
+        $this->setShareWith($shareWith);
71
+        $this->setResourceName($name);
72
+        $this->setDescription($description);
73
+        $this->setProviderId($providerId);
74
+        $this->setOwner($owner);
75
+        $this->setOwnerDisplayName($ownerDisplayName);
76
+        $this->setSharedBy($sharedBy);
77
+        $this->setSharedByDisplayName($sharedByDisplayName);
78
+        $this->setProtocol($protocol);
79
+        $this->setShareType($shareType);
80
+        $this->setResourceType($resourceType);
81 81
 
82
-	}
82
+    }
83 83
 
84
-	/**
85
-	 * set uid of the recipient
86
-	 *
87
-	 * @param string $user
88
-	 *
89
-	 * @since 14.0.0
90
-	 */
91
-	public function setShareWith($user) {
92
-		$this->share['shareWith'] = $user;
93
-	}
84
+    /**
85
+     * set uid of the recipient
86
+     *
87
+     * @param string $user
88
+     *
89
+     * @since 14.0.0
90
+     */
91
+    public function setShareWith($user) {
92
+        $this->share['shareWith'] = $user;
93
+    }
94 94
 
95
-	/**
96
-	 * set resource name (e.g. document.odt)
97
-	 *
98
-	 * @param string $name
99
-	 *
100
-	 * @since 14.0.0
101
-	 */
102
-	public function setResourceName($name) {
103
-		$this->share['name'] = $name;
104
-	}
95
+    /**
96
+     * set resource name (e.g. document.odt)
97
+     *
98
+     * @param string $name
99
+     *
100
+     * @since 14.0.0
101
+     */
102
+    public function setResourceName($name) {
103
+        $this->share['name'] = $name;
104
+    }
105 105
 
106
-	/**
107
-	 * set resource type (e.g. file, calendar, contact,...)
108
-	 *
109
-	 * @param string $resourceType
110
-	 *
111
-	 * @since 14.0.0
112
-	 */
113
-	public function setResourceType($resourceType) {
114
-		$this->share['resourceType'] = $resourceType;
115
-	}
106
+    /**
107
+     * set resource type (e.g. file, calendar, contact,...)
108
+     *
109
+     * @param string $resourceType
110
+     *
111
+     * @since 14.0.0
112
+     */
113
+    public function setResourceType($resourceType) {
114
+        $this->share['resourceType'] = $resourceType;
115
+    }
116 116
 
117
-	/**
118
-	 * set resource description (optional)
119
-	 *
120
-	 * @param string $description
121
-	 *
122
-	 * @since 14.0.0
123
-	 */
124
-	public function setDescription($description) {
125
-		$this->share['description'] = $description;
126
-	}
117
+    /**
118
+     * set resource description (optional)
119
+     *
120
+     * @param string $description
121
+     *
122
+     * @since 14.0.0
123
+     */
124
+    public function setDescription($description) {
125
+        $this->share['description'] = $description;
126
+    }
127 127
 
128
-	/**
129
-	 * set provider ID (e.g. file ID)
130
-	 *
131
-	 * @param string $providerId
132
-	 *
133
-	 * @since 14.0.0
134
-	 */
135
-	public function setProviderId($providerId) {
136
-		$this->share['providerId'] = $providerId;
137
-	}
128
+    /**
129
+     * set provider ID (e.g. file ID)
130
+     *
131
+     * @param string $providerId
132
+     *
133
+     * @since 14.0.0
134
+     */
135
+    public function setProviderId($providerId) {
136
+        $this->share['providerId'] = $providerId;
137
+    }
138 138
 
139
-	/**
140
-	 * set owner UID
141
-	 *
142
-	 * @param string $owner
143
-	 *
144
-	 * @since 14.0.0
145
-	 */
146
-	public function setOwner($owner) {
147
-		$this->share['owner'] = $owner;
148
-	}
139
+    /**
140
+     * set owner UID
141
+     *
142
+     * @param string $owner
143
+     *
144
+     * @since 14.0.0
145
+     */
146
+    public function setOwner($owner) {
147
+        $this->share['owner'] = $owner;
148
+    }
149 149
 
150
-	/**
151
-	 * set owner display name
152
-	 *
153
-	 * @param string $ownerDisplayName
154
-	 *
155
-	 * @since 14.0.0
156
-	 */
157
-	public function setOwnerDisplayName($ownerDisplayName) {
158
-		$this->share['ownerDisplayName'] = $ownerDisplayName;
159
-	}
150
+    /**
151
+     * set owner display name
152
+     *
153
+     * @param string $ownerDisplayName
154
+     *
155
+     * @since 14.0.0
156
+     */
157
+    public function setOwnerDisplayName($ownerDisplayName) {
158
+        $this->share['ownerDisplayName'] = $ownerDisplayName;
159
+    }
160 160
 
161
-	/**
162
-	 * set UID of the user who sends the share
163
-	 *
164
-	 * @param string $sharedBy
165
-	 *
166
-	 * @since 14.0.0
167
-	 */
168
-	public function setSharedBy($sharedBy) {
169
-		$this->share['sharedBy'] = $sharedBy;
170
-	}
161
+    /**
162
+     * set UID of the user who sends the share
163
+     *
164
+     * @param string $sharedBy
165
+     *
166
+     * @since 14.0.0
167
+     */
168
+    public function setSharedBy($sharedBy) {
169
+        $this->share['sharedBy'] = $sharedBy;
170
+    }
171 171
 
172
-	/**
173
-	 * set display name of the user who sends the share
174
-	 *
175
-	 * @param $sharedByDisplayName
176
-	 *
177
-	 * @since 14.0.0
178
-	 */
179
-	public function setSharedByDisplayName($sharedByDisplayName) {
180
-		$this->share['sharedByDisplayName'] = $sharedByDisplayName;
181
-	}
172
+    /**
173
+     * set display name of the user who sends the share
174
+     *
175
+     * @param $sharedByDisplayName
176
+     *
177
+     * @since 14.0.0
178
+     */
179
+    public function setSharedByDisplayName($sharedByDisplayName) {
180
+        $this->share['sharedByDisplayName'] = $sharedByDisplayName;
181
+    }
182 182
 
183
-	/**
184
-	 * set protocol specification
185
-	 *
186
-	 * @param array $protocol
187
-	 *
188
-	 * @since 14.0.0
189
-	 */
190
-	public function setProtocol(array $protocol) {
191
-		$this->share['protocol'] = $protocol;
192
-	}
183
+    /**
184
+     * set protocol specification
185
+     *
186
+     * @param array $protocol
187
+     *
188
+     * @since 14.0.0
189
+     */
190
+    public function setProtocol(array $protocol) {
191
+        $this->share['protocol'] = $protocol;
192
+    }
193 193
 
194
-	/**
195
-	 * share type (group or user)
196
-	 *
197
-	 * @param string $shareType
198
-	 *
199
-	 * @since 14.0.0
200
-	 */
201
-	public function setShareType($shareType) {
202
-		$this->share['shareType'] = $shareType;
203
-	}
194
+    /**
195
+     * share type (group or user)
196
+     *
197
+     * @param string $shareType
198
+     *
199
+     * @since 14.0.0
200
+     */
201
+    public function setShareType($shareType) {
202
+        $this->share['shareType'] = $shareType;
203
+    }
204 204
 
205
-	/**
206
-	 * get the whole share, ready to send out
207
-	 *
208
-	 * @return array
209
-	 *
210
-	 * @since 14.0.0
211
-	 */
212
-	public function getShare() {
213
-		return $this->share;
214
-	}
205
+    /**
206
+     * get the whole share, ready to send out
207
+     *
208
+     * @return array
209
+     *
210
+     * @since 14.0.0
211
+     */
212
+    public function getShare() {
213
+        return $this->share;
214
+    }
215 215
 
216
-	/**
217
-	 * get uid of the recipient
218
-	 *
219
-	 * @return string
220
-	 *
221
-	 * @since 14.0.0
222
-	 */
223
-	public function getShareWith() {
224
-		return $this->share['shareWith'];
225
-	}
216
+    /**
217
+     * get uid of the recipient
218
+     *
219
+     * @return string
220
+     *
221
+     * @since 14.0.0
222
+     */
223
+    public function getShareWith() {
224
+        return $this->share['shareWith'];
225
+    }
226 226
 
227
-	/**
228
-	 * get resource name (e.g. file, calendar, contact,...)
229
-	 *
230
-	 * @return string
231
-	 *
232
-	 * @since 14.0.0
233
-	 */
234
-	public function getResourceName() {
235
-		return $this->share['name'];
236
-	}
227
+    /**
228
+     * get resource name (e.g. file, calendar, contact,...)
229
+     *
230
+     * @return string
231
+     *
232
+     * @since 14.0.0
233
+     */
234
+    public function getResourceName() {
235
+        return $this->share['name'];
236
+    }
237 237
 
238
-	/**
239
-	 * get resource type (e.g. file, calendar, contact,...)
240
-	 *
241
-	 * @return string
242
-	 *
243
-	 * @since 14.0.0
244
-	 */
245
-	public function getResourceType() {
246
-		return $this->share['resourceType'];
247
-	}
238
+    /**
239
+     * get resource type (e.g. file, calendar, contact,...)
240
+     *
241
+     * @return string
242
+     *
243
+     * @since 14.0.0
244
+     */
245
+    public function getResourceType() {
246
+        return $this->share['resourceType'];
247
+    }
248 248
 
249
-	/**
250
-	 * get resource description (optional)
251
-	 *
252
-	 * @return string
253
-	 *
254
-	 * @since 14.0.0
255
-	 */
256
-	public function getDescription() {
257
-		return $this->share['description'];
258
-	}
249
+    /**
250
+     * get resource description (optional)
251
+     *
252
+     * @return string
253
+     *
254
+     * @since 14.0.0
255
+     */
256
+    public function getDescription() {
257
+        return $this->share['description'];
258
+    }
259 259
 
260
-	/**
261
-	 * get provider ID (e.g. file ID)
262
-	 *
263
-	 * @return string
264
-	 *
265
-	 * @since 14.0.0
266
-	 */
267
-	public function getProviderId() {
268
-		return $this->share['providerId'];
269
-	}
260
+    /**
261
+     * get provider ID (e.g. file ID)
262
+     *
263
+     * @return string
264
+     *
265
+     * @since 14.0.0
266
+     */
267
+    public function getProviderId() {
268
+        return $this->share['providerId'];
269
+    }
270 270
 
271
-	/**
272
-	 * get owner UID
273
-	 *
274
-	 * @return string
275
-	 *
276
-	 * @since 14.0.0
277
-	 */
278
-	public function getOwner() {
279
-		return $this->share['owner'];
280
-	}
271
+    /**
272
+     * get owner UID
273
+     *
274
+     * @return string
275
+     *
276
+     * @since 14.0.0
277
+     */
278
+    public function getOwner() {
279
+        return $this->share['owner'];
280
+    }
281 281
 
282
-	/**
283
-	 * get owner display name
284
-	 *
285
-	 * @return string
286
-	 *
287
-	 * @since 14.0.0
288
-	 */
289
-	public function getOwnerDisplayName() {
290
-		return $this->share['ownerDisplayName'];
291
-	}
282
+    /**
283
+     * get owner display name
284
+     *
285
+     * @return string
286
+     *
287
+     * @since 14.0.0
288
+     */
289
+    public function getOwnerDisplayName() {
290
+        return $this->share['ownerDisplayName'];
291
+    }
292 292
 
293
-	/**
294
-	 * get UID of the user who sends the share
295
-	 *
296
-	 * @return string
297
-	 *
298
-	 * @since 14.0.0
299
-	 */
300
-	public function getSharedBy() {
301
-		return $this->share['sharedBy'];
302
-	}
293
+    /**
294
+     * get UID of the user who sends the share
295
+     *
296
+     * @return string
297
+     *
298
+     * @since 14.0.0
299
+     */
300
+    public function getSharedBy() {
301
+        return $this->share['sharedBy'];
302
+    }
303 303
 
304
-	/**
305
-	 * get display name of the user who sends the share
306
-	 *
307
-	 * @return string
308
-	 *
309
-	 * @since 14.0.0
310
-	 */
311
-	public function getSharedByDisplayName() {
312
-		return $this->share['sharedByDisplayName'];
313
-	}
304
+    /**
305
+     * get display name of the user who sends the share
306
+     *
307
+     * @return string
308
+     *
309
+     * @since 14.0.0
310
+     */
311
+    public function getSharedByDisplayName() {
312
+        return $this->share['sharedByDisplayName'];
313
+    }
314 314
 
315
-	/**
316
-	 * get share type (group or user)
317
-	 *
318
-	 * @return string
319
-	 *
320
-	 * @since 14.0.0
321
-	 */
322
-	public function getShareType() {
323
-		return $this->share['shareType'];
324
-	}
315
+    /**
316
+     * get share type (group or user)
317
+     *
318
+     * @return string
319
+     *
320
+     * @since 14.0.0
321
+     */
322
+    public function getShareType() {
323
+        return $this->share['shareType'];
324
+    }
325 325
 
326
-	/**
327
-	 * get protocol specification
328
-	 *
329
-	 * @return array
330
-	 *
331
-	 * @since 14.0.0
332
-	 */
333
-	public function getProtocol() {
334
-		return $this->share['protocol'];
335
-	}
326
+    /**
327
+     * get protocol specification
328
+     *
329
+     * @return array
330
+     *
331
+     * @since 14.0.0
332
+     */
333
+    public function getProtocol() {
334
+        return $this->share['protocol'];
335
+    }
336 336
 }
Please login to merge, or discard this patch.
lib/private/Share20/ProviderFactory.php 1 patch
Indentation   +224 added lines, -224 removed lines patch added patch discarded remove patch
@@ -48,235 +48,235 @@
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
lib/public/Federation/ICloudFederationShare.php 1 patch
Indentation   +206 added lines, -206 removed lines patch added patch discarded remove patch
@@ -23,211 +23,211 @@
 block discarded – undo
23 23
 
24 24
 interface ICloudFederationShare {
25 25
 
26
-	/**
27
-	 * set uid of the recipient
28
-	 *
29
-	 * @param string $user
30
-	 *
31
-	 * @since 14.0.0
32
-	 */
33
-	public function setShareWith($user);
34
-
35
-	/**
36
-	 * set resource name (e.g. file, calendar, contact,...)
37
-	 *
38
-	 * @param string $name
39
-	 *
40
-	 * @since 14.0.0
41
-	 */
42
-	public function setResourceName($name);
43
-
44
-	/**
45
-	 * set resource type (e.g. file, calendar, contact,...)
46
-	 *
47
-	 * @param string $resourceType
48
-	 *
49
-	 * @since 14.0.0
50
-	 */
51
-	public function setResourceType($resourceType);
52
-
53
-	/**
54
-	 * set resource description (optional)
55
-	 *
56
-	 * @param string $description
57
-	 *
58
-	 * @since 14.0.0
59
-	 */
60
-	public function setDescription($description);
61
-
62
-	/**
63
-	 * set provider ID (e.g. file ID)
64
-	 *
65
-	 * @param string $providerId
66
-	 *
67
-	 * @since 14.0.0
68
-	 */
69
-	public function setProviderId($providerId);
70
-
71
-	/**
72
-	 * set owner UID
73
-	 *
74
-	 * @param string $owner
75
-	 *
76
-	 * @since 14.0.0
77
-	 */
78
-	public function setOwner($owner);
79
-
80
-	/**
81
-	 * set owner display name
82
-	 *
83
-	 * @param string $ownerDisplayName
84
-	 *
85
-	 * @since 14.0.0
86
-	 */
87
-	public function setOwnerDisplayName($ownerDisplayName);
88
-
89
-	/**
90
-	 * set UID of the user who sends the share
91
-	 *
92
-	 * @param string $sharedBy
93
-	 *
94
-	 * @since 14.0.0
95
-	 */
96
-	public function setSharedBy($sharedBy);
97
-
98
-	/**
99
-	 * set display name of the user who sends the share
100
-	 *
101
-	 * @param $sharedByDisplayName
102
-	 *
103
-	 * @since 14.0.0
104
-	 */
105
-	public function setSharedByDisplayName($sharedByDisplayName);
106
-
107
-	/**
108
-	 * set protocol specification
109
-	 *
110
-	 * @param array $protocol
111
-	 *
112
-	 * @since 14.0.0
113
-	 */
114
-	public function setProtocol(array $protocol);
115
-
116
-	/**
117
-	 * share type (group or user)
118
-	 *
119
-	 * @param string $shareType
120
-	 *
121
-	 * @since 14.0.0
122
-	 */
123
-	public function setShareType($shareType);
124
-
125
-	/**
126
-	 * get the whole share, ready to send out
127
-	 *
128
-	 * @return array
129
-	 *
130
-	 * @since 14.0.0
131
-	 */
132
-	public function getShare();
133
-
134
-	/**
135
-	 * get uid of the recipient
136
-	 *
137
-	 * @return string
138
-	 *
139
-	 * @since 14.0.0
140
-	 */
141
-	public function getShareWith();
142
-
143
-	/**
144
-	 * get resource name (e.g. file, calendar, contact,...)
145
-	 *
146
-	 * @return string
147
-	 *
148
-	 * @since 14.0.0
149
-	 */
150
-	public function getResourceName();
151
-
152
-	/**
153
-	 * get resource type (e.g. file, calendar, contact,...)
154
-	 *
155
-	 * @return string
156
-	 *
157
-	 * @since 14.0.0
158
-	 */
159
-	public function getResourceType();
160
-
161
-	/**
162
-	 * get resource description (optional)
163
-	 *
164
-	 * @return string
165
-	 *
166
-	 * @since 14.0.0
167
-	 */
168
-	public function getDescription();
169
-
170
-	/**
171
-	 * get provider ID (e.g. file ID)
172
-	 *
173
-	 * @return string
174
-	 *
175
-	 * @since 14.0.0
176
-	 */
177
-	public function getProviderId();
178
-
179
-	/**
180
-	 * get owner UID
181
-	 *
182
-	 * @return string
183
-	 *
184
-	 * @since 14.0.0
185
-	 */
186
-	public function getOwner();
187
-
188
-	/**
189
-	 * get owner display name
190
-	 *
191
-	 * @return string
192
-	 *
193
-	 * @since 14.0.0
194
-	 */
195
-	public function getOwnerDisplayName();
196
-
197
-	/**
198
-	 * get UID of the user who sends the share
199
-	 *
200
-	 * @return string
201
-	 *
202
-	 * @since 14.0.0
203
-	 */
204
-	public function getSharedBy();
205
-
206
-	/**
207
-	 * get display name of the user who sends the share
208
-	 *
209
-	 * @return string
210
-	 *
211
-	 * @since 14.0.0
212
-	 */
213
-	public function getSharedByDisplayName();
214
-
215
-	/**
216
-	 * get share type (group or user)
217
-	 *
218
-	 * @return string
219
-	 *
220
-	 * @since 14.0.0
221
-	 */
222
-	public function getShareType();
223
-
224
-	/**
225
-	 * get protocol specification
226
-	 *
227
-	 * @return array
228
-	 *
229
-	 * @since 14.0.0
230
-	 */
231
-	public function getProtocol();
26
+    /**
27
+     * set uid of the recipient
28
+     *
29
+     * @param string $user
30
+     *
31
+     * @since 14.0.0
32
+     */
33
+    public function setShareWith($user);
34
+
35
+    /**
36
+     * set resource name (e.g. file, calendar, contact,...)
37
+     *
38
+     * @param string $name
39
+     *
40
+     * @since 14.0.0
41
+     */
42
+    public function setResourceName($name);
43
+
44
+    /**
45
+     * set resource type (e.g. file, calendar, contact,...)
46
+     *
47
+     * @param string $resourceType
48
+     *
49
+     * @since 14.0.0
50
+     */
51
+    public function setResourceType($resourceType);
52
+
53
+    /**
54
+     * set resource description (optional)
55
+     *
56
+     * @param string $description
57
+     *
58
+     * @since 14.0.0
59
+     */
60
+    public function setDescription($description);
61
+
62
+    /**
63
+     * set provider ID (e.g. file ID)
64
+     *
65
+     * @param string $providerId
66
+     *
67
+     * @since 14.0.0
68
+     */
69
+    public function setProviderId($providerId);
70
+
71
+    /**
72
+     * set owner UID
73
+     *
74
+     * @param string $owner
75
+     *
76
+     * @since 14.0.0
77
+     */
78
+    public function setOwner($owner);
79
+
80
+    /**
81
+     * set owner display name
82
+     *
83
+     * @param string $ownerDisplayName
84
+     *
85
+     * @since 14.0.0
86
+     */
87
+    public function setOwnerDisplayName($ownerDisplayName);
88
+
89
+    /**
90
+     * set UID of the user who sends the share
91
+     *
92
+     * @param string $sharedBy
93
+     *
94
+     * @since 14.0.0
95
+     */
96
+    public function setSharedBy($sharedBy);
97
+
98
+    /**
99
+     * set display name of the user who sends the share
100
+     *
101
+     * @param $sharedByDisplayName
102
+     *
103
+     * @since 14.0.0
104
+     */
105
+    public function setSharedByDisplayName($sharedByDisplayName);
106
+
107
+    /**
108
+     * set protocol specification
109
+     *
110
+     * @param array $protocol
111
+     *
112
+     * @since 14.0.0
113
+     */
114
+    public function setProtocol(array $protocol);
115
+
116
+    /**
117
+     * share type (group or user)
118
+     *
119
+     * @param string $shareType
120
+     *
121
+     * @since 14.0.0
122
+     */
123
+    public function setShareType($shareType);
124
+
125
+    /**
126
+     * get the whole share, ready to send out
127
+     *
128
+     * @return array
129
+     *
130
+     * @since 14.0.0
131
+     */
132
+    public function getShare();
133
+
134
+    /**
135
+     * get uid of the recipient
136
+     *
137
+     * @return string
138
+     *
139
+     * @since 14.0.0
140
+     */
141
+    public function getShareWith();
142
+
143
+    /**
144
+     * get resource name (e.g. file, calendar, contact,...)
145
+     *
146
+     * @return string
147
+     *
148
+     * @since 14.0.0
149
+     */
150
+    public function getResourceName();
151
+
152
+    /**
153
+     * get resource type (e.g. file, calendar, contact,...)
154
+     *
155
+     * @return string
156
+     *
157
+     * @since 14.0.0
158
+     */
159
+    public function getResourceType();
160
+
161
+    /**
162
+     * get resource description (optional)
163
+     *
164
+     * @return string
165
+     *
166
+     * @since 14.0.0
167
+     */
168
+    public function getDescription();
169
+
170
+    /**
171
+     * get provider ID (e.g. file ID)
172
+     *
173
+     * @return string
174
+     *
175
+     * @since 14.0.0
176
+     */
177
+    public function getProviderId();
178
+
179
+    /**
180
+     * get owner UID
181
+     *
182
+     * @return string
183
+     *
184
+     * @since 14.0.0
185
+     */
186
+    public function getOwner();
187
+
188
+    /**
189
+     * get owner display name
190
+     *
191
+     * @return string
192
+     *
193
+     * @since 14.0.0
194
+     */
195
+    public function getOwnerDisplayName();
196
+
197
+    /**
198
+     * get UID of the user who sends the share
199
+     *
200
+     * @return string
201
+     *
202
+     * @since 14.0.0
203
+     */
204
+    public function getSharedBy();
205
+
206
+    /**
207
+     * get display name of the user who sends the share
208
+     *
209
+     * @return string
210
+     *
211
+     * @since 14.0.0
212
+     */
213
+    public function getSharedByDisplayName();
214
+
215
+    /**
216
+     * get share type (group or user)
217
+     *
218
+     * @return string
219
+     *
220
+     * @since 14.0.0
221
+     */
222
+    public function getShareType();
223
+
224
+    /**
225
+     * get protocol specification
226
+     *
227
+     * @return array
228
+     *
229
+     * @since 14.0.0
230
+     */
231
+    public function getProtocol();
232 232
 
233 233
 }
Please login to merge, or discard this patch.
lib/public/Federation/ICloudFederationProviderManager.php 1 patch
Indentation   +64 added lines, -64 removed lines patch added patch discarded remove patch
@@ -32,76 +32,76 @@
 block discarded – undo
32 32
  */
33 33
 interface ICloudFederationProviderManager {
34 34
 
35
-	/**
36
-	 * Registers an callback function which must return an cloud federation provider
37
-	 *
38
-	 * @param string $shareType which share type does the provider handles
39
-	 * @param string $displayName user facing name of the federated share provider
40
-	 * @param callable $callback
41
-	 * @throws Exceptions\ProviderAlreadyExistsException
42
-	 *
43
-	 * @since 14.0.0
44
-	 */
45
-	public function addCloudFederationProvider($shareType, $displayName, callable $callback);
35
+    /**
36
+     * Registers an callback function which must return an cloud federation provider
37
+     *
38
+     * @param string $shareType which share type does the provider handles
39
+     * @param string $displayName user facing name of the federated share provider
40
+     * @param callable $callback
41
+     * @throws Exceptions\ProviderAlreadyExistsException
42
+     *
43
+     * @since 14.0.0
44
+     */
45
+    public function addCloudFederationProvider($shareType, $displayName, callable $callback);
46 46
 
47
-	/**
48
-	 * remove cloud federation provider
49
-	 *
50
-	 * @param string $shareType
51
-	 *
52
-	 * @since 14.0.0
53
-	 */
54
-	public function removeCloudFederationProvider($shareType);
47
+    /**
48
+     * remove cloud federation provider
49
+     *
50
+     * @param string $shareType
51
+     *
52
+     * @since 14.0.0
53
+     */
54
+    public function removeCloudFederationProvider($shareType);
55 55
 
56
-	/**
57
-	 * get a list of all cloudFederationProviders
58
-	 *
59
-	 * @return array [id => ['id' => $id, 'displayName' => $displayName, 'callback' => callback]]
60
-	 *
61
-	 * @since 14.0.0
62
-	 */
63
-	public function getAllCloudFederationProviders();
56
+    /**
57
+     * get a list of all cloudFederationProviders
58
+     *
59
+     * @return array [id => ['id' => $id, 'displayName' => $displayName, 'callback' => callback]]
60
+     *
61
+     * @since 14.0.0
62
+     */
63
+    public function getAllCloudFederationProviders();
64 64
 
65
-	/**
66
-	 * get a specific cloud federation provider
67
-	 *
68
-	 * @param string $shareType
69
-	 * @return ICloudFederationProvider
70
-	 * @throws Exceptions\ProviderDoesNotExistsException;
71
-	 *
72
-	 * @since 14.0.0
73
-	 */
74
-	public function getCloudFederationProvider($shareType);
65
+    /**
66
+     * get a specific cloud federation provider
67
+     *
68
+     * @param string $shareType
69
+     * @return ICloudFederationProvider
70
+     * @throws Exceptions\ProviderDoesNotExistsException;
71
+     *
72
+     * @since 14.0.0
73
+     */
74
+    public function getCloudFederationProvider($shareType);
75 75
 
76
-	/**
77
-	 * send federated share
78
-	 *
79
-	 * @param ICloudFederationShare $share
80
-	 * @return mixed
81
-	 *
82
-	 * @since 14.0.0
83
-	 */
84
-	public function sendShare(ICloudFederationShare $share);
76
+    /**
77
+     * send federated share
78
+     *
79
+     * @param ICloudFederationShare $share
80
+     * @return mixed
81
+     *
82
+     * @since 14.0.0
83
+     */
84
+    public function sendShare(ICloudFederationShare $share);
85 85
 
86
-	/**
87
-	 * send notification about existing share
88
-	 *
89
-	 * @param string $url
90
-	 * @param ICloudFederationNotification $notification
91
-	 * @return bool
92
-	 *
93
-	 * @since 14.0.0
94
-	 */
95
-	public function sendNotification($url, ICloudFederationNotification $notification);
86
+    /**
87
+     * send notification about existing share
88
+     *
89
+     * @param string $url
90
+     * @param ICloudFederationNotification $notification
91
+     * @return bool
92
+     *
93
+     * @since 14.0.0
94
+     */
95
+    public function sendNotification($url, ICloudFederationNotification $notification);
96 96
 
97
-	/**
98
-	 * check if the new cloud federation API is ready to be used
99
-	 *
100
-	 * @return bool
101
-	 *
102
-	 * @since 14.0.0
103
-	 */
104
-	public function isReady();
97
+    /**
98
+     * check if the new cloud federation API is ready to be used
99
+     *
100
+     * @return bool
101
+     *
102
+     * @since 14.0.0
103
+     */
104
+    public function isReady();
105 105
 
106 106
 
107 107
 }
Please login to merge, or discard this patch.