Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add OCP API to register account warnings providers
Signed-off-by: Côme Chilliet <[email protected]>
  • Loading branch information
come-nc committed Oct 3, 2023
commit e67969eaa5c473a4b5a264246b709adf58eb6981
2 changes: 2 additions & 0 deletions lib/composer/composer/autoload_classmap.php
Original file line number Diff line number Diff line change
Expand Up @@ -595,6 +595,8 @@
'OCP\\Security\\VerificationToken\\InvalidTokenException' => $baseDir . '/lib/public/Security/VerificationToken/InvalidTokenException.php',
'OCP\\Server' => $baseDir . '/lib/public/Server.php',
'OCP\\Session\\Exceptions\\SessionNotAvailableException' => $baseDir . '/lib/public/Session/Exceptions/SessionNotAvailableException.php',
'OCP\\Settings\\IAccountWarning' => $baseDir . '/lib/public/Settings/IAccountWarning.php',
'OCP\\Settings\\IAccountWarningsProvider' => $baseDir . '/lib/public/Settings/IAccountWarningsProvider.php',
'OCP\\Settings\\IDelegatedSettings' => $baseDir . '/lib/public/Settings/IDelegatedSettings.php',
'OCP\\Settings\\IIconSection' => $baseDir . '/lib/public/Settings/IIconSection.php',
'OCP\\Settings\\IManager' => $baseDir . '/lib/public/Settings/IManager.php',
Expand Down
2 changes: 2 additions & 0 deletions lib/composer/composer/autoload_static.php
Original file line number Diff line number Diff line change
Expand Up @@ -628,6 +628,8 @@ class ComposerStaticInit749170dad3f5e7f9ca158f5a9f04f6a2
'OCP\\Security\\VerificationToken\\InvalidTokenException' => __DIR__ . '/../../..' . '/lib/public/Security/VerificationToken/InvalidTokenException.php',
'OCP\\Server' => __DIR__ . '/../../..' . '/lib/public/Server.php',
'OCP\\Session\\Exceptions\\SessionNotAvailableException' => __DIR__ . '/../../..' . '/lib/public/Session/Exceptions/SessionNotAvailableException.php',
'OCP\\Settings\\IAccountWarning' => __DIR__ . '/../../..' . '/lib/public/Settings/IAccountWarning.php',
'OCP\\Settings\\IAccountWarningsProvider' => __DIR__ . '/../../..' . '/lib/public/Settings/IAccountWarningsProvider.php',
'OCP\\Settings\\IDelegatedSettings' => __DIR__ . '/../../..' . '/lib/public/Settings/IDelegatedSettings.php',
'OCP\\Settings\\IIconSection' => __DIR__ . '/../../..' . '/lib/public/Settings/IIconSection.php',
'OCP\\Settings\\IManager' => __DIR__ . '/../../..' . '/lib/public/Settings/IManager.php',
Expand Down
10 changes: 10 additions & 0 deletions lib/public/AppFramework/Bootstrap/IRegistrationContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -371,4 +371,14 @@ public function registerSensitiveMethods(string $class, array $methods): void;
* @since 26.0.0
*/
public function registerPublicShareTemplateProvider(string $class): void;

/**
* Register an implementation of IAccountWarningsProvider.
*
* @param string $class
* @psalm-param class-string<\OCP\Settings\IAccountWarningsProvider> $class
* @return void
* @since 28.0.0
*/
public function registerAccountWarningsProvider(string $class): void;
}
49 changes: 49 additions & 0 deletions lib/public/Settings/IAccountWarning.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<?php

declare(strict_types=1);

/**
* @copyright Copyright (c) 2023 Côme Chilliet <[email protected]>
*
* @author Côme Chilliet <[email protected]>
*
* @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\Settings;

/**
* @since 28.0.0
*/
interface IAccountWarning {
public const SEVERITY_INFO = 'info';
public const SEVERITY_WARNING = 'warning';
public const SEVERITY_ERROR = 'error';

/**
* Text to show to the admin
* @since 28.0.0
*/
public function getText(): string;

/**
* Severity, one the SEVERITY_* constants
* @return self::SEVERITY_INFO|self::SEVERITY_WARNING|self::SEVERITY_ERROR
* @since 28.0.0
*/
public function getSeverity(): string;
}
44 changes: 44 additions & 0 deletions lib/public/Settings/IAccountWarningsProvider.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<?php

declare(strict_types=1);

/**
* @copyright Copyright (c) 2023 Côme Chilliet <[email protected]>
*
* @author Côme Chilliet <[email protected]>
*
* @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\Settings;

/**
* @since 28.0.0
*/
interface IAccountWarningsProvider {
/**
* @return IAccountWarning[] Warnings detected by this provider
* @since 28.0.0
*/
public function getAccountWarnings(): array;

/**
* Name to show as tab name in the UI
* @since 28.0.0
*/
public function getName(): string;
}