Passed
Push — master ( 7ab1fc...dffbdd )
by Joas
15:52 queued 12s
created
apps/dav/lib/CardDAV/Integration/IAddressBookProvider.php 1 patch
Indentation   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -31,43 +31,43 @@
 block discarded – undo
31 31
  */
32 32
 interface IAddressBookProvider {
33 33
 
34
-	/**
35
-	 * Provides the appId of the plugin
36
-	 *
37
-	 * @since 19.0.0
38
-	 * @return string AppId
39
-	 */
40
-	public function getAppId(): string;
34
+    /**
35
+     * Provides the appId of the plugin
36
+     *
37
+     * @since 19.0.0
38
+     * @return string AppId
39
+     */
40
+    public function getAppId(): string;
41 41
 
42
-	/**
43
-	 * Fetches all address books for a given principal uri
44
-	 *
45
-	 * @since 19.0.0
46
-	 * @param string $principalUri E.g. principals/users/user1
47
-	 * @return ExternalAddressBook[] Array of all address books
48
-	 */
49
-	public function fetchAllForAddressBookHome(string $principalUri): array;
42
+    /**
43
+     * Fetches all address books for a given principal uri
44
+     *
45
+     * @since 19.0.0
46
+     * @param string $principalUri E.g. principals/users/user1
47
+     * @return ExternalAddressBook[] Array of all address books
48
+     */
49
+    public function fetchAllForAddressBookHome(string $principalUri): array;
50 50
 
51
-	/**
52
-	 * Checks whether plugin has an address book for a given principalUri and URI
53
-	 *
54
-	 * @since 19.0.0
55
-	 * @param string $principalUri E.g. principals/users/user1
56
-	 * @param string $uri E.g. personal
57
-	 * @return bool True if address book for principalUri and URI exists, false otherwise
58
-	 */
59
-	public function hasAddressBookInAddressBookHome(string $principalUri, string $uri): bool;
51
+    /**
52
+     * Checks whether plugin has an address book for a given principalUri and URI
53
+     *
54
+     * @since 19.0.0
55
+     * @param string $principalUri E.g. principals/users/user1
56
+     * @param string $uri E.g. personal
57
+     * @return bool True if address book for principalUri and URI exists, false otherwise
58
+     */
59
+    public function hasAddressBookInAddressBookHome(string $principalUri, string $uri): bool;
60 60
 
61
-	/**
62
-	 * Fetches an address book for a given principalUri and URI
63
-	 * Returns null if address book does not exist
64
-	 *
65
-	 * @param string $principalUri E.g. principals/users/user1
66
-	 * @param string $uri E.g. personal
67
-	 *
68
-	 * @return ExternalAddressBook|null address book if it exists, null otherwise
69
-	 *@since 19.0.0
70
-	 */
71
-	public function getAddressBookInAddressBookHome(string $principalUri, string $uri): ?ExternalAddressBook;
61
+    /**
62
+     * Fetches an address book for a given principalUri and URI
63
+     * Returns null if address book does not exist
64
+     *
65
+     * @param string $principalUri E.g. principals/users/user1
66
+     * @param string $uri E.g. personal
67
+     *
68
+     * @return ExternalAddressBook|null address book if it exists, null otherwise
69
+     *@since 19.0.0
70
+     */
71
+    public function getAddressBookInAddressBookHome(string $principalUri, string $uri): ?ExternalAddressBook;
72 72
 
73 73
 }
Please login to merge, or discard this patch.
lib/public/User/Events/BeforeUserLoggedInEvent.php 1 patch
Indentation   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -34,35 +34,35 @@
 block discarded – undo
34 34
  */
35 35
 class BeforeUserLoggedInEvent extends Event {
36 36
 
37
-	/** @var string */
38
-	private $username;
37
+    /** @var string */
38
+    private $username;
39 39
 
40
-	/** @var string */
41
-	private $password;
40
+    /** @var string */
41
+    private $password;
42 42
 
43
-	/**
44
-	 * @since 18.0.0
45
-	 */
46
-	public function __construct(string $username, string $password) {
47
-		parent::__construct();
48
-		$this->username = $username;
49
-		$this->password = $password;
50
-	}
43
+    /**
44
+     * @since 18.0.0
45
+     */
46
+    public function __construct(string $username, string $password) {
47
+        parent::__construct();
48
+        $this->username = $username;
49
+        $this->password = $password;
50
+    }
51 51
 
52
-	/**
53
-	 * returns the login name, which must not necessarily match to a user ID
54
-	 *
55
-	 * @since 18.0.0
56
-	 */
57
-	public function getUsername(): string {
58
-		return $this->username;
59
-	}
52
+    /**
53
+     * returns the login name, which must not necessarily match to a user ID
54
+     *
55
+     * @since 18.0.0
56
+     */
57
+    public function getUsername(): string {
58
+        return $this->username;
59
+    }
60 60
 
61
-	/**
62
-	 * @since 18.0.0
63
-	 */
64
-	public function getPassword(): string {
65
-		return $this->password;
66
-	}
61
+    /**
62
+     * @since 18.0.0
63
+     */
64
+    public function getPassword(): string {
65
+        return $this->password;
66
+    }
67 67
 
68 68
 }
Please login to merge, or discard this patch.
apps/files/lib/Notification/Notifier.php 1 patch
Indentation   +265 added lines, -265 removed lines patch added patch discarded remove patch
@@ -43,269 +43,269 @@
 block discarded – undo
43 43
 
