Completed
Pull Request — master (#9895)
by Björn
168:09 queued 150:46
created
lib/public/Share/IShareProvider.php 1 patch
Indentation   +168 added lines, -168 removed lines patch added patch discarded remove patch
@@ -34,172 +34,172 @@
 block discarded – undo
34 34
  */
35 35
 interface IShareProvider {
36 36
 
37
-	/**
38
-	 * Return the identifier of this provider.
39
-	 *
40
-	 * @return string Containing only [a-zA-Z0-9]
41
-	 * @since 9.0.0
42
-	 */
43
-	public function identifier();
44
-
45
-	/**
46
-	 * Create a share
47
-	 *
48
-	 * @param \OCP\Share\IShare $share
49
-	 * @return \OCP\Share\IShare The share object
50
-	 * @since 9.0.0
51
-	 */
52
-	public function create(\OCP\Share\IShare $share);
53
-
54
-	/**
55
-	 * Update a share
56
-	 *
57
-	 * @param \OCP\Share\IShare $share
58
-	 * @return \OCP\Share\IShare The share object
59
-	 * @since 9.0.0
60
-	 */
61
-	public function update(\OCP\Share\IShare $share);
62
-
63
-	/**
64
-	 * Delete a share
65
-	 *
66
-	 * @param \OCP\Share\IShare $share
67
-	 * @since 9.0.0
68
-	 */
69
-	public function delete(\OCP\Share\IShare $share);
70
-
71
-	/**
72
-	 * Unshare a file from self as recipient.
73
-	 * This may require special handling. If a user unshares a group
74
-	 * share from their self then the original group share should still exist.
75
-	 *
76
-	 * @param \OCP\Share\IShare $share
77
-	 * @param string $recipient UserId of the recipient
78
-	 * @since 9.0.0
79
-	 */
80
-	public function deleteFromSelf(\OCP\Share\IShare $share, $recipient);
81
-
82
-	/**
83
-	 * Move a share as a recipient.
84
-	 * This is updating the share target. Thus the mount point of the recipient.
85
-	 * This may require special handling. If a user moves a group share
86
-	 * the target should only be changed for them.
87
-	 *
88
-	 * @param \OCP\Share\IShare $share
89
-	 * @param string $recipient userId of recipient
90
-	 * @return \OCP\Share\IShare
91
-	 * @since 9.0.0
92
-	 */
93
-	public function move(\OCP\Share\IShare $share, $recipient);
94
-
95
-	/**
96
-	 * Get all shares by the given user in a folder
97
-	 *
98
-	 * @param string $userId
99
-	 * @param Folder $node
100
-	 * @param bool $reshares Also get the shares where $user is the owner instead of just the shares where $user is the initiator
101
-	 * @return \OCP\Share\IShare[]
102
-	 * @since 11.0.0
103
-	 */
104
-	public function getSharesInFolder($userId, Folder $node, $reshares);
105
-
106
-	/**
107
-	 * Get all shares by the given user
108
-	 *
109
-	 * @param string $userId
110
-	 * @param int $shareType
111
-	 * @param Node|null $node
112
-	 * @param bool $reshares Also get the shares where $user is the owner instead of just the shares where $user is the initiator
113
-	 * @param int $limit The maximum number of shares to be returned, -1 for all shares
114
-	 * @param int $offset
115
-	 * @return \OCP\Share\IShare[]
116
-	 * @since 9.0.0
117
-	 */
118
-	public function getSharesBy($userId, $shareType, $node, $reshares, $limit, $offset);
119
-
120
-	/**
121
-	 * Get share by id
122
-	 *
123
-	 * @param int $id
124
-	 * @param string|null $recipientId
125
-	 * @return \OCP\Share\IShare
126
-	 * @throws ShareNotFound
127
-	 * @since 9.0.0
128
-	 */
129
-	public function getShareById($id, $recipientId = null);
130
-
131
-	/**
132
-	 * Get shares for a given path
133
-	 *
134
-	 * @param Node $path
135
-	 * @return \OCP\Share\IShare[]
136
-	 * @since 9.0.0
137
-	 */
138
-	public function getSharesByPath(Node $path);
139
-
140
-	/**
141
-	 * Get shared with the given user
142
-	 *
143
-	 * @param string $userId get shares where this user is the recipient
144
-	 * @param int $shareType
145
-	 * @param Node|null $node
146
-	 * @param int $limit The max number of entries returned, -1 for all
147
-	 * @param int $offset
148
-	 * @return \OCP\Share\IShare[]
149
-	 * @since 9.0.0
150
-	 */
151
-	public function getSharedWith($userId, $shareType, $node, $limit, $offset);
152
-
153
-	/**
154
-	 * Get a share by token
155
-	 *
156
-	 * @param string $token
157
-	 * @return \OCP\Share\IShare
158
-	 * @throws ShareNotFound
159
-	 * @since 9.0.0
160
-	 */
161
-	public function getShareByToken($token);
162
-
163
-	/**
164
-	 * A user is deleted from the system
165
-	 * So clean up the relevant shares.
166
-	 *
167
-	 * @param string $uid
168
-	 * @param int $shareType
169
-	 * @since 9.1.0
170
-	 */
171
-	public function userDeleted($uid, $shareType);
172
-
173
-	/**
174
-	 * A group is deleted from the system.
175
-	 * We have to clean up all shares to this group.
176
-	 * Providers not handling group shares should just return
177
-	 *
178
-	 * @param string $gid
179
-	 * @since 9.1.0
180
-	 */
181
-	public function groupDeleted($gid);
182
-
183
-	/**
184
-	 * A user is deleted from a group
185
-	 * We have to clean up all the related user specific group shares
186
-	 * Providers not handling group shares should just return
187
-	 *
188
-	 * @param string $uid
189
-	 * @param string $gid
190
-	 * @since 9.1.0
191
-	 */
192
-	public function userDeletedFromGroup($uid, $gid);
193
-
194
-	/**
195
-	 * Get the access list to the array of provided nodes.
196
-	 *
197
-	 * @see IManager::getAccessList() for sample docs
198
-	 *
199
-	 * @param Node[] $nodes The list of nodes to get access for
200
-	 * @param bool $currentAccess If current access is required (like for removed shares that might get revived later)
201
-	 * @return array
202
-	 * @since 12
203
-	 */
204
-	public function getAccessList($nodes, $currentAccess);
37
+    /**
38
+     * Return the identifier of this provider.
39
+     *
40
+     * @return string Containing only [a-zA-Z0-9]
41
+     * @since 9.0.0
42
+     */
43
+    public function identifier();
44
+
45
+    /**
46
+     * Create a share
47
+     *
48
+     * @param \OCP\Share\IShare $share
49
+     * @return \OCP\Share\IShare The share object
50
+     * @since 9.0.0
51
+     */
52
+    public function create(\OCP\Share\IShare $share);
53
+
54
+    /**
55
+     * Update a share
56
+     *
57
+     * @param \OCP\Share\IShare $share
58
+     * @return \OCP\Share\IShare The share object
59
+     * @since 9.0.0
60
+     */
61
+    public function update(\OCP\Share\IShare $share);
62
+
63
+    /**
64
+     * Delete a share
65
+     *
66
+     * @param \OCP\Share\IShare $share
67
+     * @since 9.0.0
68
+     */
69
+    public function delete(\OCP\Share\IShare $share);
70
+
71
+    /**
72
+     * Unshare a file from self as recipient.
73
+     * This may require special handling. If a user unshares a group
74
+     * share from their self then the original group share should still exist.
75
+     *
76
+     * @param \OCP\Share\IShare $share
77
+     * @param string $recipient UserId of the recipient
78
+     * @since 9.0.0
79
+     */
80
+    public function deleteFromSelf(\OCP\Share\IShare $share, $recipient);
81
+
82
+    /**
83
+     * Move a share as a recipient.
84
+     * This is updating the share target. Thus the mount point of the recipient.
85
+     * This may require special handling. If a user moves a group share
86
+     * the target should only be changed for them.
87
+     *
88
+     * @param \OCP\Share\IShare $share
89
+     * @param string $recipient userId of recipient
90
+     * @return \OCP\Share\IShare
91
+     * @since 9.0.0
92
+     */
93
+    public function move(\OCP\Share\IShare $share, $recipient);
94
+
95
+    /**
96
+     * Get all shares by the given user in a folder
97
+     *
98
+     * @param string $userId
99
+     * @param Folder $node
100
+     * @param bool $reshares Also get the shares where $user is the owner instead of just the shares where $user is the initiator
101
+     * @return \OCP\Share\IShare[]
102
+     * @since 11.0.0
103
+     */
104
+    public function getSharesInFolder($userId, Folder $node, $reshares);
105
+
106
+    /**
107
+     * Get all shares by the given user
108
+     *
109
+     * @param string $userId
110
+     * @param int $shareType
111
+     * @param Node|null $node
112
+     * @param bool $reshares Also get the shares where $user is the owner instead of just the shares where $user is the initiator
113
+     * @param int $limit The maximum number of shares to be returned, -1 for all shares
114
+     * @param int $offset
115
+     * @return \OCP\Share\IShare[]
116
+     * @since 9.0.0
117
+     */
118
+    public function getSharesBy($userId, $shareType, $node, $reshares, $limit, $offset);
119
+
120
+    /**
121
+     * Get share by id
122
+     *
123
+     * @param int $id
124
+     * @param string|null $recipientId
125
+     * @return \OCP\Share\IShare
126
+     * @throws ShareNotFound
127
+     * @since 9.0.0
128
+     */
129
+    public function getShareById($id, $recipientId = null);
130
+
131
+    /**
132
+     * Get shares for a given path
133
+     *
134
+     * @param Node $path
135
+     * @return \OCP\Share\IShare[]
136
+     * @since 9.0.0
137
+     */
138
+    public function getSharesByPath(Node $path);
139
+
140
+    /**
141
+     * Get shared with the given user
142
+     *
143
+     * @param string $userId get shares where this user is the recipient
144
+     * @param int $shareType
145
+     * @param Node|null $node
146
+     * @param int $limit The max number of entries returned, -1 for all
147
+     * @param int $offset
148
+     * @return \OCP\Share\IShare[]
149
+     * @since 9.0.0
150
+     */
151
+    public function getSharedWith($userId, $shareType, $node, $limit, $offset);
152
+
153
+    /**
154
+     * Get a share by token
155
+     *
156
+     * @param string $token
157
+     * @return \OCP\Share\IShare
158
+     * @throws ShareNotFound
159
+     * @since 9.0.0
160
+     */
161
+    public function getShareByToken($token);
162
+
163
+    /**
164
+     * A user is deleted from the system
165
+     * So clean up the relevant shares.
166
+     *
167
+     * @param string $uid
168
+     * @param int $shareType
169
+     * @since 9.1.0
170
+     */
171
+    public function userDeleted($uid, $shareType);
172
+
173
+    /**
174
+     * A group is deleted from the system.
175
+     * We have to clean up all shares to this group.
176
+     * Providers not handling group shares should just return
177
+     *
178
+     * @param string $gid
179
+     * @since 9.1.0
180
+     */
181
+    public function groupDeleted($gid);
182
+
183
+    /**
184
+     * A user is deleted from a group
185
+     * We have to clean up all the related user specific group shares
186
+     * Providers not handling group shares should just return
187
+     *
188
+     * @param string $uid
189
+     * @param string $gid
190
+     * @since 9.1.0
191
+     */
192
+    public function userDeletedFromGroup($uid, $gid);
193
+
194
+    /**
195
+     * Get the access list to the array of provided nodes.
196
+     *
197
+     * @see IManager::getAccessList() for sample docs
198
+     *
199
+     * @param Node[] $nodes The list of nodes to get access for
200
+     * @param bool $currentAccess If current access is required (like for removed shares that might get revived later)
201
+     * @return array
202
+     * @since 12
203
+     */
204
+    public function getAccessList($nodes, $currentAccess);
205 205
 }
Please login to merge, or discard this patch.
lib/private/Share20/ProviderFactory.php 2 patches
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -32,7 +32,6 @@
 block discarded – undo
32 32
 use OCA\FederatedFileSharing\AddressHandler;
33 33
 use OCA\FederatedFileSharing\FederatedShareProvider;
34 34
 use OCA\FederatedFileSharing\Notifications;
35
-use OCA\FederatedFileSharing\OCM\CloudFederationProvider;
36 35
 use OCA\FederatedFileSharing\TokenHandler;
37 36
 use OCA\ShareByMail\Settings\SettingsManager;
38 37
 use OCA\ShareByMail\ShareByMailProvider;
Please login to merge, or discard this patch.
Indentation   +225 added lines, -225 removed lines patch added patch discarded remove patch
@@ -48,236 +48,236 @@
 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
-				$this->serverContainer->getCloudFederationProviderManager()
140
-			);
141
-		}
142
-
143
-		return $this->federatedProvider;
144
-	}
145
-
146
-	/**
147
-	 * Create the federated share provider
148
-	 *
149
-	 * @return ShareByMailProvider
150
-	 */
151
-	protected function getShareByMailProvider() {
152
-		if ($this->shareByMailProvider === null) {
153
-			/*
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
+                $this->serverContainer->getCloudFederationProviderManager()
140
+            );
141
+        }
142
+
143
+        return $this->federatedProvider;
144
+    }
145
+
146
+    /**
147
+     * Create the federated share provider
148
+     *
149
+     * @return ShareByMailProvider
150
+     */
151
+    protected function getShareByMailProvider() {
152
+        if ($this->shareByMailProvider === null) {
153
+            /*
154 154
 			 * Check if the app is enabled
155 155
 			 */
156
-			$appManager = $this->serverContainer->getAppManager();
157
-			if (!$appManager->isEnabledForUser('sharebymail')) {
158
-				return null;
159
-			}
160
-
161
-			$settingsManager = new SettingsManager($this->serverContainer->getConfig());
162
-
163
-			$this->shareByMailProvider = new ShareByMailProvider(
164
-				$this->serverContainer->getDatabaseConnection(),
165
-				$this->serverContainer->getSecureRandom(),
166
-				$this->serverContainer->getUserManager(),
167
-				$this->serverContainer->getLazyRootFolder(),
168
-				$this->serverContainer->getL10N('sharebymail'),
169
-				$this->serverContainer->getLogger(),
170
-				$this->serverContainer->getMailer(),
171
-				$this->serverContainer->getURLGenerator(),
172
-				$this->serverContainer->getActivityManager(),
173
-				$settingsManager,
174
-				$this->serverContainer->query(Defaults::class),
175
-				$this->serverContainer->getHasher(),
176
-				$this->serverContainer->query(CapabilitiesManager::class)
177
-			);
178
-		}
179
-
180
-		return $this->shareByMailProvider;
181
-	}
182
-
183
-
184
-	/**
185
-	 * Create the circle share provider
186
-	 *
187
-	 * @return FederatedShareProvider
188
-	 *
189
-	 * @suppress PhanUndeclaredClassMethod
190
-	 */
191
-	protected function getShareByCircleProvider() {
192
-
193
-		if ($this->circlesAreNotAvailable) {
194
-			return null;
195
-		}
196
-
197
-		if (!$this->serverContainer->getAppManager()->isEnabledForUser('circles') ||
198
-			!class_exists('\OCA\Circles\ShareByCircleProvider')
199
-		) {
200
-			$this->circlesAreNotAvailable = true;
201
-			return null;
202
-		}
203
-
204
-		if ($this->shareByCircleProvider === null) {
205
-
206
-			$this->shareByCircleProvider = new \OCA\Circles\ShareByCircleProvider(
207
-				$this->serverContainer->getDatabaseConnection(),
208
-				$this->serverContainer->getSecureRandom(),
209
-				$this->serverContainer->getUserManager(),
210
-				$this->serverContainer->getLazyRootFolder(),
211
-				$this->serverContainer->getL10N('circles'),
212
-				$this->serverContainer->getLogger(),
213
-				$this->serverContainer->getURLGenerator()
214
-			);
215
-		}
216
-
217
-		return $this->shareByCircleProvider;
218
-	}
219
-
220
-
221
-	/**
222
-	 * @inheritdoc
223
-	 */
224
-	public function getProvider($id) {
225
-		$provider = null;
226
-		if ($id === 'ocinternal') {
227
-			$provider = $this->defaultShareProvider();
228
-		} else if ($id === 'ocFederatedSharing') {
229
-			$provider = $this->federatedShareProvider();
230
-		} else if ($id === 'ocMailShare') {
231
-			$provider = $this->getShareByMailProvider();
232
-		} else if ($id === 'ocCircleShare') {
233
-			$provider = $this->getShareByCircleProvider();
234
-		}
235
-
236
-		if ($provider === null) {
237
-			throw new ProviderException('No provider with id .' . $id . ' found.');
238
-		}
239
-
240
-		return $provider;
241
-	}
242
-
243
-	/**
244
-	 * @inheritdoc
245
-	 */
246
-	public function getProviderForType($shareType) {
247
-		$provider = null;
248
-
249
-		if ($shareType === \OCP\Share::SHARE_TYPE_USER ||
250
-			$shareType === \OCP\Share::SHARE_TYPE_GROUP ||
251
-			$shareType === \OCP\Share::SHARE_TYPE_LINK
252
-		) {
253
-			$provider = $this->defaultShareProvider();
254
-		} else if ($shareType === \OCP\Share::SHARE_TYPE_REMOTE) {
255
-			$provider = $this->federatedShareProvider();
256
-		} else if ($shareType === \OCP\Share::SHARE_TYPE_EMAIL) {
257
-			$provider = $this->getShareByMailProvider();
258
-		} else if ($shareType === \OCP\Share::SHARE_TYPE_CIRCLE) {
259
-			$provider = $this->getShareByCircleProvider();
260
-		}
261
-
262
-
263
-		if ($provider === null) {
264
-			throw new ProviderException('No share provider for share type ' . $shareType);
265
-		}
266
-
267
-		return $provider;
268
-	}
269
-
270
-	public function getAllProviders() {
271
-		$shares = [$this->defaultShareProvider(), $this->federatedShareProvider()];
272
-		$shareByMail = $this->getShareByMailProvider();
273
-		if ($shareByMail !== null) {
274
-			$shares[] = $shareByMail;
275
-		}
276
-		$shareByCircle = $this->getShareByCircleProvider();
277
-		if ($shareByCircle !== null) {
278
-			$shares[] = $shareByCircle;
279
-		}
280
-
281
-		return $shares;
282
-	}
156
+            $appManager = $this->serverContainer->getAppManager();
157
+            if (!$appManager->isEnabledForUser('sharebymail')) {
158
+                return null;
159
+            }
160
+
161
+            $settingsManager = new SettingsManager($this->serverContainer->getConfig());
162
+
163
+            $this->shareByMailProvider = new ShareByMailProvider(
164
+                $this->serverContainer->getDatabaseConnection(),
165
+                $this->serverContainer->getSecureRandom(),
166
+                $this->serverContainer->getUserManager(),
167
+                $this->serverContainer->getLazyRootFolder(),
168
+                $this->serverContainer->getL10N('sharebymail'),
169
+                $this->serverContainer->getLogger(),
170
+                $this->serverContainer->getMailer(),
171
+                $this->serverContainer->getURLGenerator(),
172
+                $this->serverContainer->getActivityManager(),
173
+                $settingsManager,
174
+                $this->serverContainer->query(Defaults::class),
175
+                $this->serverContainer->getHasher(),
176
+                $this->serverContainer->query(CapabilitiesManager::class)
177
+            );
178
+        }
179
+
180
+        return $this->shareByMailProvider;
181
+    }
182
+
183
+
184
+    /**
185
+     * Create the circle share provider
186
+     *
187
+     * @return FederatedShareProvider
188
+     *
189
+     * @suppress PhanUndeclaredClassMethod
190
+     */
191
+    protected function getShareByCircleProvider() {
192
+
193
+        if ($this->circlesAreNotAvailable) {
194
+            return null;
195
+        }
196
+
197
+        if (!$this->serverContainer->getAppManager()->isEnabledForUser('circles') ||
198
+            !class_exists('\OCA\Circles\ShareByCircleProvider')
199
+        ) {
200
+            $this->circlesAreNotAvailable = true;
201
+            return null;
202
+        }
203
+
204
+        if ($this->shareByCircleProvider === null) {
205
+
206
+            $this->shareByCircleProvider = new \OCA\Circles\ShareByCircleProvider(
207
+                $this->serverContainer->getDatabaseConnection(),
208
+                $this->serverContainer->getSecureRandom(),
209
+                $this->serverContainer->getUserManager(),
210
+                $this->serverContainer->getLazyRootFolder(),
211
+                $this->serverContainer->getL10N('circles'),
212
+                $this->serverContainer->getLogger(),
213
+                $this->serverContainer->getURLGenerator()
214
+            );
215
+        }
216
+
217
+        return $this->shareByCircleProvider;
218
+    }
219
+
220
+
221
+    /**
222
+     * @inheritdoc
223
+     */
224
+    public function getProvider($id) {
225
+        $provider = null;
226
+        if ($id === 'ocinternal') {
227
+            $provider = $this->defaultShareProvider();
228
+        } else if ($id === 'ocFederatedSharing') {
229
+            $provider = $this->federatedShareProvider();
230
+        } else if ($id === 'ocMailShare') {
231
+            $provider = $this->getShareByMailProvider();
232
+        } else if ($id === 'ocCircleShare') {
233
+            $provider = $this->getShareByCircleProvider();
234
+        }
235
+
236
+        if ($provider === null) {
237
+            throw new ProviderException('No provider with id .' . $id . ' found.');
238
+        }
239
+
240
+        return $provider;
241
+    }
242
+
243
+    /**
244
+     * @inheritdoc
245
+     */
246
+    public function getProviderForType($shareType) {
247
+        $provider = null;
248
+
249
+        if ($shareType === \OCP\Share::SHARE_TYPE_USER ||
250
+            $shareType === \OCP\Share::SHARE_TYPE_GROUP ||
251
+            $shareType === \OCP\Share::SHARE_TYPE_LINK
252
+        ) {
253
+            $provider = $this->defaultShareProvider();
254
+        } else if ($shareType === \OCP\Share::SHARE_TYPE_REMOTE) {
255
+            $provider = $this->federatedShareProvider();
256
+        } else if ($shareType === \OCP\Share::SHARE_TYPE_EMAIL) {
257
+            $provider = $this->getShareByMailProvider();
258
+        } else if ($shareType === \OCP\Share::SHARE_TYPE_CIRCLE) {
259
+            $provider = $this->getShareByCircleProvider();
260
+        }
261
+
262
+
263
+        if ($provider === null) {
264
+            throw new ProviderException('No share provider for share type ' . $shareType);
265
+        }
266
+
267
+        return $provider;
268
+    }
269
+
270
+    public function getAllProviders() {
271
+        $shares = [$this->defaultShareProvider(), $this->federatedShareProvider()];
272
+        $shareByMail = $this->getShareByMailProvider();
273
+        if ($shareByMail !== null) {
274
+            $shares[] = $shareByMail;
275
+        }
276
+        $shareByCircle = $this->getShareByCircleProvider();
277
+        if ($shareByCircle !== null) {
278
+            $shares[] = $shareByCircle;
279
+        }
280
+
281
+        return $shares;
282
+    }
283 283
 }
