|
9 | 9 |
|
10 | 10 | use OCA\Files_External\NotFoundException; |
11 | 11 | use OCA\Files_External\Service\GlobalStoragesService; |
| 12 | +use OCA\Files_External\Settings\Admin; |
12 | 13 | use OCP\AppFramework\Http; |
| 14 | +use OCP\AppFramework\Http\Attribute\AuthorizedAdminSetting; |
13 | 15 | use OCP\AppFramework\Http\Attribute\PasswordConfirmationRequired; |
14 | 16 | use OCP\AppFramework\Http\DataResponse; |
15 | 17 | use OCP\IConfig; |
@@ -60,6 +62,7 @@ public function __construct( |
60 | 62 | * @param ?array $applicableGroups groups for which to mount the storage |
61 | 63 | * @param ?int $priority priority |
62 | 64 | */ |
| 65 | + #[AuthorizedAdminSetting(settings: Admin::class)] |
63 | 66 | #[PasswordConfirmationRequired(strict: true)] |
64 | 67 | public function create( |
65 | 68 | string $mountPoint, |
@@ -123,6 +126,7 @@ public function create( |
123 | 126 | * @param ?array $applicableGroups groups for which to mount the storage |
124 | 127 | * @param ?int $priority priority |
125 | 128 | */ |
| 129 | + #[AuthorizedAdminSetting(settings: Admin::class)] |
126 | 130 | #[PasswordConfirmationRequired(strict: true)] |
127 | 131 | public function update( |
128 | 132 | int $id, |
@@ -173,4 +177,22 @@ public function update( |
173 | 177 | Http::STATUS_OK |
174 | 178 | ); |
175 | 179 | } |
| 180 | + |
| 181 | + // PHP attributes are not inherited, so these methods override the parent |
| 182 | + // solely to attach #[AuthorizedAdminSetting] and expose them to delegated admins. |
| 183 | + #[AuthorizedAdminSetting(settings: Admin::class)] |
| 184 | + public function index() { |
| 185 | + return parent::index(); |
| 186 | + } |
| 187 | + |
| 188 | + #[AuthorizedAdminSetting(settings: Admin::class)] |
| 189 | + public function show(int $id, $testOnly = true) { |
| 190 | + return parent::show($id, $testOnly); |
| 191 | + } |
| 192 | + |
| 193 | + #[AuthorizedAdminSetting(settings: Admin::class)] |
| 194 | + #[PasswordConfirmationRequired(strict: true)] |
| 195 | + public function destroy(int $id) { |
| 196 | + return parent::destroy($id); |
| 197 | + } |
176 | 198 | } |
0 commit comments