diff --git a/apps/federatedfilesharing/lib/Controller/MountPublicLinkController.php b/apps/federatedfilesharing/lib/Controller/MountPublicLinkController.php index 0cfc3dba262a2..ab6db8c9c75c6 100644 --- a/apps/federatedfilesharing/lib/Controller/MountPublicLinkController.php +++ b/apps/federatedfilesharing/lib/Controller/MountPublicLinkController.php @@ -36,7 +36,6 @@ * * @package OCA\FederatedFileSharing\Controller */ -#[OpenAPI(scope: OpenAPI::SCOPE_FEDERATION)] class MountPublicLinkController extends Controller { /** * MountPublicLinkController constructor. @@ -71,6 +70,7 @@ public function __construct( #[NoCSRFRequired] #[PublicPage] #[BruteForceProtection(action: 'publicLink2FederatedShare')] + #[OpenAPI(scope: OpenAPI::SCOPE_FEDERATION)] public function createFederatedShare($shareWith, $token, $password = '') { if (!$this->federatedShareProvider->isOutgoingServer2serverShareEnabled()) { return new JSONResponse( diff --git a/apps/files/lib/Controller/ApiController.php b/apps/files/lib/Controller/ApiController.php index 5ba325f1bf867..dba732c9c52ed 100644 --- a/apps/files/lib/Controller/ApiController.php +++ b/apps/files/lib/Controller/ApiController.php @@ -85,6 +85,7 @@ public function __construct( #[NoAdminRequired] #[NoCSRFRequired] #[StrictCookiesRequired] + #[OpenAPI(scope: OpenAPI::SCOPE_DEFAULT)] public function getThumbnail($x, $y, $file) { if ($x < 1 || $y < 1) { return new DataResponse(['message' => 'Requested size must be numeric and a positive value.'], Http::STATUS_BAD_REQUEST); @@ -277,6 +278,7 @@ private function getChildren(array $nodes, int $depth = 1, int $currentDepth = 0 */ #[NoAdminRequired] #[ApiRoute(verb: 'GET', url: '/api/v1/folder-tree')] + #[OpenAPI(scope: OpenAPI::SCOPE_DEFAULT)] public function getFolderTree(string $path = '/', int $depth = 1): JSONResponse { $user = $this->userSession->getUser(); if (!($user instanceof IUser)) { diff --git a/apps/files_sharing/lib/Controller/PublicPreviewController.php b/apps/files_sharing/lib/Controller/PublicPreviewController.php index 8e8ee3768cbc0..91dead57e805a 100644 --- a/apps/files_sharing/lib/Controller/PublicPreviewController.php +++ b/apps/files_sharing/lib/Controller/PublicPreviewController.php @@ -7,6 +7,7 @@ use OCP\AppFramework\Http; use OCP\AppFramework\Http\Attribute\NoCSRFRequired; +use OCP\AppFramework\Http\Attribute\OpenAPI; use OCP\AppFramework\Http\Attribute\PublicPage; use OCP\AppFramework\Http\DataResponse; use OCP\AppFramework\Http\FileDisplayResponse; @@ -71,6 +72,7 @@ protected function isPasswordProtected(): bool { */ #[PublicPage] #[NoCSRFRequired] + #[OpenAPI(scope: OpenAPI::SCOPE_DEFAULT)] public function getPreview( string $token, string $file = '', @@ -143,6 +145,7 @@ public function getPreview( */ #[PublicPage] #[NoCSRFRequired] + #[OpenAPI(scope: OpenAPI::SCOPE_DEFAULT)] public function directLink(string $token) { // No token no image if ($token === '') { diff --git a/apps/files_sharing/lib/Controller/ShareInfoController.php b/apps/files_sharing/lib/Controller/ShareInfoController.php index 7805973f3c5f6..0a290d69c65f4 100644 --- a/apps/files_sharing/lib/Controller/ShareInfoController.php +++ b/apps/files_sharing/lib/Controller/ShareInfoController.php @@ -11,6 +11,7 @@ use OCP\AppFramework\Http; use OCP\AppFramework\Http\Attribute\BruteForceProtection; use OCP\AppFramework\Http\Attribute\NoCSRFRequired; +use OCP\AppFramework\Http\Attribute\OpenAPI; use OCP\AppFramework\Http\Attribute\PublicPage; use OCP\AppFramework\Http\JSONResponse; use OCP\Constants; @@ -57,6 +58,7 @@ public function __construct( #[PublicPage] #[NoCSRFRequired] #[BruteForceProtection(action: 'shareinfo')] + #[OpenAPI(scope: OpenAPI::SCOPE_DEFAULT)] public function info(string $t, ?string $password = null, ?string $dir = null, int $depth = -1): JSONResponse { try { $share = $this->shareManager->getShareByToken($t); diff --git a/apps/files_trashbin/lib/Controller/PreviewController.php b/apps/files_trashbin/lib/Controller/PreviewController.php index a71bc4f01c792..a4e911d88ef81 100644 --- a/apps/files_trashbin/lib/Controller/PreviewController.php +++ b/apps/files_trashbin/lib/Controller/PreviewController.php @@ -13,6 +13,7 @@ use OCP\AppFramework\Http; use OCP\AppFramework\Http\Attribute\NoAdminRequired; use OCP\AppFramework\Http\Attribute\NoCSRFRequired; +use OCP\AppFramework\Http\Attribute\OpenAPI; use OCP\AppFramework\Http\DataResponse; use OCP\AppFramework\Http\FileDisplayResponse; use OCP\AppFramework\Utility\ITimeFactory; @@ -24,6 +25,7 @@ use OCP\IRequest; use OCP\IUserSession; +#[OpenAPI(scope: OpenAPI::SCOPE_DEFAULT)] class PreviewController extends Controller { public function __construct( string $appName, diff --git a/apps/files_versions/lib/Controller/PreviewController.php b/apps/files_versions/lib/Controller/PreviewController.php index fe984376d29eb..2c2793b687893 100644 --- a/apps/files_versions/lib/Controller/PreviewController.php +++ b/apps/files_versions/lib/Controller/PreviewController.php @@ -10,6 +10,7 @@ use OCP\AppFramework\Http; use OCP\AppFramework\Http\Attribute\NoAdminRequired; use OCP\AppFramework\Http\Attribute\NoCSRFRequired; +use OCP\AppFramework\Http\Attribute\OpenAPI; use OCP\AppFramework\Http\DataResponse; use OCP\AppFramework\Http\FileDisplayResponse; use OCP\Files\IRootFolder; @@ -18,6 +19,7 @@ use OCP\IRequest; use OCP\IUserSession; +#[OpenAPI(scope: OpenAPI::SCOPE_DEFAULT)] class PreviewController extends Controller { public function __construct( diff --git a/apps/oauth2/lib/Controller/LoginRedirectorController.php b/apps/oauth2/lib/Controller/LoginRedirectorController.php index ca2255d96d7dc..77bb252206a18 100644 --- a/apps/oauth2/lib/Controller/LoginRedirectorController.php +++ b/apps/oauth2/lib/Controller/LoginRedirectorController.php @@ -13,6 +13,7 @@ use OCP\AppFramework\Controller; use OCP\AppFramework\Http; use OCP\AppFramework\Http\Attribute\NoCSRFRequired; +use OCP\AppFramework\Http\Attribute\OpenAPI; use OCP\AppFramework\Http\Attribute\PublicPage; use OCP\AppFramework\Http\Attribute\UseSession; use OCP\AppFramework\Http\RedirectResponse; @@ -22,6 +23,7 @@ use OCP\ISession; use OCP\IURLGenerator; +#[OpenAPI(scope: OpenAPI::SCOPE_DEFAULT)] class LoginRedirectorController extends Controller { /** * @param string $appName diff --git a/apps/oauth2/lib/Controller/OauthApiController.php b/apps/oauth2/lib/Controller/OauthApiController.php index 2e0732a109970..11f17fda4bf6d 100644 --- a/apps/oauth2/lib/Controller/OauthApiController.php +++ b/apps/oauth2/lib/Controller/OauthApiController.php @@ -17,6 +17,7 @@ use OCP\AppFramework\Http; use OCP\AppFramework\Http\Attribute\BruteForceProtection; use OCP\AppFramework\Http\Attribute\NoCSRFRequired; +use OCP\AppFramework\Http\Attribute\OpenAPI; use OCP\AppFramework\Http\Attribute\PublicPage; use OCP\AppFramework\Http\JSONResponse; use OCP\AppFramework\Utility\ITimeFactory; @@ -29,6 +30,7 @@ use OCP\Security\ISecureRandom; use Psr\Log\LoggerInterface; +#[OpenAPI(scope: OpenAPI::SCOPE_DEFAULT)] class OauthApiController extends Controller { // the authorization code expires after 10 minutes public const AUTHORIZATION_CODE_EXPIRES_AFTER = 10 * 60; diff --git a/apps/provisioning_api/composer/composer/autoload_classmap.php b/apps/provisioning_api/composer/composer/autoload_classmap.php index d702db318db2c..7a007f4577d9e 100644 --- a/apps/provisioning_api/composer/composer/autoload_classmap.php +++ b/apps/provisioning_api/composer/composer/autoload_classmap.php @@ -9,7 +9,7 @@ 'Composer\\InstalledVersions' => $vendorDir . '/composer/InstalledVersions.php', 'OCA\\Provisioning_API\\AppInfo\\Application' => $baseDir . '/../lib/AppInfo/Application.php', 'OCA\\Provisioning_API\\Capabilities' => $baseDir . '/../lib/Capabilities.php', - 'OCA\\Provisioning_API\\Controller\\AUserData' => $baseDir . '/../lib/Controller/AUserData.php', + 'OCA\\Provisioning_API\\Controller\\AUserDataOCSController' => $baseDir . '/../lib/Controller/AUserDataOCSController.php', 'OCA\\Provisioning_API\\Controller\\AppConfigController' => $baseDir . '/../lib/Controller/AppConfigController.php', 'OCA\\Provisioning_API\\Controller\\AppsController' => $baseDir . '/../lib/Controller/AppsController.php', 'OCA\\Provisioning_API\\Controller\\GroupsController' => $baseDir . '/../lib/Controller/GroupsController.php', diff --git a/apps/provisioning_api/composer/composer/autoload_static.php b/apps/provisioning_api/composer/composer/autoload_static.php index 4c987e24fc99a..9480fc2d3f128 100644 --- a/apps/provisioning_api/composer/composer/autoload_static.php +++ b/apps/provisioning_api/composer/composer/autoload_static.php @@ -24,7 +24,7 @@ class ComposerStaticInitProvisioning_API 'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php', 'OCA\\Provisioning_API\\AppInfo\\Application' => __DIR__ . '/..' . '/../lib/AppInfo/Application.php', 'OCA\\Provisioning_API\\Capabilities' => __DIR__ . '/..' . '/../lib/Capabilities.php', - 'OCA\\Provisioning_API\\Controller\\AUserData' => __DIR__ . '/..' . '/../lib/Controller/AUserData.php', + 'OCA\\Provisioning_API\\Controller\\AUserDataOCSController' => __DIR__ . '/..' . '/../lib/Controller/AUserDataOCSController.php', 'OCA\\Provisioning_API\\Controller\\AppConfigController' => __DIR__ . '/..' . '/../lib/Controller/AppConfigController.php', 'OCA\\Provisioning_API\\Controller\\AppsController' => __DIR__ . '/..' . '/../lib/Controller/AppsController.php', 'OCA\\Provisioning_API\\Controller\\GroupsController' => __DIR__ . '/..' . '/../lib/Controller/GroupsController.php', diff --git a/apps/provisioning_api/lib/Controller/AUserData.php b/apps/provisioning_api/lib/Controller/AUserDataOCSController.php similarity index 99% rename from apps/provisioning_api/lib/Controller/AUserData.php rename to apps/provisioning_api/lib/Controller/AUserDataOCSController.php index 61459e40b8b4b..cafd2b211c6c3 100644 --- a/apps/provisioning_api/lib/Controller/AUserData.php +++ b/apps/provisioning_api/lib/Controller/AUserDataOCSController.php @@ -34,7 +34,7 @@ * @psalm-import-type Provisioning_APIUserDetails from ResponseDefinitions * @psalm-import-type Provisioning_APIUserDetailsQuota from ResponseDefinitions */ -abstract class AUserData extends OCSController { +abstract class AUserDataOCSController extends OCSController { public const SCOPE_SUFFIX = 'Scope'; public const USER_FIELD_DISPLAYNAME = 'display'; diff --git a/apps/provisioning_api/lib/Controller/GroupsController.php b/apps/provisioning_api/lib/Controller/GroupsController.php index 87544cc899274..0ae7faae7e819 100644 --- a/apps/provisioning_api/lib/Controller/GroupsController.php +++ b/apps/provisioning_api/lib/Controller/GroupsController.php @@ -36,7 +36,7 @@ * @psalm-import-type Provisioning_APIGroupDetails from ResponseDefinitions * @psalm-import-type Provisioning_APIUserDetails from ResponseDefinitions */ -class GroupsController extends AUserData { +class GroupsController extends AUserDataOCSController { public function __construct( string $appName, diff --git a/apps/provisioning_api/lib/Controller/UsersController.php b/apps/provisioning_api/lib/Controller/UsersController.php index 9363b4ca9352c..7f9ea26b79cec 100644 --- a/apps/provisioning_api/lib/Controller/UsersController.php +++ b/apps/provisioning_api/lib/Controller/UsersController.php @@ -53,7 +53,7 @@ /** * @psalm-import-type Provisioning_APIUserDetails from ResponseDefinitions */ -class UsersController extends AUserData { +class UsersController extends AUserDataOCSController { private IL10N $l10n; @@ -1092,9 +1092,9 @@ public function editUser(string $userId, string $key, string $value): DataRespon throw new OCSException($this->l10n->t('Invalid first day of week'), 101); } if ($intValue === -1) { - $this->config->deleteUserValue($targetUser->getUID(), 'core', AUserData::USER_FIELD_FIRST_DAY_OF_WEEK); + $this->config->deleteUserValue($targetUser->getUID(), 'core', AUserDataOCSController::USER_FIELD_FIRST_DAY_OF_WEEK); } else { - $this->config->setUserValue($targetUser->getUID(), 'core', AUserData::USER_FIELD_FIRST_DAY_OF_WEEK, $value); + $this->config->setUserValue($targetUser->getUID(), 'core', AUserDataOCSController::USER_FIELD_FIRST_DAY_OF_WEEK, $value); } break; case self::USER_FIELD_NOTIFICATION_EMAIL: diff --git a/apps/settings/lib/Settings/Personal/PersonalInfo.php b/apps/settings/lib/Settings/Personal/PersonalInfo.php index 6a1f7e97e4abc..f0bf083ecca1c 100644 --- a/apps/settings/lib/Settings/Personal/PersonalInfo.php +++ b/apps/settings/lib/Settings/Personal/PersonalInfo.php @@ -11,7 +11,7 @@ use OC\Profile\ProfileManager; use OCA\FederatedFileSharing\FederatedShareProvider; -use OCA\Provisioning_API\Controller\AUserData; +use OCA\Provisioning_API\Controller\AUserDataOCSController; use OCP\Accounts\IAccount; use OCP\Accounts\IAccountManager; use OCP\Accounts\IAccountProperty; @@ -106,7 +106,7 @@ public function getForm(): TemplateResponse { 'headline' => $this->getProperty($account, IAccountManager::PROPERTY_HEADLINE), 'biography' => $this->getProperty($account, IAccountManager::PROPERTY_BIOGRAPHY), 'birthdate' => $this->getProperty($account, IAccountManager::PROPERTY_BIRTHDATE), - 'firstDayOfWeek' => $this->config->getUserValue($uid, 'core', AUserData::USER_FIELD_FIRST_DAY_OF_WEEK), + 'firstDayOfWeek' => $this->config->getUserValue($uid, 'core', AUserDataOCSController::USER_FIELD_FIRST_DAY_OF_WEEK), 'pronouns' => $this->getProperty($account, IAccountManager::PROPERTY_PRONOUNS), ]; diff --git a/apps/theming/lib/Controller/IconController.php b/apps/theming/lib/Controller/IconController.php index acb59c9a86f57..f487663d8c81a 100644 --- a/apps/theming/lib/Controller/IconController.php +++ b/apps/theming/lib/Controller/IconController.php @@ -13,6 +13,7 @@ use OCP\AppFramework\Controller; use OCP\AppFramework\Http; use OCP\AppFramework\Http\Attribute\NoCSRFRequired; +use OCP\AppFramework\Http\Attribute\OpenAPI; use OCP\AppFramework\Http\Attribute\PublicPage; use OCP\AppFramework\Http\DataDisplayResponse; use OCP\AppFramework\Http\FileDisplayResponse; @@ -51,6 +52,7 @@ public function __construct( */ #[PublicPage] #[NoCSRFRequired] + #[OpenAPI(scope: OpenAPI::SCOPE_DEFAULT)] public function getThemedIcon(string $app, string $image): Response { if ($app !== 'core' && !$this->appManager->isEnabledForUser($app)) { $app = 'core'; @@ -84,6 +86,7 @@ public function getThemedIcon(string $app, string $image): Response { */ #[PublicPage] #[NoCSRFRequired] + #[OpenAPI(scope: OpenAPI::SCOPE_DEFAULT)] public function getFavicon(string $app = 'core'): Response { if ($app !== 'core' && !$this->appManager->isEnabledForUser($app)) { $app = 'core'; @@ -129,6 +132,7 @@ public function getFavicon(string $app = 'core'): Response { */ #[PublicPage] #[NoCSRFRequired] + #[OpenAPI(scope: OpenAPI::SCOPE_DEFAULT)] public function getTouchIcon(string $app = 'core'): Response { if ($app !== 'core' && !$this->appManager->isEnabledForUser($app)) { $app = 'core'; diff --git a/apps/theming/lib/Controller/ThemingController.php b/apps/theming/lib/Controller/ThemingController.php index d748a6278b41d..e649ea785303e 100644 --- a/apps/theming/lib/Controller/ThemingController.php +++ b/apps/theming/lib/Controller/ThemingController.php @@ -16,6 +16,7 @@ use OCP\AppFramework\Http\Attribute\AuthorizedAdminSetting; use OCP\AppFramework\Http\Attribute\BruteForceProtection; use OCP\AppFramework\Http\Attribute\NoCSRFRequired; +use OCP\AppFramework\Http\Attribute\OpenAPI; use OCP\AppFramework\Http\Attribute\PublicPage; use OCP\AppFramework\Http\ContentSecurityPolicy; use OCP\AppFramework\Http\DataDisplayResponse; @@ -339,6 +340,7 @@ public function undoAll(): DataResponse { */ #[PublicPage] #[NoCSRFRequired] + #[OpenAPI(scope: OpenAPI::SCOPE_DEFAULT)] public function getImage(string $key, bool $useSvg = true) { try { $file = $this->imageManager->getImage($key, $useSvg); @@ -377,6 +379,7 @@ public function getImage(string $key, bool $useSvg = true) { */ #[PublicPage] #[NoCSRFRequired] + #[OpenAPI(scope: OpenAPI::SCOPE_DEFAULT)] public function getThemeStylesheet(string $themeId, bool $plain = false, bool $withCustomCss = false) { $themes = $this->themesService->getThemes(); if (!in_array($themeId, array_keys($themes))) { @@ -425,6 +428,7 @@ public function getThemeStylesheet(string $themeId, bool $plain = false, bool $w #[PublicPage] #[NoCSRFRequired] #[BruteForceProtection(action: 'manifest')] + #[OpenAPI(scope: OpenAPI::SCOPE_DEFAULT)] public function getManifest(string $app): JSONResponse { $cacheBusterValue = $this->config->getAppValue('theming', 'cachebuster', '0'); if ($app === 'core' || $app === 'settings') { diff --git a/apps/theming/lib/Controller/UserThemeController.php b/apps/theming/lib/Controller/UserThemeController.php index 1ead97f5d37b1..770f2ca922f59 100644 --- a/apps/theming/lib/Controller/UserThemeController.php +++ b/apps/theming/lib/Controller/UserThemeController.php @@ -17,6 +17,7 @@ use OCP\AppFramework\Http; use OCP\AppFramework\Http\Attribute\NoAdminRequired; use OCP\AppFramework\Http\Attribute\NoCSRFRequired; +use OCP\AppFramework\Http\Attribute\OpenAPI; use OCP\AppFramework\Http\DataResponse; use OCP\AppFramework\Http\FileDisplayResponse; use OCP\AppFramework\Http\JSONResponse; @@ -130,6 +131,7 @@ private function validateTheme(string $themeId): ITheme { */ #[NoAdminRequired] #[NoCSRFRequired] + #[OpenAPI(scope: OpenAPI::SCOPE_DEFAULT)] public function getBackground(): Response { $file = $this->backgroundService->getBackground(); if ($file !== null) { diff --git a/apps/theming/openapi.json b/apps/theming/openapi.json index 9057d26cb69b0..7ad7242d74469 100644 --- a/apps/theming/openapi.json +++ b/apps/theming/openapi.json @@ -20,6 +20,31 @@ } }, "schemas": { + "Background": { + "type": "object", + "required": [ + "backgroundImage", + "backgroundColor", + "primaryColor", + "version" + ], + "properties": { + "backgroundImage": { + "type": "string", + "nullable": true + }, + "backgroundColor": { + "type": "string" + }, + "primaryColor": { + "type": "string" + }, + "version": { + "type": "integer", + "format": "int64" + } + } + }, "OCSMeta": { "type": "object", "required": [ @@ -602,6 +627,18 @@ "basic_auth": [] } ], + "parameters": [ + { + "name": "OCS-APIRequest", + "in": "header", + "description": "Required to be true for the API request to pass", + "required": true, + "schema": { + "type": "boolean", + "default": true + } + } + ], "responses": { "200": { "description": "Background image returned", @@ -627,6 +664,155 @@ } } }, + "/index.php/apps/theming/background/{type}": { + "post": { + "operationId": "user_theme-set-background", + "summary": "Set the background", + "tags": [ + "user_theme" + ], + "security": [ + { + "bearer_auth": [] + }, + { + "basic_auth": [] + } + ], + "requestBody": { + "required": false, + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "value": { + "type": "string", + "default": "", + "description": "Path of the background image" + }, + "color": { + "type": "string", + "nullable": true, + "description": "Color for the background" + } + } + } + } + } + }, + "parameters": [ + { + "name": "type", + "in": "path", + "description": "Type of background", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "OCS-APIRequest", + "in": "header", + "description": "Required to be true for the API request to pass", + "required": true, + "schema": { + "type": "boolean", + "default": true + } + } + ], + "responses": { + "200": { + "description": "Background set successfully", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Background" + } + } + } + }, + "400": { + "description": "Setting background is not possible", + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "error" + ], + "properties": { + "error": { + "type": "string" + } + } + } + } + } + }, + "500": { + "description": "", + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "error" + ], + "properties": { + "error": { + "type": "string" + } + } + } + } + } + } + } + } + }, + "/index.php/apps/theming/background/custom": { + "delete": { + "operationId": "user_theme-delete-background", + "summary": "Delete the background", + "tags": [ + "user_theme" + ], + "security": [ + { + "bearer_auth": [] + }, + { + "basic_auth": [] + } + ], + "parameters": [ + { + "name": "OCS-APIRequest", + "in": "header", + "description": "Required to be true for the API request to pass", + "required": true, + "schema": { + "type": "boolean", + "default": true + } + } + ], + "responses": { + "200": { + "description": "Background deleted successfully", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Background" + } + } + } + } + } + } + }, "/ocs/v2.php/apps/theming/api/v1/theme/{themeId}/enable": { "put": { "operationId": "user_theme-enable-theme", diff --git a/core/Controller/AvatarController.php b/core/Controller/AvatarController.php index 4d5e810ddb954..f25a2d5275264 100644 --- a/core/Controller/AvatarController.php +++ b/core/Controller/AvatarController.php @@ -13,6 +13,7 @@ use OCP\AppFramework\Http\Attribute\FrontpageRoute; use OCP\AppFramework\Http\Attribute\NoAdminRequired; use OCP\AppFramework\Http\Attribute\NoCSRFRequired; +use OCP\AppFramework\Http\Attribute\OpenAPI; use OCP\AppFramework\Http\Attribute\PublicPage; use OCP\AppFramework\Http\DataDisplayResponse; use OCP\AppFramework\Http\FileDisplayResponse; @@ -66,6 +67,7 @@ public function __construct( #[NoCSRFRequired] #[PublicPage] #[FrontpageRoute(verb: 'GET', url: '/avatar/{userId}/{size}/dark')] + #[OpenAPI(scope: OpenAPI::SCOPE_DEFAULT)] public function getAvatarDark(string $userId, int $size, bool $guestFallback = false) { if ($size <= 64) { if ($size !== 64) { @@ -117,6 +119,7 @@ public function getAvatarDark(string $userId, int $size, bool $guestFallback = f #[NoCSRFRequired] #[PublicPage] #[FrontpageRoute(verb: 'GET', url: '/avatar/{userId}/{size}')] + #[OpenAPI(scope: OpenAPI::SCOPE_DEFAULT)] public function getAvatar(string $userId, int $size, bool $guestFallback = false) { if ($size <= 64) { if ($size !== 64) { diff --git a/core/Controller/CSRFTokenController.php b/core/Controller/CSRFTokenController.php index 8ea475941c8d1..4fdd669e144d9 100644 --- a/core/Controller/CSRFTokenController.php +++ b/core/Controller/CSRFTokenController.php @@ -13,6 +13,7 @@ use OCP\AppFramework\Http; use OCP\AppFramework\Http\Attribute\FrontpageRoute; use OCP\AppFramework\Http\Attribute\NoCSRFRequired; +use OCP\AppFramework\Http\Attribute\OpenAPI; use OCP\AppFramework\Http\Attribute\PublicPage; use OCP\AppFramework\Http\JSONResponse; use OCP\IRequest; @@ -37,6 +38,7 @@ public function __construct( #[PublicPage] #[NoCSRFRequired] #[FrontpageRoute(verb: 'GET', url: '/csrftoken')] + #[OpenAPI(scope: OpenAPI::SCOPE_DEFAULT)] public function index(): JSONResponse { if (!$this->request->passesStrictCookieCheck()) { return new JSONResponse([], Http::STATUS_FORBIDDEN); diff --git a/core/Controller/ClientFlowLoginV2Controller.php b/core/Controller/ClientFlowLoginV2Controller.php index b973a57924e6e..4bd2cddd12bb5 100644 --- a/core/Controller/ClientFlowLoginV2Controller.php +++ b/core/Controller/ClientFlowLoginV2Controller.php @@ -69,6 +69,7 @@ public function __construct( #[NoCSRFRequired] #[PublicPage] #[FrontpageRoute(verb: 'POST', url: '/login/v2/poll')] + #[OpenAPI(scope: OpenAPI::SCOPE_DEFAULT)] public function poll(string $token): JSONResponse { try { $creds = $this->loginFlowV2Service->poll($token); @@ -275,6 +276,7 @@ private function handleFlowDone(bool $result): StandaloneTemplateResponse { #[NoCSRFRequired] #[PublicPage] #[FrontpageRoute(verb: 'POST', url: '/login/v2')] + #[OpenAPI(scope: OpenAPI::SCOPE_DEFAULT)] public function init(): JSONResponse { // Get client user agent $userAgent = $this->request->getHeader('USER_AGENT'); diff --git a/core/Controller/GuestAvatarController.php b/core/Controller/GuestAvatarController.php index e87112726f258..7eef6828fec85 100644 --- a/core/Controller/GuestAvatarController.php +++ b/core/Controller/GuestAvatarController.php @@ -9,6 +9,7 @@ use OCP\AppFramework\Http; use OCP\AppFramework\Http\Attribute\FrontpageRoute; use OCP\AppFramework\Http\Attribute\NoCSRFRequired; +use OCP\AppFramework\Http\Attribute\OpenAPI; use OCP\AppFramework\Http\Attribute\PublicPage; use OCP\AppFramework\Http\FileDisplayResponse; use OCP\AppFramework\Http\Response; @@ -46,6 +47,7 @@ public function __construct( #[PublicPage] #[NoCSRFRequired] #[FrontpageRoute(verb: 'GET', url: '/avatar/guest/{guestName}/{size}')] + #[OpenAPI(scope: OpenAPI::SCOPE_DEFAULT)] public function getAvatar(string $guestName, int $size, ?bool $darkTheme = false) { $darkTheme = $darkTheme ?? false; @@ -97,6 +99,7 @@ public function getAvatar(string $guestName, int $size, ?bool $darkTheme = false #[PublicPage] #[NoCSRFRequired] #[FrontpageRoute(verb: 'GET', url: '/avatar/guest/{guestName}/{size}/dark')] + #[OpenAPI(scope: OpenAPI::SCOPE_DEFAULT)] public function getAvatarDark(string $guestName, int $size) { return $this->getAvatar($guestName, $size, true); } diff --git a/core/Controller/LoginController.php b/core/Controller/LoginController.php index 19d5aae9613a3..ed884460b4356 100644 --- a/core/Controller/LoginController.php +++ b/core/Controller/LoginController.php @@ -410,6 +410,7 @@ private function createLoginFailedResponse( #[UseSession] #[NoCSRFRequired] #[FrontpageRoute(verb: 'POST', url: '/login/confirm')] + #[OpenAPI(scope: OpenAPI::SCOPE_DEFAULT)] public function confirmPassword(string $password): DataResponse { $loginName = $this->userSession->getLoginName(); $loginResult = $this->userManager->checkPassword($loginName, $password); diff --git a/core/Controller/OCMController.php b/core/Controller/OCMController.php index f15a4a5677996..40d53cf7a97d2 100644 --- a/core/Controller/OCMController.php +++ b/core/Controller/OCMController.php @@ -14,6 +14,7 @@ use OCP\AppFramework\Http; use OCP\AppFramework\Http\Attribute\FrontpageRoute; use OCP\AppFramework\Http\Attribute\NoCSRFRequired; +use OCP\AppFramework\Http\Attribute\OpenAPI; use OCP\AppFramework\Http\Attribute\PublicPage; use OCP\AppFramework\Http\DataResponse; use OCP\Capabilities\ICapability; @@ -51,6 +52,7 @@ public function __construct( #[PublicPage] #[NoCSRFRequired] #[FrontpageRoute(verb: 'GET', url: '/ocm-provider/')] + #[OpenAPI(scope: OpenAPI::SCOPE_DEFAULT)] public function discovery(): DataResponse { try { $cap = Server::get( diff --git a/core/Controller/PreviewController.php b/core/Controller/PreviewController.php index 2720da671be09..9c9d49082bb60 100644 --- a/core/Controller/PreviewController.php +++ b/core/Controller/PreviewController.php @@ -13,6 +13,7 @@ use OCP\AppFramework\Http\Attribute\FrontpageRoute; use OCP\AppFramework\Http\Attribute\NoAdminRequired; use OCP\AppFramework\Http\Attribute\NoCSRFRequired; +use OCP\AppFramework\Http\Attribute\OpenAPI; use OCP\AppFramework\Http\DataResponse; use OCP\AppFramework\Http\FileDisplayResponse; use OCP\AppFramework\Http\RedirectResponse; @@ -58,6 +59,7 @@ public function __construct( #[NoAdminRequired] #[NoCSRFRequired] #[FrontpageRoute(verb: 'GET', url: '/core/preview.png')] + #[OpenAPI(scope: OpenAPI::SCOPE_DEFAULT)] public function getPreview( string $file = '', int $x = 32, @@ -101,6 +103,7 @@ public function getPreview( #[NoAdminRequired] #[NoCSRFRequired] #[FrontpageRoute(verb: 'GET', url: '/core/preview')] + #[OpenAPI(scope: OpenAPI::SCOPE_DEFAULT)] public function getPreviewByFileId( int $fileId = -1, int $x = 32, diff --git a/core/Controller/ReferenceController.php b/core/Controller/ReferenceController.php index b4c88562bc900..6ed15e2d2f1c8 100644 --- a/core/Controller/ReferenceController.php +++ b/core/Controller/ReferenceController.php @@ -12,6 +12,7 @@ use OCP\AppFramework\Http; use OCP\AppFramework\Http\Attribute\FrontpageRoute; use OCP\AppFramework\Http\Attribute\NoCSRFRequired; +use OCP\AppFramework\Http\Attribute\OpenAPI; use OCP\AppFramework\Http\Attribute\PublicPage; use OCP\AppFramework\Http\DataDownloadResponse; use OCP\AppFramework\Http\DataResponse; @@ -43,6 +44,7 @@ public function __construct( #[PublicPage] #[NoCSRFRequired] #[FrontpageRoute(verb: 'GET', url: '/core/references/preview/{referenceId}')] + #[OpenAPI(scope: OpenAPI::SCOPE_DEFAULT)] public function preview(string $referenceId): DataDownloadResponse|DataResponse { $reference = $this->referenceManager->getReferenceByCacheKey($referenceId); diff --git a/core/Controller/WipeController.php b/core/Controller/WipeController.php index d364e6399d948..1b57be71aa09a 100644 --- a/core/Controller/WipeController.php +++ b/core/Controller/WipeController.php @@ -14,11 +14,13 @@ use OCP\AppFramework\Http\Attribute\AnonRateLimit; use OCP\AppFramework\Http\Attribute\FrontpageRoute; use OCP\AppFramework\Http\Attribute\NoCSRFRequired; +use OCP\AppFramework\Http\Attribute\OpenAPI; use OCP\AppFramework\Http\Attribute\PublicPage; use OCP\AppFramework\Http\JSONResponse; use OCP\Authentication\Exceptions\InvalidTokenException; use OCP\IRequest; +#[OpenAPI(scope: OpenAPI::SCOPE_DEFAULT)] class WipeController extends Controller { public function __construct( string $appName, diff --git a/lib/private/Template/JSConfigHelper.php b/lib/private/Template/JSConfigHelper.php index e6d3c6af87ee7..ae887db09d5fe 100644 --- a/lib/private/Template/JSConfigHelper.php +++ b/lib/private/Template/JSConfigHelper.php @@ -12,7 +12,7 @@ use OC\CapabilitiesManager; use OC\Files\FilenameValidator; use OC\Share\Share; -use OCA\Provisioning_API\Controller\AUserData; +use OCA\Provisioning_API\Controller\AUserDataOCSController; use OCP\App\AppPathNotFoundException; use OCP\App\IAppManager; use OCP\Authentication\Exceptions\ExpiredTokenException; @@ -136,7 +136,7 @@ public function getConfig(): string { $capabilities = $this->capabilitiesManager->getCapabilities(false, true); - $userFirstDay = $this->config->getUserValue($uid, 'core', AUserData::USER_FIELD_FIRST_DAY_OF_WEEK, null); + $userFirstDay = $this->config->getUserValue($uid, 'core', AUserDataOCSController::USER_FIELD_FIRST_DAY_OF_WEEK, null); $firstDay = (int)($userFirstDay ?? $this->l->l('firstday', null)); $config = [ diff --git a/vendor-bin/openapi-extractor/composer.lock b/vendor-bin/openapi-extractor/composer.lock index ef98fd063247f..128450e8405fd 100644 --- a/vendor-bin/openapi-extractor/composer.lock +++ b/vendor-bin/openapi-extractor/composer.lock @@ -8,16 +8,16 @@ "packages": [ { "name": "adhocore/cli", - "version": "v1.7.2", + "version": "v1.9.3", "source": { "type": "git", "url": "https://github.com/adhocore/php-cli.git", - "reference": "57834cbaa4fb68cda849417ab86577fba2b15298" + "reference": "86be16e3c3b42d76fcdb32529bcded0fedb925d3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/adhocore/php-cli/zipball/57834cbaa4fb68cda849417ab86577fba2b15298", - "reference": "57834cbaa4fb68cda849417ab86577fba2b15298", + "url": "https://api.github.com/repos/adhocore/php-cli/zipball/86be16e3c3b42d76fcdb32529bcded0fedb925d3", + "reference": "86be16e3c3b42d76fcdb32529bcded0fedb925d3", "shasum": "" }, "require": { @@ -28,6 +28,9 @@ }, "type": "library", "autoload": { + "files": [ + "src/functions.php" + ], "psr-4": { "Ahc\\Cli\\": "src/" } @@ -62,7 +65,7 @@ ], "support": { "issues": "https://github.com/adhocore/php-cli/issues", - "source": "https://github.com/adhocore/php-cli/tree/v1.7.2" + "source": "https://github.com/adhocore/php-cli/tree/v1.9.3" }, "funding": [ { @@ -74,20 +77,20 @@ "type": "github" } ], - "time": "2024-09-05T00:08:47+00:00" + "time": "2024-12-04T03:40:29+00:00" }, { "name": "nextcloud/openapi-extractor", - "version": "v1.1.0", + "version": "v1.3.0", "source": { "type": "git", "url": "https://github.com/nextcloud-releases/openapi-extractor.git", - "reference": "d7c135e819d2297e7e9414a3f80464d68f164c94" + "reference": "c0761cb7a3a0cd29c85ede9f27883d7f9f477bd0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nextcloud-releases/openapi-extractor/zipball/d7c135e819d2297e7e9414a3f80464d68f164c94", - "reference": "d7c135e819d2297e7e9414a3f80464d68f164c94", + "url": "https://api.github.com/repos/nextcloud-releases/openapi-extractor/zipball/c0761cb7a3a0cd29c85ede9f27883d7f9f477bd0", + "reference": "c0761cb7a3a0cd29c85ede9f27883d7f9f477bd0", "shasum": "" }, "require": { @@ -99,11 +102,12 @@ }, "require-dev": { "nextcloud/coding-standard": "^1.2", - "nextcloud/ocp": "dev-master" + "nextcloud/ocp": "dev-master", + "rector/rector": "^2.0" }, "bin": [ - "generate-spec", - "merge-specs" + "bin/generate-spec", + "bin/merge-specs" ], "type": "library", "autoload": { @@ -118,9 +122,9 @@ "description": "A tool for extracting OpenAPI specifications from Nextcloud source code", "support": { "issues": "https://github.com/nextcloud-releases/openapi-extractor/issues", - "source": "https://github.com/nextcloud-releases/openapi-extractor/tree/v1.1.0" + "source": "https://github.com/nextcloud-releases/openapi-extractor/tree/v1.3.0" }, - "time": "2024-11-06T11:50:20+00:00" + "time": "2024-12-17T16:34:26+00:00" }, { "name": "nikic/php-parser", @@ -231,11 +235,11 @@ "packages-dev": [], "aliases": [], "minimum-stability": "stable", - "stability-flags": [], + "stability-flags": {}, "prefer-stable": false, "prefer-lowest": false, - "platform": [], - "platform-dev": [], + "platform": {}, + "platform-dev": {}, "platform-overrides": { "php": "8.1" },