Please login to merge, or discard this patch.
ocm-provider/index.php 2 patches
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -29,11 +29,11 @@
 block discarded – undo
29 29
 $isEnabled = $server->getAppManager()->isEnabledForUser('cloud_federation_api');
30 30
 
31 31
 if ($isEnabled) {
32
-	$capabilities = new OCA\CloudFederationAPI\Capabilities($server->getURLGenerator());
33
-	header('Content-Type: application/json');
34
-	echo json_encode($capabilities->getCapabilities()['ocm']);
32
+    $capabilities = new OCA\CloudFederationAPI\Capabilities($server->getURLGenerator());
33
+    header('Content-Type: application/json');
34
+    echo json_encode($capabilities->getCapabilities()['ocm']);
35 35
 } else {
36
-	header($_SERVER["SERVER_PROTOCOL"]." 501 Not Implemented", true, 501);
37
-	exit("501 Not Implemented");
36
+    header($_SERVER["SERVER_PROTOCOL"]." 501 Not Implemented", true, 501);
37
+    exit("501 Not Implemented");
38 38
 }
39 39
 
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@
 block discarded – undo
20 20
  */
21 21
 
22 22
 
23
-require_once __DIR__ . '/../lib/base.php';
23
+require_once __DIR__.'/../lib/base.php';
24 24
 