44 44
 class Notifier implements INotifier, IDismissableNotifier {
45 45
 
46
-	/** @var IFactory */
47
-	protected $l10nFactory;
48
-
49
-	/** @var IURLGenerator */
50
-	protected $urlGenerator;
51
-	/** @var TransferOwnershipMapper */
52
-	private $mapper;
53
-	/** @var IManager */
54
-	private $notificationManager;
55
-	/** @var IUserManager */
56
-	private $userManager;
57
-	/** @var ITimeFactory */
58
-	private $timeFactory;
59
-
60
-	public function __construct(IFactory $l10nFactory,
61
-								IURLGenerator $urlGenerator,
62
-								TransferOwnershipMapper $mapper,
63
-								IManager $notificationManager,
64
-								IUserManager $userManager,
65
-								ITimeFactory $timeFactory) {
66
-		$this->l10nFactory = $l10nFactory;
67
-		$this->urlGenerator = $urlGenerator;
68
-		$this->mapper = $mapper;
69
-		$this->notificationManager = $notificationManager;
70
-		$this->userManager = $userManager;
71
-		$this->timeFactory = $timeFactory;
72
-	}
73
-
74
-	public function getID(): string {
75
-		return 'files';
76
-	}
77
-
78
-	public function getName(): string {
79
-		return $this->l10nFactory->get('files')->t('Files');
80
-	}
81
-
82
-	/**
83
-	 * @param INotification $notification
84
-	 * @param string $languageCode The code of the language that should be used to prepare the notification
85
-	 * @return INotification
86
-	 * @throws \InvalidArgumentException When the notification was not prepared by a notifier
87
-	 */
88
-	public function prepare(INotification $notification, string $languageCode): INotification {
89
-		if ($notification->getApp() !== 'files') {
90
-			throw new \InvalidArgumentException('Unhandled app');
91
-		}
92
-
93
-		if ($notification->getSubject() === 'transferownershipRequest') {
94
-			return $this->handleTransferownershipRequest($notification, $languageCode);
95
-		}
96
-		if ($notification->getSubject() === 'transferOwnershipFailedSource') {
97
-			return $this->handleTransferOwnershipFailedSource($notification, $languageCode);
98
-		}
99
-		if ($notification->getSubject() === 'transferOwnershipFailedTarget') {
100
-			return $this->handleTransferOwnershipFailedTarget($notification, $languageCode);
101
-		}
102
-		if ($notification->getSubject() === 'transferOwnershipDoneSource') {
103
-			return $this->handleTransferOwnershipDoneSource($notification, $languageCode);
104
-		}
105
-		if ($notification->getSubject() === 'transferOwnershipDoneTarget') {
106
-			return $this->handleTransferOwnershipDoneTarget($notification, $languageCode);
107
-		}
108
-
109
-		throw new \InvalidArgumentException('Unhandled subject');
110
-	}
111
-
112
-	public function handleTransferownershipRequest(INotification $notification, string $languageCode): INotification {
113
-		$l = $this->l10nFactory->get('files', $languageCode);
114
-		$id = $notification->getObjectId();
115
-		$param = $notification->getSubjectParameters();
116
-
117
-		$approveAction = $notification->createAction()
118
-			->setParsedLabel($l->t('Accept'))
119
-			->setPrimary(true)
120
-			->setLink(
121
-				$this->urlGenerator->getAbsoluteURL(
122
-					$this->urlGenerator->linkTo(
123
-						'',
124
-						'ocs/v2.php/apps/files/api/v1/transferownership/' . $id
125
-					)
126
-				),
127
-				IAction::TYPE_POST
128
-			);
129
-
130
-		$disapproveAction = $notification->createAction()
131
-			->setParsedLabel($l->t('Reject'))
132
-			->setPrimary(false)
133
-			->setLink(
134
-				$this->urlGenerator->getAbsoluteURL(
135
-					$this->urlGenerator->linkTo(
136
-						'',
137
-						'ocs/v2.php/apps/files/api/v1/transferownership/' . $id
138
-					)
139
-				),
140
-				IAction::TYPE_DELETE
141
-			);
142
-
143
-		$sourceUser = $this->getUser($param['sourceUser']);
144
-		$notification->addParsedAction($approveAction)
145
-			->addParsedAction($disapproveAction)
146
-			->setRichSubject(
147
-				$l->t('Incoming ownership transfer from {user}'),
148
-				[
149
-					'user' => [
150
-						'type' => 'user',
151
-						'id' => $sourceUser->getUID(),
152
-						'name' => $sourceUser->getDisplayName(),
153
-					],
154
-				])
155
-			->setParsedSubject(str_replace('{user}', $sourceUser->getDisplayName(), $l->t('Incoming ownership transfer from {user}')))
156
-			->setRichMessage(
157
-				$l->t("Do you want to accept {path}?\n\nNote: The transfer process after accepting may take up to 1 hour."),
158
-				[
159
-					'path' => [
160
-						'type' => 'highlight',
161
-						'id' => $param['targetUser'] . '::' . $param['nodeName'],
162
-						'name' => $param['nodeName'],
163
-					]
164
-				])
165
-			->setParsedMessage(str_replace('{path}', $param['nodeName'], $l->t("Do you want to accept {path}?\n\nNote: The transfer process after accepting may take up to 1 hour.")));
166
-
167
-		return $notification;
168
-	}
169
-
170
-	public function handleTransferOwnershipFailedSource(INotification $notification,  string $languageCode): INotification {
171
-		$l = $this->l10nFactory->get('files', $languageCode);
172
-		$param = $notification->getSubjectParameters();
173
-
174
-		$targetUser = $this->getUser($param['targetUser']);
175
-		$notification->setRichSubject($l->t('Ownership transfer failed'))
176
-			->setParsedSubject($l->t('Ownership transfer failed'))
177
-
178
-			->setRichMessage(
179
-				$l->t('Your ownership transfer of {path} to {user} failed.'),
180
-				[
181
-					'path' => [
182
-						'type' => 'highlight',
183
-						'id' => $param['targetUser'] . '::' . $param['nodeName'],
184
-						'name' => $param['nodeName'],
185
-					],
186
-					'user' => [
187
-						'type' => 'user',
188
-						'id' => $targetUser->getUID(),
189
-						'name' => $targetUser->getDisplayName(),
190
-					],
191
-				])
192
-			->setParsedMessage(str_replace(['{path}', '{user}'], [$param['nodeName'], $targetUser->getDisplayName()], $l->t('Your ownership transfer of {path} to {user} failed.')));
193
-		return $notification;
194
-	}
195
-
196
-	public function handleTransferOwnershipFailedTarget(INotification $notification,  string $languageCode): INotification {
197
-		$l = $this->l10nFactory->get('files', $languageCode);
198
-		$param = $notification->getSubjectParameters();
199
-
200
-		$sourceUser = $this->getUser($param['sourceUser']);
201
-		$notification->setRichSubject($l->t('Ownership transfer failed'))
202
-			->setParsedSubject($l->t('Ownership transfer failed'))
203
-
204
-			->setRichMessage(
205
-				$l->t('The ownership transfer of {path} from {user} failed.'),
206
-				[
207
-					'path' => [
208
-						'type' => 'highlight',
209
-						'id' => $param['sourceUser'] . '::' . $param['nodeName'],
210
-						'name' => $param['nodeName'],
211
-					],
212
-					'user' => [
213
-						'type' => 'user',
214
-						'id' => $sourceUser->getUID(),
215
-						'name' => $sourceUser->getDisplayName(),
216
-					],
217
-				])
218
-			->setParsedMessage(str_replace(['{path}', '{user}'], [$param['nodeName'], $sourceUser->getDisplayName()], $l->t('The ownership transfer of {path} from {user} failed.')));
219
-
220
-		return $notification;
221
-	}
222
-
223
-	public function handleTransferOwnershipDoneSource(INotification $notification,  string $languageCode): INotification {
224
-		$l = $this->l10nFactory->get('files', $languageCode);
225
-		$param = $notification->getSubjectParameters();
226
-
227
-		$targetUser = $this->getUser($param['targetUser']);
228
-		$notification->setRichSubject($l->t('Ownership transfer done'))
229
-			->setParsedSubject($l->t('Ownership transfer done'))
230
-
231
-			->setRichMessage(
232
-				$l->t('Your ownership transfer of {path} to {user} has completed.'),
233
-				[
234
-					'path' => [
235
-						'type' => 'highlight',
236
-						'id' => $param['targetUser'] . '::' . $param['nodeName'],
237
-						'name' => $param['nodeName'],
238
-					],
239
-					'user' => [
240
-						'type' => 'user',
241
-						'id' => $targetUser->getUID(),
242
-						'name' => $targetUser->getDisplayName(),
243
-					],
244
-				])
245
-			->setParsedMessage(str_replace(['{path}', '{user}'], [$param['nodeName'], $targetUser->getDisplayName()], $l->t('Your ownership transfer of {path} to {user} has completed.')));
246
-
247
-		return $notification;
248
-	}
249
-
250
-	public function handleTransferOwnershipDoneTarget(INotification $notification,  string $languageCode): INotification {
251
-		$l = $this->l10nFactory->get('files', $languageCode);
252
-		$param = $notification->getSubjectParameters();
253
-
254
-		$sourceUser = $this->getUser($param['sourceUser']);
255
-		$notification->setRichSubject($l->t('Ownership transfer done'))
256
-			->setParsedSubject($l->t('Ownership transfer done'))
257
-
258
-			->setRichMessage(
259
-				$l->t('The ownership transfer of {path} from {user} has completed.'),
260
-				[
261
-					'path' => [
262
-						'type' => 'highlight',
263
-						'id' => $param['sourceUser'] . '::' . $param['nodeName'],
264
-						'name' => $param['nodeName'],
265
-					],
266
-					'user' => [
267
-						'type' => 'user',
268
-						'id' => $sourceUser->getUID(),
269
-						'name' => $sourceUser->getDisplayName(),
270
-					],
271
-				])
272
-			->setParsedMessage(str_replace(['{path}', '{user}'], [$param['nodeName'], $sourceUser->getDisplayName()], $l->t('The ownership transfer of {path} from {user} has completed.')));
273
-
274
-		return $notification;
275
-	}
276
-
277
-	public function dismissNotification(INotification $notification): void {
278
-		if ($notification->getApp() !== 'files') {
279
-			throw new \InvalidArgumentException('Unhandled app');
280
-		}
281
-
282
-		// TODO: This should all be moved to a service that also the transferownershipContoller uses.
283
-		try {
284
-			$transferOwnership = $this->mapper->getById((int)$notification->getObjectId());
285
-		} catch (DoesNotExistException $e) {
286
-			return;
287
-		}
288
-
289
-		$notification = $this->notificationManager->createNotification();
290
-		$notification->setUser($transferOwnership->getSourceUser())
291
-			->setApp('files')
292
-			->setDateTime($this->timeFactory->getDateTime())
293
-			->setSubject('transferownershipRequestDenied', [
294
-				'sourceUser' => $transferOwnership->getSourceUser(),
295
-				'targetUser' => $transferOwnership->getTargetUser(),
296
-				'nodeName' => $transferOwnership->getNodeName()
297
-			])
298
-			->setObject('transfer', (string)$transferOwnership->getId());
299
-		$this->notificationManager->notify($notification);
300
-
301
-		$this->mapper->delete($transferOwnership);
302
-	}
303
-
304
-	protected function getUser(string $userId): IUser {
305
-		$user = $this->userManager->get($userId);
306
-		if ($user instanceof IUser) {
307
-			return $user;
308
-		}
309
-		throw new \InvalidArgumentException('User not found');
310
-	}
46
+    /** @var IFactory */
47
+    protected $l10nFactory;
48
+
49
+    /** @var IURLGenerator */
50
+    protected $urlGenerator;
51
+    /** @var TransferOwnershipMapper */
52
+    private $mapper;
53
+    /** @var IManager */
54
+    private $notificationManager;
55
+    /** @var IUserManager */
56
+    private $userManager;
57
+    /** @var ITimeFactory */
58
+    private $timeFactory;
59
+
60
+    public function __construct(IFactory $l10nFactory,
61
+                                IURLGenerator $urlGenerator,
62
+                                TransferOwnershipMapper $mapper,
63
+                                IManager $notificationManager,
64
+                                IUserManager $userManager,
65
+                                ITimeFactory $timeFactory) {
66
+        $this->l10nFactory = $l10nFactory;
67
+        $this->urlGenerator = $urlGenerator;
68
+        $this->mapper = $mapper;
69
+        $this->notificationManager = $notificationManager;
70
+        $this->userManager = $userManager;
71
+        $this->timeFactory = $timeFactory;
72
+    }
73
+
74
+    public function getID(): string {
75
+        return 'files';
76
+    }
77
+
78
+    public function getName(): string {
79
+        return $this->l10nFactory->get('files')->t('Files');
80
+    }
81
+
82
+    /**
83
+     * @param INotification $notification
84
+     * @param string $languageCode The code of the language that should be used to prepare the notification
85
+     * @return INotification
86
+     * @throws \InvalidArgumentException When the notification was not prepared by a notifier
87
+     */
88
+    public function prepare(INotification $notification, string $languageCode): INotification {
89
+        if ($notification->getApp() !== 'files') {
90
+            throw new \InvalidArgumentException('Unhandled app');
91
+        }
92
+
93
+        if ($notification->getSubject() === 'transferownershipRequest') {
94
+            return $this->handleTransferownershipRequest($notification, $languageCode);
95
+        }
96
+        if ($notification->getSubject() === 'transferOwnershipFailedSource') {
97
+            return $this->handleTransferOwnershipFailedSource($notification, $languageCode);
98
+        }
99
+        if ($notification->getSubject() === 'transferOwnershipFailedTarget') {
100
+            return $this->handleTransferOwnershipFailedTarget($notification, $languageCode);
101
+        }
102
+        if ($notification->getSubject() === 'transferOwnershipDoneSource') {
103
+            return $this->handleTransferOwnershipDoneSource($notification, $languageCode);
104
+        }
105
+        if ($notification->getSubject() === 'transferOwnershipDoneTarget') {
106
+            return $this->handleTransferOwnershipDoneTarget($notification, $languageCode);
107
+        }
108
+
109
+        throw new \InvalidArgumentException('Unhandled subject');
110
+    }
111
+
112
+    public function handleTransferownershipRequest(INotification $notification, string $languageCode): INotification {
113
+        $l = $this->l10nFactory->get('files', $languageCode);
114
+        $id = $notification->getObjectId();
115
+        $param = $notification->getSubjectParameters();
116
+
117
+        $approveAction = $notification->createAction()
118
+            ->setParsedLabel($l->t('Accept'))
119
+            ->setPrimary(true)
120
+            ->setLink(
121
+                $this->urlGenerator->getAbsoluteURL(
122
+                    $this->urlGenerator->linkTo(
123
+                        '',
124
+                        'ocs/v2.php/apps/files/api/v1/transferownership/' . $id
125
+                    )
126
+                ),
127
+                IAction::TYPE_POST
128
+            );
129
+
130
+        $disapproveAction = $notification->createAction()
131
+            ->setParsedLabel($l->t('Reject'))
132
+            ->setPrimary(false)
133
+            ->setLink(
134
+                $this->urlGenerator->getAbsoluteURL(
135
+                    $this->urlGenerator->linkTo(
136
+                        '',
137
+                        'ocs/v2.php/apps/files/api/v1/transferownership/' . $id
138
+                    )
139
+                ),
140
+                IAction::TYPE_DELETE
141
+            );
142
+
143
+        $sourceUser = $this->getUser($param['sourceUser']);
144
+        $notification->addParsedAction($approveAction)
145
+            ->addParsedAction($disapproveAction)
146
+            ->setRichSubject(
147
+                $l->t('Incoming ownership transfer from {user}'),
148
+                [
149
+                    'user' => [
150
+                        'type' => 'user',
151
+                        'id' => $sourceUser->getUID(),
152
+                        'name' => $sourceUser->getDisplayName(),
153
+                    ],
154
+                ])
155
+            ->setParsedSubject(str_replace('{user}', $sourceUser->getDisplayName(), $l->t('Incoming ownership transfer from {user}')))
156
+            ->setRichMessage(
157
+                $l->t("Do you want to accept {path}?\n\nNote: The transfer process after accepting may take up to 1 hour."),
158
+                [
159
+                    'path' => [
160
+                        'type' => 'highlight',
161
+                        'id' => $param['targetUser'] . '::' . $param['nodeName'],
162
+                        'name' => $param['nodeName'],
163
+                    ]
164
+                ])
165
+            ->setParsedMessage(str_replace('{path}', $param['nodeName'], $l->t("Do you want to accept {path}?\n\nNote: The transfer process after accepting may take up to 1 hour.")));
166
+
167
+        return $notification;
168
+    }
169
+
170
+    public function handleTransferOwnershipFailedSource(INotification $notification,  string $languageCode): INotification {
171
+        $l = $this->l10nFactory->get('files', $languageCode);
172
+        $param = $notification->getSubjectParameters();
173
+
174
+        $targetUser = $this->getUser($param['targetUser']);
175
+        $notification->setRichSubject($l->t('Ownership transfer failed'))
176
+            ->setParsedSubject($l->t('Ownership transfer failed'))
177
+
178
+            ->setRichMessage(
179
+                $l->t('Your ownership transfer of {path} to {user} failed.'),
180
+                [
181
+                    'path' => [
182
+                        'type' => 'highlight',
183
+                        'id' => $param['targetUser'] . '::' . $param['nodeName'],
184
+                        'name' => $param['nodeName'],
185
+                    ],
186
+                    'user' => [
187
+                        'type' => 'user',
188
+                        'id' => $targetUser->getUID(),
189
+                        'name' => $targetUser->getDisplayName(),
190
+                    ],
191
+                ])
192
+            ->setParsedMessage(str_replace(['{path}', '{user}'], [$param['nodeName'], $targetUser->getDisplayName()], $l->t('Your ownership transfer of {path} to {user} failed.')));
193
+        return $notification;
194
+    }
195
+
196
+    public function handleTransferOwnershipFailedTarget(INotification $notification,  string $languageCode): INotification {
197
+        $l = $this->l10nFactory->get('files', $languageCode);
198
+        $param = $notification->getSubjectParameters();
199
+
200
+        $sourceUser = $this->getUser($param['sourceUser']);
201
+        $notification->setRichSubject($l->t('Ownership transfer failed'))
202
+            ->setParsedSubject($l->t('Ownership transfer failed'))
203
+
204
+            ->setRichMessage(
205
+                $l->t('The ownership transfer of {path} from {user} failed.'),
206
+                [
207
+                    'path' => [
208
+                        'type' => 'highlight',
209
+                        'id' => $param['sourceUser'] . '::' . $param['nodeName'],
210
+                        'name' => $param['nodeName'],
211
+                    ],
212
+                    'user' => [
213
+                        'type' => 'user',
214
+                        'id' => $sourceUser->getUID(),
215
+                        'name' => $sourceUser->getDisplayName(),
216
+                    ],
217
+                ])
218
+            ->setParsedMessage(str_replace(['{path}', '{user}'], [$param['nodeName'], $sourceUser->getDisplayName()], $l->t('The ownership transfer of {path} from {user} failed.')));
219
+
220
+        return $notification;
221
+    }
222
+
223
+    public function handleTransferOwnershipDoneSource(INotification $notification,  string $languageCode): INotification {
224
+        $l = $this->l10nFactory->get('files', $languageCode);
225
+        $param = $notification->getSubjectParameters();
226
+
227
+        $targetUser = $this->getUser($param['targetUser']);
228
+        $notification->setRichSubject($l->t('Ownership transfer done'))
229
+            ->setParsedSubject($l->t('Ownership transfer done'))
230
+
231
+            ->setRichMessage(
232
+                $l->t('Your ownership transfer of {path} to {user} has completed.'),
233
+                [
234
+                    'path' => [
235
+                        'type' => 'highlight',
236
+                        'id' => $param['targetUser'] . '::' . $param['nodeName'],
237
+                        'name' => $param['nodeName'],
238
+                    ],
239
+                    'user' => [
240
+                        'type' => 'user',
241
+                        'id' => $targetUser->getUID(),
242
+                        'name' => $targetUser->getDisplayName(),
243
+                    ],
244
+                ])
245
+            ->setParsedMessage(str_replace(['{path}', '{user}'], [$param['nodeName'], $targetUser->getDisplayName()], $l->t('Your ownership transfer of {path} to {user} has completed.')));
246
+
247
+        return $notification;
248
+    }
249
+
250
+    public function handleTransferOwnershipDoneTarget(INotification $notification,  string $languageCode): INotification {
251
+        $l = $this->l10nFactory->get('files', $languageCode);
252
+        $param = $notification->getSubjectParameters();
253
+
254
+        $sourceUser = $this->getUser($param['sourceUser']);
255
+        $notification->setRichSubject($l->t('Ownership transfer done'))
256
+            ->setParsedSubject($l->t('Ownership transfer done'))
257
+
258
+            ->setRichMessage(
259
+                $l->t('The ownership transfer of {path} from {user} has completed.'),
260
+                [
261
+                    'path' => [
262
+                        'type' => 'highlight',
263
+                        'id' => $param['sourceUser'] . '::' . $param['nodeName'],
264
+                        'name' => $param['nodeName'],
265
+                    ],
266
+                    'user' => [
267
+                        'type' => 'user',
268
+                        'id' => $sourceUser->getUID(),
269
+                        'name' => $sourceUser->getDisplayName(),
270
+                    ],
271
+                ])
272
+            ->setParsedMessage(str_replace(['{path}', '{user}'], [$param['nodeName'], $sourceUser->getDisplayName()], $l->t('The ownership transfer of {path} from {user} has completed.')));
273
+
274
+        return $notification;
275
+    }
276
+
277
+    public function dismissNotification(INotification $notification): void {
278
+        if ($notification->getApp() !== 'files') {
279
+            throw new \InvalidArgumentException('Unhandled app');
280
+        }
281
+
282
+        // TODO: This should all be moved to a service that also the transferownershipContoller uses.
283
+        try {
284
+            $transferOwnership = $this->mapper->getById((int)$notification->getObjectId());
285
+        } catch (DoesNotExistException $e) {
286
+            return;
287
+        }
288
+
289
+        $notification = $this->notificationManager->createNotification();
290
+        $notification->setUser($transferOwnership->getSourceUser())
291
+            ->setApp('files')
292
+            ->setDateTime($this->timeFactory->getDateTime())
293
+            ->setSubject('transferownershipRequestDenied', [
294
+                'sourceUser' => $transferOwnership->getSourceUser(),
295
+                'targetUser' => $transferOwnership->getTargetUser(),
296
+                'nodeName' => $transferOwnership->getNodeName()
297
+            ])
298
+            ->setObject('transfer', (string)$transferOwnership->getId());
299
+        $this->notificationManager->notify($notification);
300
+
301
+        $this->mapper->delete($transferOwnership);
302
+    }
303
+
304
+    protected function getUser(string $userId): IUser {
305
+        $user = $this->userManager->get($userId);
306
+        if ($user instanceof IUser) {
307
+            return $user;
308
+        }
309
+        throw new \InvalidArgumentException('User not found');
310
+    }
311 311
 }
