Skip to content

Commit cc152e4

Browse files
committed
refactor(encryption): Replace security annotations with respective attributes
Signed-off-by: provokateurin <kate@provokateurin.de>
1 parent ea7eeb2 commit cc152e4

File tree

3 files changed

+9
-8
lines changed

3 files changed

+9
-8
lines changed

apps/encryption/lib/Controller/RecoveryController.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
use OCA\Encryption\Recovery;
1111
use OCP\AppFramework\Controller;
1212
use OCP\AppFramework\Http;
13+
use OCP\AppFramework\Http\Attribute\NoAdminRequired;
1314
use OCP\AppFramework\Http\DataResponse;
1415
use OCP\IConfig;
1516
use OCP\IL10N;
@@ -136,11 +137,10 @@ public function changeRecoveryPassword($newPassword, $oldPassword, $confirmPassw
136137
}
137138

138139
/**
139-
* @NoAdminRequired
140-
*
141140
* @param string $userEnableRecovery
142141
* @return DataResponse
143142
*/
143+
#[NoAdminRequired]
144144
public function userSetRecovery($userEnableRecovery) {
145145
if ($userEnableRecovery === '0' || $userEnableRecovery === '1') {
146146
$result = $this->recovery->setRecoveryForUser($userEnableRecovery);

apps/encryption/lib/Controller/SettingsController.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
use OCA\Encryption\Util;
1414
use OCP\AppFramework\Controller;
1515
use OCP\AppFramework\Http;
16+
use OCP\AppFramework\Http\Attribute\NoAdminRequired;
17+
use OCP\AppFramework\Http\Attribute\UseSession;
1618
use OCP\AppFramework\Http\DataResponse;
1719
use OCP\IL10N;
1820
use OCP\IRequest;
@@ -82,13 +84,12 @@ public function __construct($AppName,
8284

8385

8486
/**
85-
* @NoAdminRequired
86-
* @UseSession
87-
*
8887
* @param string $oldPassword
8988
* @param string $newPassword
9089
* @return DataResponse
9190
*/
91+
#[NoAdminRequired]
92+
#[UseSession]
9293
public function updatePrivateKeyPassword($oldPassword, $newPassword) {
9394
$result = false;
9495
$uid = $this->userSession->getUser()->getUID();
@@ -137,11 +138,10 @@ public function updatePrivateKeyPassword($oldPassword, $newPassword) {
137138
}
138139

139140
/**
140-
* @UseSession
141-
*
142141
* @param bool $encryptHomeStorage
143142
* @return DataResponse
144143
*/
144+
#[UseSession]
145145
public function setEncryptHomeStorage($encryptHomeStorage) {
146146
$this->util->setEncryptHomeStorage($encryptHomeStorage);
147147
return new DataResponse();

apps/encryption/lib/Controller/StatusController.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
use OCA\Encryption\Session;
1111
use OCP\AppFramework\Controller;
12+
use OCP\AppFramework\Http\Attribute\NoAdminRequired;
1213
use OCP\AppFramework\Http\DataResponse;
1314
use OCP\Encryption\IManager;
1415
use OCP\IL10N;
@@ -45,9 +46,9 @@ public function __construct($AppName,
4546
}
4647

4748
/**
48-
* @NoAdminRequired
4949
* @return DataResponse
5050
*/
51+
#[NoAdminRequired]
5152
public function getStatus() {
5253
$status = 'error';
5354
$message = 'no valid init status';

0 commit comments

Comments
 (0)