Skip to content

Commit 1617845

Browse files
committed
feat: add ocs route to get apps enabled for current user
Signed-off-by: Jana Peper <jana.peper@nextcloud.com>
1 parent b95f96a commit 1617845

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

apps/provisioning_api/appinfo/routes.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
'ocs' => [
1010
// Apps
1111
['root' => '/cloud', 'name' => 'Apps#getApps', 'url' => '/apps', 'verb' => 'GET'],
12+
['root' => '/cloud', 'name' => 'Apps#getEnabledAppsForUser', 'url' => '/apps/user_enabled', 'verb' => 'GET'],
1213
['root' => '/cloud', 'name' => 'Apps#getAppInfo', 'url' => '/apps/{app}', 'verb' => 'GET'],
1314
['root' => '/cloud', 'name' => 'Apps#enable', 'url' => '/apps/{app}', 'verb' => 'POST'],
1415
['root' => '/cloud', 'name' => 'Apps#disable', 'url' => '/apps/{app}', 'verb' => 'DELETE'],

apps/provisioning_api/lib/Controller/AppsController.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
use OCP\App\IAppManager;
1616
use OCP\AppFramework\Http;
1717
use OCP\AppFramework\Http\Attribute\PasswordConfirmationRequired;
18+
use OCP\AppFramework\Http\Attribute\NoAdminRequired;
1819
use OCP\AppFramework\Http\DataResponse;
1920
use OCP\AppFramework\OCS\OCSException;
2021
use OCP\AppFramework\OCSController;
@@ -77,6 +78,20 @@ public function getApps(?string $filter = null): DataResponse {
7778
}
7879
}
7980

81+
/**
82+
* @NoSubAdminRequired
83+
*
84+
* Get a list of enabled apps for the current user
85+
*
86+
* @return DataResponse<Http::STATUS_OK, array{apps: list<string>}, array{}>
87+
*
88+
* 200: Enabled apps returned
89+
*/
90+
#[NoAdminRequired]
91+
public function getEnabledAppsForUser(): DataResponse {
92+
return new DataResponse(['apps' => OC_App::getEnabledApps()]);
93+
}
94+
8095
/**
8196
* Get the app info for an app
8297
*

0 commit comments

Comments
 (0)