Please login to merge, or discard this patch.
apps/settings/lib/Activity/SecurityProvider.php 1 patch
Indentation   +66 added lines, -66 removed lines patch added patch discarded remove patch
@@ -37,77 +37,77 @@
 block discarded – undo
37 37
 
38 38
 class SecurityProvider implements IProvider {
39 39
 
40
-	/** @var L10nFactory */
41
-	private $l10n;
40
+    /** @var L10nFactory */
41
+    private $l10n;
42 42
 
43
-	/** @var IURLGenerator */
44
-	private $urlGenerator;
43
+    /** @var IURLGenerator */
44
+    private $urlGenerator;
45 45
 
46
-	/** @var IManager */
47
-	private $activityManager;
46
+    /** @var IManager */
47
+    private $activityManager;
48 48
 
49
-	public function __construct(L10nFactory $l10n, IURLGenerator $urlGenerator, IManager $activityManager) {
50
-		$this->urlGenerator = $urlGenerator;
51
-		$this->l10n = $l10n;
52
-		$this->activityManager = $activityManager;
53
-	}
49
+    public function __construct(L10nFactory $l10n, IURLGenerator $urlGenerator, IManager $activityManager) {
50
+        $this->urlGenerator = $urlGenerator;
51
+        $this->l10n = $l10n;
52
+        $this->activityManager = $activityManager;
53
+    }
54 54
 
55
-	public function parse($language, IEvent $event, IEvent $previousEvent = null) {
56
-		if ($event->getType() !== 'security') {
57
-			throw new InvalidArgumentException();
58
-		}
55
+    public function parse($language, IEvent $event, IEvent $previousEvent = null) {
56
+        if ($event->getType() !== 'security') {
57
+            throw new InvalidArgumentException();
58
+        }
59 59
 
60
-		$l = $this->l10n->get('settings', $language);
60
+        $l = $this->l10n->get('settings', $language);
61 61
 
62
-		switch ($event->getSubject()) {
63
-			case 'twofactor_success':
64
-				$params = $event->getSubjectParameters();
65
-				$event->setParsedSubject($l->t('You successfully logged in using two-factor authentication (%1$s)', [
66
-					$params['provider'],
67
-				]));
68
-				if ($this->activityManager->getRequirePNG()) {
69
-					$event->setIcon($this->urlGenerator->getAbsoluteURL($this->urlGenerator->imagePath('core', 'actions/password.png')));
70
-				} else {
71
-					$event->setIcon($this->urlGenerator->getAbsoluteURL($this->urlGenerator->imagePath('core', 'actions/password.svg')));
72
-				}
73
-				break;
74
-			case 'twofactor_failed':
75
-				$params = $event->getSubjectParameters();
76
-				$event->setParsedSubject($l->t('A login attempt using two-factor authentication failed (%1$s)', [
77
-					$params['provider'],
78
-				]));
79
-				if ($this->activityManager->getRequirePNG()) {
80
-					$event->setIcon($this->urlGenerator->getAbsoluteURL($this->urlGenerator->imagePath('core', 'actions/password.png')));
81
-				} else {
82
-					$event->setIcon($this->urlGenerator->getAbsoluteURL($this->urlGenerator->imagePath('core', 'actions/password.svg')));
83
-				}
84
-				break;
85
-			case 'remote_wipe_start':
86
-				$params = $event->getSubjectParameters();
87
-				$event->setParsedSubject($l->t('Remote wipe was started on %1$s', [
88
-					$params['name'],
89
-				]));
90
-				if ($this->activityManager->getRequirePNG()) {
91
-					$event->setIcon($this->urlGenerator->getAbsoluteURL($this->urlGenerator->imagePath('core', 'actions/delete.png')));
92
-				} else {
93
-					$event->setIcon($this->urlGenerator->getAbsoluteURL($this->urlGenerator->imagePath('core', 'actions/delete.svg')));
94
-				}
95
-				break;
96
-			case 'remote_wipe_finish':
97
-				$params = $event->getSubjectParameters();
98
-				$event->setParsedSubject($l->t('Remote wipe has finished on %1$s', [
99
-					$params['name'],
100
-				]));
101
-				if ($this->activityManager->getRequirePNG()) {
102
-					$event->setIcon($this->urlGenerator->getAbsoluteURL($this->urlGenerator->imagePath('core', 'actions/delete.png')));
103
-				} else {
104
-					$event->setIcon($this->urlGenerator->getAbsoluteURL($this->urlGenerator->imagePath('core', 'actions/delete.svg')));
105
-				}
106
-				break;
107
-			default:
108
-				throw new InvalidArgumentException();
109
-		}
110
-		return $event;
111
-	}
62
+        switch ($event->getSubject()) {
63
+            case 'twofactor_success':
64
+                $params = $event->getSubjectParameters();
65
+                $event->setParsedSubject($l->t('You successfully logged in using two-factor authentication (%1$s)', [
66
+                    $params['provider'],
67
+                ]));
68
+                if ($this->activityManager->getRequirePNG()) {
69
+                    $event->setIcon($this->urlGenerator->getAbsoluteURL($this->urlGenerator->imagePath('core', 'actions/password.png')));
70
+                } else {
71
+                    $event->setIcon($this->urlGenerator->getAbsoluteURL($this->urlGenerator->imagePath('core', 'actions/password.svg')));
72
+                }
73
+                break;
74
+            case 'twofactor_failed':
75
+                $params = $event->getSubjectParameters();
76
+                $event->setParsedSubject($l->t('A login attempt using two-factor authentication failed (%1$s)', [
77
+                    $params['provider'],
78
+                ]));
79
+                if ($this->activityManager->getRequirePNG()) {
80
+                    $event->setIcon($this->urlGenerator->getAbsoluteURL($this->urlGenerator->imagePath('core', 'actions/password.png')));
81
+                } else {
82
+                    $event->setIcon($this->urlGenerator->getAbsoluteURL($this->urlGenerator->imagePath('core', 'actions/password.svg')));
83
+                }
84
+                break;
85
+            case 'remote_wipe_start':
86
+                $params = $event->getSubjectParameters();
87
+                $event->setParsedSubject($l->t('Remote wipe was started on %1$s', [
88
+                    $params['name'],
89
+                ]));
90
+                if ($this->activityManager->getRequirePNG()) {
91
+                    $event->setIcon($this->urlGenerator->getAbsoluteURL($this->urlGenerator->imagePath('core', 'actions/delete.png')));
92
+                } else {
93
+                    $event->setIcon($this->urlGenerator->getAbsoluteURL($this->urlGenerator->imagePath('core', 'actions/delete.svg')));
94
+                }
95
+                break;
96
+            case 'remote_wipe_finish':
97
+                $params = $event->getSubjectParameters();
98
+                $event->setParsedSubject($l->t('Remote wipe has finished on %1$s', [
99
+                    $params['name'],
100
+                ]));
101
+                if ($this->activityManager->getRequirePNG()) {
102
+                    $event->setIcon($this->urlGenerator->getAbsoluteURL($this->urlGenerator->imagePath('core', 'actions/delete.png')));
103
+                } else {
104
+                    $event->setIcon($this->urlGenerator->getAbsoluteURL($this->urlGenerator->imagePath('core', 'actions/delete.svg')));
105
+                }
106
+                break;
107
+            default:
108
+                throw new InvalidArgumentException();
109
+        }
110
+        return $event;
111
+    }
112 112
 
113 113
 }