25 25
 header('Content-Type: application/json');
26 26
 
Please login to merge, or discard this patch.
apps/federatedfilesharing/composer/composer/autoload_static.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -6,39 +6,39 @@
 block discarded – undo
6 6
 
7 7
 class ComposerStaticInitFederatedFileSharing
8 8
 {
9
-    public static $prefixLengthsPsr4 = array (
9
+    public static $prefixLengthsPsr4 = array(
10 10
         'O' => 
11
-        array (
11
+        array(
12 12
             'OCA\\FederatedFileSharing\\' => 25,
13 13
         ),
14 14
     );
15 15
 
16
-    public static $prefixDirsPsr4 = array (
16
+    public static $prefixDirsPsr4 = array(
17 17
         'OCA\\FederatedFileSharing\\' => 
18
-        array (
19
-            0 => __DIR__ . '/..' . '/../lib',
18
+        array(
19
+            0 => __DIR__.'/..'.'/../lib',
20 20
         ),
21 21
     );
22 22
 
23
-    public static $classMap = array (
24
-        'OCA\\FederatedFileSharing\\AddressHandler' => __DIR__ . '/..' . '/../lib/AddressHandler.php',
25
-        'OCA\\FederatedFileSharing\\AppInfo\\Application' => __DIR__ . '/..' . '/../lib/AppInfo/Application.php',
26
-        'OCA\\FederatedFileSharing\\BackgroundJob\\RetryJob' => __DIR__ . '/..' . '/../lib/BackgroundJob/RetryJob.php',
27
-        'OCA\\FederatedFileSharing\\Controller\\MountPublicLinkController' => __DIR__ . '/..' . '/../lib/Controller/MountPublicLinkController.php',
28
-        'OCA\\FederatedFileSharing\\Controller\\RequestHandlerController' => __DIR__ . '/..' . '/../lib/Controller/RequestHandlerController.php',
29
-        'OCA\\FederatedFileSharing\\FederatedShareProvider' => __DIR__ . '/..' . '/../lib/FederatedShareProvider.php',
30
-        'OCA\\FederatedFileSharing\\Notifications' => __DIR__ . '/..' . '/../lib/Notifications.php',
31
-        'OCA\\FederatedFileSharing\\Notifier' => __DIR__ . '/..' . '/../lib/Notifier.php',
32
-        'OCA\\FederatedFileSharing\\OCM\\CloudFederationProviderFiles' => __DIR__ . '/..' . '/../lib/ocm/CloudFederationProviderFiles.php',
33
-        'OCA\\FederatedFileSharing\\Settings\\Admin' => __DIR__ . '/..' . '/../lib/Settings/Admin.php',
34
-        'OCA\\FederatedFileSharing\\Settings\\Personal' => __DIR__ . '/..' . '/../lib/Settings/Personal.php',
35
-        'OCA\\FederatedFileSharing\\Settings\\PersonalSection' => __DIR__ . '/..' . '/../lib/Settings/PersonalSection.php',
36
-        'OCA\\FederatedFileSharing\\TokenHandler' => __DIR__ . '/..' . '/../lib/TokenHandler.php',
23
+    public static $classMap = array(
24
+        'OCA\\FederatedFileSharing\\AddressHandler' => __DIR__.'/..'.'/../lib/AddressHandler.php',
25
+        'OCA\\FederatedFileSharing\\AppInfo\\Application' => __DIR__.'/..'.'/../lib/AppInfo/Application.php',
26
+        'OCA\\FederatedFileSharing\\BackgroundJob\\RetryJob' => __DIR__.'/..'.'/../lib/BackgroundJob/RetryJob.php',
27
+        'OCA\\FederatedFileSharing\\Controller\\MountPublicLinkController' => __DIR__.'/..'.'/../lib/Controller/MountPublicLinkController.php',
28
+        'OCA\\FederatedFileSharing\\Controller\\RequestHandlerController' => __DIR__.'/..'.'/../lib/Controller/RequestHandlerController.php',
29
+        'OCA\\FederatedFileSharing\\FederatedShareProvider' => __DIR__.'/..'.'/../lib/FederatedShareProvider.php',
30
+        'OCA\\FederatedFileSharing\\Notifications' => __DIR__.'/..'.'/../lib/Notifications.php',
31
+        'OCA\\FederatedFileSharing\\Notifier' => __DIR__.'/..'.'/../lib/Notifier.php',
32
+        'OCA\\FederatedFileSharing\\OCM\\CloudFederationProviderFiles' => __DIR__.'/..'.'/../lib/ocm/CloudFederationProviderFiles.php',
33
+        'OCA\\FederatedFileSharing\\Settings\\Admin' => __DIR__.'/..'.'/../lib/Settings/Admin.php',
34
+        'OCA\\FederatedFileSharing\\Settings\\Personal' => __DIR__.'/..'.'/../lib/Settings/Personal.php',
35
+        'OCA\\FederatedFileSharing\\Settings\\PersonalSection' => __DIR__.'/..'.'/../lib/Settings/PersonalSection.php',
36
+        'OCA\\FederatedFileSharing\\TokenHandler' => __DIR__.'/..'.'/../lib/TokenHandler.php',
37 37
     );
38 38
 
39 39
     public static function getInitializer(ClassLoader $loader)
40 40
     {
41
-        return \Closure::bind(function () use ($loader) {
41
+        return \Closure::bind(function() use ($loader) {
42 42
             $loader->prefixLengthsPsr4 = ComposerStaticInitFederatedFileSharing::$prefixLengthsPsr4;
43 43
             $loader->prefixDirsPsr4 = ComposerStaticInitFederatedFileSharing::$prefixDirsPsr4;
44 44
             $loader->classMap = ComposerStaticInitFederatedFileSharing::$classMap;
Please login to merge, or discard this patch.
apps/federatedfilesharing/composer/composer/autoload_classmap.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -6,17 +6,17 @@
 block discarded – undo
6 6
 $baseDir = $vendorDir;
7 7
 
8 8
 return array(
9
-    'OCA\\FederatedFileSharing\\AddressHandler' => $baseDir . '/../lib/AddressHandler.php',
10
-    'OCA\\FederatedFileSharing\\AppInfo\\Application' => $baseDir . '/../lib/AppInfo/Application.php',
11
-    'OCA\\FederatedFileSharing\\BackgroundJob\\RetryJob' => $baseDir . '/../lib/BackgroundJob/RetryJob.php',
12
-    'OCA\\FederatedFileSharing\\Controller\\MountPublicLinkController' => $baseDir . '/../lib/Controller/MountPublicLinkController.php',
13
-    'OCA\\FederatedFileSharing\\Controller\\RequestHandlerController' => $baseDir . '/../lib/Controller/RequestHandlerController.php',
14
-    'OCA\\FederatedFileSharing\\FederatedShareProvider' => $baseDir . '/../lib/FederatedShareProvider.php',
15
-    'OCA\\FederatedFileSharing\\Notifications' => $baseDir . '/../lib/Notifications.php',
16
-    'OCA\\FederatedFileSharing\\Notifier' => $baseDir . '/../lib/Notifier.php',
17
-    'OCA\\FederatedFileSharing\\OCM\\CloudFederationProviderFiles' => $baseDir . '/../lib/ocm/CloudFederationProviderFiles.php',
18
-    'OCA\\FederatedFileSharing\\Settings\\Admin' => $baseDir . '/../lib/Settings/Admin.php',
19
-    'OCA\\FederatedFileSharing\\Settings\\Personal' => $baseDir . '/../lib/Settings/Personal.php',
20
-    'OCA\\FederatedFileSharing\\Settings\\PersonalSection' => $baseDir . '/../lib/Settings/PersonalSection.php',
21
-    'OCA\\FederatedFileSharing\\TokenHandler' => $baseDir . '/../lib/TokenHandler.php',
9
+    'OCA\\FederatedFileSharing\\AddressHandler' => $baseDir.'/../lib/AddressHandler.php',
10
+    'OCA\\FederatedFileSharing\\AppInfo\\Application' => $baseDir.'/../lib/AppInfo/Application.php',
11
+    'OCA\\FederatedFileSharing\\BackgroundJob\\RetryJob' => $baseDir.'/../lib/BackgroundJob/RetryJob.php',
12
+    'OCA\\FederatedFileSharing\\Controller\\MountPublicLinkController' => $baseDir.'/../lib/Controller/MountPublicLinkController.php',
13
+    'OCA\\FederatedFileSharing\\Controller\\RequestHandlerController' => $baseDir.'/../lib/Controller/RequestHandlerController.php',
14
+    'OCA\\FederatedFileSharing\\FederatedShareProvider' => $baseDir.'/../lib/FederatedShareProvider.php',
15
+    'OCA\\FederatedFileSharing\\Notifications' => $baseDir.'/../lib/Notifications.php',
16
+    'OCA\\FederatedFileSharing\\Notifier' => $baseDir.'/../lib/Notifier.php',
17
+    'OCA\\FederatedFileSharing\\OCM\\CloudFederationProviderFiles' => $baseDir.'/../lib/ocm/CloudFederationProviderFiles.php',
18
+    'OCA\\FederatedFileSharing\\Settings\\Admin' => $baseDir.'/../lib/Settings/Admin.php',
19
+    'OCA\\FederatedFileSharing\\Settings\\Personal' => $baseDir.'/../lib/Settings/Personal.php',
20
+    'OCA\\FederatedFileSharing\\Settings\\PersonalSection' => $baseDir.'/../lib/Settings/PersonalSection.php',
21
+    'OCA\\FederatedFileSharing\\TokenHandler' => $baseDir.'/../lib/TokenHandler.php',
22 22
 );
Please login to merge, or discard this patch.
apps/cloud_federation_api/lib/AppInfo/Application.php 1 patch
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -28,10 +28,10 @@
 block discarded – undo
28 28
 
29 29
 class Application extends App {
30 30
 
31
-	public function __construct() {
32
-		parent::__construct('cloud_federation_api');
31
+    public function __construct() {
32
+        parent::__construct('cloud_federation_api');
33 33
 
34
-		$container = $this->getContainer();
35
-		$container->registerCapability(Capabilities::class);
36
-	}
34
+        $container = $this->getContainer();
35
+        $container->registerCapability(Capabilities::class);
36
+    }
37 37
 }
Please login to merge, or discard this patch.
lib/public/Federation/Exceptions/ProviderDoesNotExistsException.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@
 block discarded – undo
32 32
 	 */
33 33
 	public function __construct($providerId) {
34 34
 		$l = \OC::$server->getL10N('federation');
35
-		$message = 'Cloud Federation Provider with ID: "' . $providerId . '" does not exist.';
35
+		$message = 'Cloud Federation Provider with ID: "'.$providerId.'" does not exist.';
36 36
 		$hint = $l->t('Cloud Federation Provider with ID: "%s" does not exist.', [$providerId]);
37 37
 		parent::__construct($message, $hint);
38 38
 	}
Please login to merge, or discard this patch.
Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -32,18 +32,18 @@
 block discarded – undo
32 32
  */
33 33
 class ProviderDoesNotExistsException extends HintException {
34 34
 
35
-	/**
36
-	 * ProviderDoesNotExistsException constructor.
37
-	 *
38
-	 * @since 14.0.0
39
-	 *
40
-	 * @param string $providerId cloud federation provider ID
41
-	 */
42
-	public function __construct($providerId) {
43
-		$l = \OC::$server->getL10N('federation');
44
-		$message = 'Cloud Federation Provider with ID: "' . $providerId . '" does not exist.';
45
-		$hint = $l->t('Cloud Federation Provider with ID: "%s" does not exist.', [$providerId]);
46
-		parent::__construct($message, $hint);
47
-	}
35
+    /**
36
+     * ProviderDoesNotExistsException constructor.
37
+     *
38
+     * @since 14.0.0
39
+     *
40
+     * @param string $providerId cloud federation provider ID
41
+     */
42
+    public function __construct($providerId) {
43
+        $l = \OC::$server->getL10N('federation');
44
+        $message = 'Cloud Federation Provider with ID: "' . $providerId . '" does not exist.';
45
+        $hint = $l->t('Cloud Federation Provider with ID: "%s" does not exist.', [$providerId]);
46
+        parent::__construct($message, $hint);
47
+    }
48 48
 
49 49
 }
Please login to merge, or discard this patch.
lib/public/Federation/Exceptions/ProviderAlreadyExistsException.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@
 block discarded – undo
33 33
 	 */
34 34
 	public function __construct($newProviderId, $existingProviderName) {
35 35
 		$l = \OC::$server->getL10N('federation');
36
-		$message = 'Id "' . $newProviderId . '" already used by cloud federation provider "' . $existingProviderName . '"';
36
+		$message = 'Id "'.$newProviderId.'" already used by cloud federation provider "'.$existingProviderName.'"';
37 37
 		$hint = $l->t('Id "%s" already used by cloud federation provider "%s"', [$newProviderId, $existingProviderName]);
38 38
 		parent::__construct($message, $hint);
39 39
 	}
Please login to merge, or discard this patch.
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -32,19 +32,19 @@
 block discarded – undo
32 32
  */
33 33
 class ProviderAlreadyExistsException extends HintException {
34 34
 
35
-	/**
36
-	 * ProviderAlreadyExistsException constructor.
37
-	 *
38
-	 * @since 14.0.0
39
-	 *
40
-	 * @param string $newProviderId cloud federation provider ID of the new provider
41
-	 * @param string $existingProviderName name of cloud federation provider which already use the same ID
42
-	 */
43
-	public function __construct($newProviderId, $existingProviderName) {
44
-		$l = \OC::$server->getL10N('federation');
45
-		$message = 'Id "' . $newProviderId . '" already used by cloud federation provider "' . $existingProviderName . '"';
46
-		$hint = $l->t('Id "%s" already used by cloud federation provider "%s"', [$newProviderId, $existingProviderName]);
47
-		parent::__construct($message, $hint);
48
-	}
35
+    /**
36
+     * ProviderAlreadyExistsException constructor.
37
+     *
38
+     * @since 14.0.0
39
+     *
40
+     * @param string $newProviderId cloud federation provider ID of the new provider
41
+     * @param string $existingProviderName name of cloud federation provider which already use the same ID
42
+     */
43
+    public function __construct($newProviderId, $existingProviderName) {
44
+        $l = \OC::$server->getL10N('federation');
45
+        $message = 'Id "' . $newProviderId . '" already used by cloud federation provider "' . $existingProviderName . '"';
46
+        $hint = $l->t('Id "%s" already used by cloud federation provider "%s"', [$newProviderId, $existingProviderName]);
47
+        parent::__construct($message, $hint);
48
+    }
49 49
 
50 50
 }
Please login to merge, or discard this patch.
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.