diff options
Diffstat (limited to 'lib/public')
-rw-r--r-- | lib/public/Accounts/IAccountManager.php | 2 | ||||
-rw-r--r-- | lib/public/App/IAppManager.php | 44 | ||||
-rw-r--r-- | lib/public/AppFramework/Http/Attribute/BruteForceProtection.php | 52 | ||||
-rw-r--r-- | lib/public/AppFramework/Http/Attribute/UseSession.php | 2 | ||||
-rw-r--r-- | lib/public/Encryption/IEncryptionModule.php | 2 | ||||
-rw-r--r-- | lib/public/Federation/Exceptions/BadRequestException.php | 7 | ||||
-rw-r--r-- | lib/public/Files/Storage.php | 4 | ||||
-rw-r--r-- | lib/public/Files/Storage/IStorage.php | 4 |
8 files changed, 109 insertions, 8 deletions
diff --git a/lib/public/Accounts/IAccountManager.php b/lib/public/Accounts/IAccountManager.php index 7c977b575ae..68eca469ad9 100644 --- a/lib/public/Accounts/IAccountManager.php +++ b/lib/public/Accounts/IAccountManager.php @@ -10,6 +10,7 @@ declare(strict_types=1); * @author Julius Härtl <jus@bitgrid.net> * @author Thomas Citharel <nextcloud@tcit.fr> * @author Vincent Petry <vincent@nextcloud.com> + * @author Kate Döen <kate.doeen@nextcloud.com> * * @license GNU AGPL version 3 or any later version * @@ -106,6 +107,7 @@ interface IAccountManager { public const PROPERTY_AVATAR = 'avatar'; public const PROPERTY_DISPLAYNAME = 'displayname'; + public const PROPERTY_DISPLAYNAME_LEGACY = 'display-name'; public const PROPERTY_PHONE = 'phone'; public const PROPERTY_EMAIL = 'email'; public const PROPERTY_WEBSITE = 'website'; diff --git a/lib/public/App/IAppManager.php b/lib/public/App/IAppManager.php index de36fafcdfe..2497544dcbe 100644 --- a/lib/public/App/IAppManager.php +++ b/lib/public/App/IAppManager.php @@ -94,6 +94,20 @@ interface IAppManager { public function isDefaultEnabled(string $appId):bool; /** + * Load an app, if not already loaded + * @param string $app app id + * @since 27.0.0 + */ + public function loadApp(string $app): void; + + /** + * Check if an app is loaded + * @param string $app app id + * @since 27.0.0 + */ + public function isAppLoaded(string $app): bool; + + /** * Enable an app for every user * * @param string $appId @@ -183,6 +197,27 @@ interface IAppManager { public function isShipped($appId); /** + * Loads all apps + * + * @param string[] $types + * @return bool + * + * This function walks through the Nextcloud directory and loads all apps + * it can find. A directory contains an app if the file /appinfo/info.xml + * exists. + * + * if $types is set to non-empty array, only apps of those types will be loaded + * @since 27.0.0 + */ + public function loadApps(array $types = []): bool; + + /** + * Check if an app is of a specific type + * @since 27.0.0 + */ + public function isType(string $app, array $types): bool; + + /** * @return string[] * @since 9.0.0 */ @@ -207,4 +242,13 @@ interface IAppManager { * @since 17.0.0 */ public function getAppRestriction(string $appId): array; + + /** + * Returns the id of the user's default app + * + * If `user` is not passed, the currently logged in user will be used + * + * @since 25.0.6 + */ + public function getDefaultAppForUser(?IUser $user = null): string; } diff --git a/lib/public/AppFramework/Http/Attribute/BruteForceProtection.php b/lib/public/AppFramework/Http/Attribute/BruteForceProtection.php new file mode 100644 index 00000000000..386889769cb --- /dev/null +++ b/lib/public/AppFramework/Http/Attribute/BruteForceProtection.php @@ -0,0 +1,52 @@ +<?php + +declare(strict_types=1); + +/** + * @copyright Copyright (c) 2023 Joas Schilling <coding@schilljs.com> + * + * @author Joas Schilling <coding@schilljs.com> + * + * @license GNU AGPL version 3 or any later version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +namespace OCP\AppFramework\Http\Attribute; + +use Attribute; + +/** + * Attribute for controller methods that want to protect passwords, keys, tokens + * or other data against brute force + * + * @since 27.0.0 + */ +#[Attribute(Attribute::TARGET_METHOD | Attribute::IS_REPEATABLE)] +class BruteForceProtection { + /** + * @since 27.0.0 + */ + public function __construct( + protected string $action + ) { + } + + /** + * @since 27.0.0 + */ + public function getAction(): string { + return $this->action; + } +} diff --git a/lib/public/AppFramework/Http/Attribute/UseSession.php b/lib/public/AppFramework/Http/Attribute/UseSession.php index 79185919def..a6bac011d59 100644 --- a/lib/public/AppFramework/Http/Attribute/UseSession.php +++ b/lib/public/AppFramework/Http/Attribute/UseSession.php @@ -2,7 +2,7 @@ declare(strict_types=1); -/* +/** * @copyright 2023 Christoph Wurst <christoph@winzerhof-wurst.at> * * @author 2023 Christoph Wurst <christoph@winzerhof-wurst.at> diff --git a/lib/public/Encryption/IEncryptionModule.php b/lib/public/Encryption/IEncryptionModule.php index d0ae430a81a..37db2729335 100644 --- a/lib/public/Encryption/IEncryptionModule.php +++ b/lib/public/Encryption/IEncryptionModule.php @@ -60,7 +60,7 @@ interface IEncryptionModule { * @param array $header contains the header data read from the file * @param array $accessList who has access to the file contains the key 'users' and 'public' * - * $return array $header contain data as key-value pairs which should be + * @return array $header contain data as key-value pairs which should be * written to the header, in case of a write operation * or if no additional data is needed return a empty array * @since 8.1.0 diff --git a/lib/public/Federation/Exceptions/BadRequestException.php b/lib/public/Federation/Exceptions/BadRequestException.php index 8054c0e89f0..bc8b5c7b724 100644 --- a/lib/public/Federation/Exceptions/BadRequestException.php +++ b/lib/public/Federation/Exceptions/BadRequestException.php @@ -32,6 +32,9 @@ use OCP\HintException; * @since 14.0.0 */ class BadRequestException extends HintException { + /** + * @var string[] $parameterList + */ private $parameterList; /** @@ -55,7 +58,7 @@ class BadRequestException extends HintException { * * @since 14.0.0 * - * @return array + * @return array{message: string, validationErrors: array{message: string, name: string}[]} */ public function getReturnMessage() { $result = [ @@ -65,7 +68,7 @@ class BadRequestException extends HintException { ]; foreach ($this->parameterList as $missingParameter) { - $result['validationErrors'] = [ + $result['validationErrors'][] = [ 'name' => $missingParameter, 'message' => 'NOT_FOUND' ]; diff --git a/lib/public/Files/Storage.php b/lib/public/Files/Storage.php index ca5276af1e8..c91d47bdcdf 100644 --- a/lib/public/Files/Storage.php +++ b/lib/public/Files/Storage.php @@ -227,7 +227,7 @@ interface Storage extends IStorage { * * @param string $path * @param mixed $data - * @return int|false + * @return int|float|false * @since 6.0.0 */ public function file_put_contents($path, $data); @@ -296,7 +296,7 @@ interface Storage extends IStorage { * see https://www.php.net/manual/en/function.disk-free-space.php * * @param string $path - * @return int|bool + * @return int|float|bool * @since 6.0.0 */ public function free_space($path); diff --git a/lib/public/Files/Storage/IStorage.php b/lib/public/Files/Storage/IStorage.php index 1084eb7c941..7b3b9eb484e 100644 --- a/lib/public/Files/Storage/IStorage.php +++ b/lib/public/Files/Storage/IStorage.php @@ -224,7 +224,7 @@ interface IStorage { * * @param string $path * @param mixed $data - * @return int|false + * @return int|float|false * @since 9.0.0 */ public function file_put_contents($path, $data); @@ -293,7 +293,7 @@ interface IStorage { * see https://www.php.net/manual/en/function.free_space.php * * @param string $path - * @return int|bool + * @return int|float|bool * @since 9.0.0 */ public function free_space($path); |