Please login to merge, or discard this patch.
apps/files_sharing/templates/public.php 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -111,10 +111,10 @@
 block discarded – undo
111 111
 			<?php if (!empty($_['disclaimer'])) { ?>
112 112
 				<div>
113 113
 					<?php
114
-						echo $l->t('By uploading files, you agree to the %1$sterms of service%2$s.', [
115
-							'<span id="show-terms-dialog">', '</span>'
116
-						]);
117
-					?>
114
+                        echo $l->t('By uploading files, you agree to the %1$sterms of service%2$s.', [
115
+                            '<span id="show-terms-dialog">', '</span>'
116
+                        ]);
117
+                    ?>
118 118
 				</div>
119 119
 			<?php } ?>
120 120
 		</div>
Please login to merge, or discard this patch.
apps/files_external/lib/Controller/AjaxController.php 1 patch
Indentation   +73 added lines, -73 removed lines patch added patch discarded remove patch
@@ -38,84 +38,84 @@
 block discarded – undo
38 38
 use OCP\IUserSession;
39 39
 
40 40
 class AjaxController extends Controller {
41
-	/** @var RSA */
42
-	private $rsaMechanism;
43
-	/** @var GlobalAuth  */
44
-	private $globalAuth;
45
-	/** @var IUserSession */
46
-	private $userSession;
47
-	/** @var IGroupManager */
48
-	private $groupManager;
41
+    /** @var RSA */
42
+    private $rsaMechanism;
43
+    /** @var GlobalAuth  */
44
+    private $globalAuth;
45
+    /** @var IUserSession */
46
+    private $userSession;
47
+    /** @var IGroupManager */
48
+    private $groupManager;
49 49
 
50
-	/**
51
-	 * @param string $appName
52
-	 * @param IRequest $request
53
-	 * @param RSA $rsaMechanism
54
-	 * @param GlobalAuth $globalAuth
55
-	 * @param IUserSession $userSession
56
-	 * @param IGroupManager $groupManager
57
-	 */
58
-	public function __construct($appName,
59
-								IRequest $request,
60
-								RSA $rsaMechanism,
61
-								GlobalAuth $globalAuth,
62
-								IUserSession $userSession,
63
-								IGroupManager $groupManager) {
64
-		parent::__construct($appName, $request);
65
-		$this->rsaMechanism = $rsaMechanism;
66
-		$this->globalAuth = $globalAuth;
67
-		$this->userSession = $userSession;
68
-		$this->groupManager = $groupManager;
69
-	}
50
+    /**
51
+     * @param string $appName
52
+     * @param IRequest $request
53
+     * @param RSA $rsaMechanism
54
+     * @param GlobalAuth $globalAuth
55
+     * @param IUserSession $userSession
56
+     * @param IGroupManager $groupManager
57
+     */
58
+    public function __construct($appName,
59
+                                IRequest $request,
60
+                                RSA $rsaMechanism,
61
+                                GlobalAuth $globalAuth,
62
+                                IUserSession $userSession,
63
+                                IGroupManager $groupManager) {
64
+        parent::__construct($appName, $request);
65
+        $this->rsaMechanism = $rsaMechanism;
66
+        $this->globalAuth = $globalAuth;
67
+        $this->userSession = $userSession;
68
+        $this->groupManager = $groupManager;
69
+    }
70 70
 
71
-	/**
72
-	 * @param int $keyLength
73
-	 * @return array
74
-	 */
75
-	private function generateSshKeys($keyLength) {
76
-		$key = $this->rsaMechanism->createKey($keyLength);
77
-		// Replace the placeholder label with a more meaningful one
78
-		$key['publickey'] = str_replace('phpseclib-generated-key', gethostname(), $key['publickey']);
71
+    /**
72
+     * @param int $keyLength
73
+     * @return array
74
+     */
75
+    private function generateSshKeys($keyLength) {
76
+        $key = $this->rsaMechanism->createKey($keyLength);
77
+        // Replace the placeholder label with a more meaningful one
78
+        $key['publickey'] = str_replace('phpseclib-generated-key', gethostname(), $key['publickey']);
79 79
 
80
-		return $key;
81
-	}
80
+        return $key;
81
+    }
82 82
 
83
-	/**
84
-	 * Generates an SSH public/private key pair.
85
-	 *
86
-	 * @NoAdminRequired
87
-	 * @param int $keyLength
88
-	 */
89
-	public function getSshKeys($keyLength = 1024) {
90
-		$key = $this->generateSshKeys($keyLength);
91
-		return new JSONResponse(
92
-			['data' => [
93
-				'private_key' => $key['privatekey'],
94
-				'public_key' => $key['publickey']
95
-			],
96
-				'status' => 'success'
97
-			]);
98
-	}
83
+    /**
84
+     * Generates an SSH public/private key pair.
85
+     *
86
+     * @NoAdminRequired
87
+     * @param int $keyLength
88
+     */
89
+    public function getSshKeys($keyLength = 1024) {
90
+        $key = $this->generateSshKeys($keyLength);
91
+        return new JSONResponse(
92
+            ['data' => [
93
+                'private_key' => $key['privatekey'],
94
+                'public_key' => $key['publickey']
95
+            ],
96
+                'status' => 'success'
97
+            ]);
98
+    }
99 99
 
100
-	/**
101
-	 * @NoAdminRequired
102
-	 *
103
-	 * @param string $uid
104
-	 * @param string $user
105
-	 * @param string $password
106
-	 * @return bool
107
-	 */
108
-	public function saveGlobalCredentials($uid, $user, $password) {
109
-		$currentUser = $this->userSession->getUser();
100
+    /**
101
+     * @NoAdminRequired
102
+     *
103
+     * @param string $uid
104
+     * @param string $user
105
+     * @param string $password
106
+     * @return bool
107
+     */
108
+    public function saveGlobalCredentials($uid, $user, $password) {
109
+        $currentUser = $this->userSession->getUser();
110 110
 
111
-		// Non-admins can only edit their own credentials
112
-		$allowedToEdit = ($this->groupManager->isAdmin($currentUser->getUID()) || $currentUser->getUID() === $uid);
111
+        // Non-admins can only edit their own credentials
112
+        $allowedToEdit = ($this->groupManager->isAdmin($currentUser->getUID()) || $currentUser->getUID() === $uid);
113 113
 
114
-		if ($allowedToEdit) {
115
-			$this->globalAuth->saveAuth($uid, $user, $password);
116
-			return true;
117
-		} else {
118
-			return false;
119
-		}
120
-	}
114
+        if ($allowedToEdit) {
115
+            $this->globalAuth->saveAuth($uid, $user, $password);
116
+            return true;
117
+        } else {
118
+            return false;
119
+        }
120
+    }
121 121
 }
Please login to merge, or discard this patch.
core/templates/loginflow/grant.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -31,9 +31,9 @@
 block discarded – undo
31 31
 	<h2><?php p($l->t('Account access')) ?></h2>
32 32
 	<p class="info">
33 33
 		<?php print_unescaped($l->t('You are about to grant %1$s access to your %2$s account.', [
34
-			'<strong>' . \OCP\Util::sanitizeHTML($_['client']) . '</strong>',
35
-			\OCP\Util::sanitizeHTML($_['instanceName'])
36
-		])) ?>
34
+            '<strong>' . \OCP\Util::sanitizeHTML($_['client']) . '</strong>',
35
+            \OCP\Util::sanitizeHTML($_['instanceName'])
36
+        ])) ?>
37 37
 	</p>
38 38
 
39 39
 	<br/>
Please login to merge, or discard this patch.
apps/user_ldap/lib/ConnectionFactory.php 1 patch
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -24,14 +24,14 @@
 block discarded – undo
24 24
 namespace OCA\User_LDAP;
25 25
 
26 26
 class ConnectionFactory {
27
-	/** @var ILDAPWrapper */
28
-	private $ldap;
27
+    /** @var ILDAPWrapper */
28
+    private $ldap;
29 29
 
30
-	public function __construct(ILDAPWrapper $ldap) {
31
-		$this->ldap = $ldap;
32
-	}
30
+    public function __construct(ILDAPWrapper $ldap) {
31
+        $this->ldap = $ldap;
32
+    }
33 33
 
34
-	public function get($prefix) {
35
-		return new Connection($this->ldap, $prefix, 'user_ldap');
36
-	}
34
+    public function get($prefix) {
35
+        return new Connection($this->ldap, $prefix, 'user_ldap');
36
+    }
37 37
 }
Please login to merge, or discard this patch.
apps/files_trashbin/lib/Sabre/TrashFolderFile.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@
 block discarded – undo
28 28
 namespace OCA\Files_Trashbin\Sabre;
29 29
 
30 30
 class TrashFolderFile extends AbstractTrashFile {
31
-	public function get() {
32
-		return $this->data->getStorage()->fopen($this->data->getInternalPath(), 'rb');
33
-	}
31
+    public function get() {
32
+        return $this->data->getStorage()->fopen($this->data->getInternalPath(), 'rb');
33
+    }
34 34
 }
Please login to merge, or discard this patch.