aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--apps/settings/lib/AppInfo/Application.php2
-rw-r--r--apps/settings/lib/Controller/CheckSetupController.php7
-rw-r--r--apps/settings/lib/SetupChecks/LegacySSEKeyFormat.php32
-rw-r--r--apps/settings/src/components/SetupCheck.vue78
-rw-r--r--apps/user_ldap/composer/composer/autoload_classmap.php1
-rw-r--r--apps/user_ldap/composer/composer/autoload_static.php1
-rw-r--r--apps/user_ldap/lib/AppInfo/Application.php2
-rw-r--r--apps/user_ldap/lib/SetupChecks/LdapInvalidUuids.php (renamed from apps/settings/lib/SetupChecks/LdapInvalidUuids.php)37
-rw-r--r--lib/composer/composer/autoload_classmap.php1
-rw-r--r--lib/composer/composer/autoload_static.php1
-rw-r--r--lib/public/SetupCheck/ISetupCheck.php5
11 files changed, 111 insertions, 56 deletions
diff --git a/apps/settings/lib/AppInfo/Application.php b/apps/settings/lib/AppInfo/Application.php
index 22993a79485..c3ed7b31e79 100644
--- a/apps/settings/lib/AppInfo/Application.php
+++ b/apps/settings/lib/AppInfo/Application.php
@@ -49,6 +49,7 @@ use OCA\Settings\Search\AppSearch;
use OCA\Settings\Search\SectionSearch;
use OCA\Settings\Search\UserSearch;
use OCA\Settings\SetupChecks\CheckUserCertificates;
+use OCA\Settings\SetupChecks\LegacySSEKeyFormat;
use OCA\Settings\UserMigration\AccountMigrator;
use OCA\Settings\WellKnown\ChangePasswordHandler;
use OCA\Settings\WellKnown\SecurityTxtHandler;
@@ -139,6 +140,7 @@ class Application extends App implements IBootstrap {
);
});
$context->registerSetupCheck(CheckUserCertificates::class);
+ $context->registerSetupCheck(LegacySSEKeyFormat::class);
$context->registerUserMigrator(AccountMigrator::class);
}
diff --git a/apps/settings/lib/Controller/CheckSetupController.php b/apps/settings/lib/Controller/CheckSetupController.php
index bcfd2360300..829873f0069 100644
--- a/apps/settings/lib/Controller/CheckSetupController.php
+++ b/apps/settings/lib/Controller/CheckSetupController.php
@@ -64,7 +64,6 @@ use OC\Lock\DBLockingProvider;
use OC\MemoryInfo;
use OCA\Settings\SetupChecks\CheckUserCertificates;
use OCA\Settings\SetupChecks\NeedsSystemAddressBookSync;
-use OCA\Settings\SetupChecks\LdapInvalidUuids;
use OCA\Settings\SetupChecks\LegacySSEKeyFormat;
use OCA\Settings\SetupChecks\PhpDefaultCharset;
use OCA\Settings\SetupChecks\PhpOutputBuffering;
@@ -920,10 +919,7 @@ Raw output
public function check() {
$phpDefaultCharset = new PhpDefaultCharset();
$phpOutputBuffering = new PhpOutputBuffering();
- $legacySSEKeyFormat = new LegacySSEKeyFormat($this->l10n, $this->config, $this->urlGenerator);
- //$checkUserCertificates = new CheckUserCertificates($this->l10n, $this->config, $this->urlGenerator);
$supportedDatabases = new SupportedDatabase($this->l10n, $this->connection);
- $ldapInvalidUuids = new LdapInvalidUuids($this->appManager, $this->l10n, $this->serverContainer);
$needsSystemAddressBookSync = new NeedsSystemAddressBookSync($this->config, $this->l10n);
return new DataResponse(
@@ -974,12 +970,9 @@ Raw output
'imageMagickLacksSVGSupport' => $this->imageMagickLacksSVGSupport(),
PhpDefaultCharset::class => ['pass' => $phpDefaultCharset->run(), 'description' => $phpDefaultCharset->description(), 'severity' => $phpDefaultCharset->severity()],
PhpOutputBuffering::class => ['pass' => $phpOutputBuffering->run(), 'description' => $phpOutputBuffering->description(), 'severity' => $phpOutputBuffering->severity()],
- LegacySSEKeyFormat::class => ['pass' => $legacySSEKeyFormat->run(), 'description' => $legacySSEKeyFormat->description(), 'severity' => $legacySSEKeyFormat->severity(), 'linkToDocumentation' => $legacySSEKeyFormat->linkToDocumentation()],
- //CheckUserCertificates::class => ['pass' => $checkUserCertificates->run(), 'description' => $checkUserCertificates->description(), 'severity' => $checkUserCertificates->severity(), 'elements' => $checkUserCertificates->elements()],
'isDefaultPhoneRegionSet' => $this->config->getSystemValueString('default_phone_region', '') !== '',
SupportedDatabase::class => ['pass' => $supportedDatabases->run(), 'description' => $supportedDatabases->description(), 'severity' => $supportedDatabases->severity()],
'temporaryDirectoryWritable' => $this->isTemporaryDirectoryWritable(),
- LdapInvalidUuids::class => ['pass' => $ldapInvalidUuids->run(), 'description' => $ldapInvalidUuids->description(), 'severity' => $ldapInvalidUuids->severity()],
NeedsSystemAddressBookSync::class => ['pass' => $needsSystemAddressBookSync->run(), 'description' => $needsSystemAddressBookSync->description(), 'severity' => $needsSystemAddressBookSync->severity()],
]
);
diff --git a/apps/settings/lib/SetupChecks/LegacySSEKeyFormat.php b/apps/settings/lib/SetupChecks/LegacySSEKeyFormat.php
index 4814d3fba7c..44560590f74 100644
--- a/apps/settings/lib/SetupChecks/LegacySSEKeyFormat.php
+++ b/apps/settings/lib/SetupChecks/LegacySSEKeyFormat.php
@@ -28,14 +28,13 @@ namespace OCA\Settings\SetupChecks;
use OCP\IConfig;
use OCP\IL10N;
use OCP\IURLGenerator;
+use OCP\SetupCheck\ISetupCheck;
+use OCP\SetupCheck\SetupResult;
-class LegacySSEKeyFormat {
- /** @var IL10N */
- private $l10n;
- /** @var IConfig */
- private $config;
- /** @var IURLGenerator */
- private $urlGenerator;
+class LegacySSEKeyFormat implements ISetupCheck {
+ private IL10N $l10n;
+ private IConfig $config;
+ private IURLGenerator $urlGenerator;
public function __construct(IL10N $l10n, IConfig $config, IURLGenerator $urlGenerator) {
$this->l10n = $l10n;
@@ -43,19 +42,18 @@ class LegacySSEKeyFormat {
$this->urlGenerator = $urlGenerator;
}
- public function description(): string {
- return $this->l10n->t('The old server-side-encryption format is enabled. We recommend disabling this.');
+ public function getCategory(): string {
+ return 'security';
}
- public function severity(): string {
- return 'warning';
+ public function getName(): string {
+ return $this->l10n->t('Checking for old server-side-encryption being disabled');
}
- public function run(): bool {
- return $this->config->getSystemValueBool('encryption.legacy_format_support', false) === false;
- }
-
- public function linkToDocumentation(): string {
- return $this->urlGenerator->linkToDocs('admin-sse-legacy-format');
+ public function run(): SetupResult {
+ if ($this->config->getSystemValueBool('encryption.legacy_format_support', false) === false) {
+ return new SetupResult(SetupResult::SUCCESS);
+ }
+ return new SetupResult(SetupResult::WARNING, $this->l10n->t('The old server-side-encryption format is enabled. We recommend disabling this.'), $this->urlGenerator->linkToDocs('admin-sse-legacy-format'));
}
}
diff --git a/apps/settings/src/components/SetupCheck.vue b/apps/settings/src/components/SetupCheck.vue
index f5317386a06..40d7ac429af 100644
--- a/apps/settings/src/components/SetupCheck.vue
+++ b/apps/settings/src/components/SetupCheck.vue
@@ -3,12 +3,24 @@
:description="t('settings', `It's important for the security and performance of your instance that everything is configured correctly. To help you with that we are doing some automatic checks. Please see the linked documentation for more information.`)">
<div v-for="(checks, category) in results"
:key="category"
- class="card">
- <div class="card__header">
+ class="check-card">
+ <div class="check-card__header" @click="toggleCollapse(category)">
<h3>{{ category }}</h3>
+ <Check v-if="stats[category].successes === stats[category].total"
+ :size="20"
+ :fill-color="'var(--color-success)'" />
+ <Check v-else-if="stats[category].errors > 0"
+ :size="20"
+ :fill-color="'var(--color-error)'" />
+ <Check v-else-if="stats[category].warnings > 0"
+ :size="20"
+ :fill-color="'var(--color-warning)'" />
+ <span>
+ {{ stats[category].successes }} / {{ stats[category].total }}
+ </span>
</div>
- <div class="card__body">
- <div v-for="(check, name) in checks" :key="name" class="check">
+ <div class="card__body" v-if="!collapsed[category]">
+ <div v-for="(check, name) in checks" :key="name" class="row-check" :class="['row-check__' + check.severity]">
<template v-if="check.severity === 'success'">
<Check :size="20" :fill-color="'var(--color-success)'" />
</template>
@@ -34,15 +46,33 @@ export default {
data() {
return {
results: [],
+ collapsed: {},
+ stats: {},
}
},
mounted() {
this.loadSetupChecks()
},
methods: {
+ toggleCollapse(category) {
+ this.collapsed[category] = !this.collapsed[category]
+ },
async loadSetupChecks() {
const { data } = await axios.get(generateUrl('/settings/setupcheck'))
- console.debug(data)
+ const collapsed = {}
+ const stats = {}
+ for (const [category, checks] of Object.entries(data)) {
+ const values = Object.values(checks)
+ stats[category] = {
+ total: values.length,
+ successes: values.filter((check) => check.severity === 'success').length,
+ warnings: values.filter((check) => check.severity === 'warning').length,
+ errors: values.filter((check) => check.severity === 'errors').length,
+ }
+ collapsed[category] = stats[category].errors > 0
+ }
+ this.collapsed = collapsed
+ this.stats = stats
this.results = data
},
},
@@ -50,15 +80,41 @@ export default {
</script>
<style lang="scss" scoped>
-.card {
- box-shadow: 0 4px 8px 0 rgba(var(--color-box-shadow-rgb), 0.4);
+.check-card {
+ border: 1px solid var(--color-border);
border-radius: var(--border-radius);
- &__body, &__header {
- padding: 4px 8px;
- }
- .check {
+ &__header {
+ padding: 0.5rem 1rem;
display: flex;
align-items: center;
+ h3 {
+ margin: 0;
+ }
+ .material-design-icon {
+ margin-left: auto;
+ margin-right: 0.5rem;
+ }
+ }
+}
+.row-check {
+ color: var(--color-text-light);
+ background-color: var(--note-background);
+ box-shadow: rgba(43, 42, 51, 0.05) 0 1px 2px 0;
+ margin: 0;
+ padding: 0.5rem 1rem;
+ display: flex;
+ align-items: center;
+ &__success {
+ --note-background: rgba(var(--color-success-rgb), 0.2);
+ --note-theme: var(--color-success);
+ }
+ &__error {
+ --note-background: rgba(var(--color-error-rgb), 0.2);
+ --note-theme: var(--color-error);
+ }
+ &__warning {
+ --note-background: rgba(var(--color-warning-rgb), 0.2);
+ --note-theme: var(--color-warning);
}
}
</style>
diff --git a/apps/user_ldap/composer/composer/autoload_classmap.php b/apps/user_ldap/composer/composer/autoload_classmap.php
index 6f7e5a8c1da..bdca3c1c295 100644
--- a/apps/user_ldap/composer/composer/autoload_classmap.php
+++ b/apps/user_ldap/composer/composer/autoload_classmap.php
@@ -82,6 +82,7 @@ return array(
'OCA\\User_LDAP\\Service\\UpdateGroupsService' => $baseDir . '/../lib/Service/UpdateGroupsService.php',
'OCA\\User_LDAP\\Settings\\Admin' => $baseDir . '/../lib/Settings/Admin.php',
'OCA\\User_LDAP\\Settings\\Section' => $baseDir . '/../lib/Settings/Section.php',
+ 'OCA\\User_LDAP\\SetupChecks\\LdapInvalidUuids' => $baseDir . '/../lib/SetupChecks/LdapInvalidUuids.php',
'OCA\\User_LDAP\\UserPluginManager' => $baseDir . '/../lib/UserPluginManager.php',
'OCA\\User_LDAP\\User\\DeletedUsersIndex' => $baseDir . '/../lib/User/DeletedUsersIndex.php',
'OCA\\User_LDAP\\User\\Manager' => $baseDir . '/../lib/User/Manager.php',
diff --git a/apps/user_ldap/composer/composer/autoload_static.php b/apps/user_ldap/composer/composer/autoload_static.php
index 9932166b960..1b4d3984890 100644
--- a/apps/user_ldap/composer/composer/autoload_static.php
+++ b/apps/user_ldap/composer/composer/autoload_static.php
@@ -97,6 +97,7 @@ class ComposerStaticInitUser_LDAP
'OCA\\User_LDAP\\Service\\UpdateGroupsService' => __DIR__ . '/..' . '/../lib/Service/UpdateGroupsService.php',
'OCA\\User_LDAP\\Settings\\Admin' => __DIR__ . '/..' . '/../lib/Settings/Admin.php',
'OCA\\User_LDAP\\Settings\\Section' => __DIR__ . '/..' . '/../lib/Settings/Section.php',
+ 'OCA\\User_LDAP\\SetupChecks\\LdapInvalidUuids' => __DIR__ . '/..' . '/../lib/SetupChecks/LdapInvalidUuids.php',
'OCA\\User_LDAP\\UserPluginManager' => __DIR__ . '/..' . '/../lib/UserPluginManager.php',
'OCA\\User_LDAP\\User\\DeletedUsersIndex' => __DIR__ . '/..' . '/../lib/User/DeletedUsersIndex.php',
'OCA\\User_LDAP\\User\\Manager' => __DIR__ . '/..' . '/../lib/User/Manager.php',
diff --git a/apps/user_ldap/lib/AppInfo/Application.php b/apps/user_ldap/lib/AppInfo/Application.php
index 1b6c8cab0fd..459de751812 100644
--- a/apps/user_ldap/lib/AppInfo/Application.php
+++ b/apps/user_ldap/lib/AppInfo/Application.php
@@ -43,6 +43,7 @@ use OCA\User_LDAP\Notification\Notifier;
use OCA\User_LDAP\User\Manager;
use OCA\User_LDAP\User_Proxy;
use OCA\User_LDAP\UserPluginManager;
+use OCA\User_LDAP\SetupChecks\LdapInvalidUuids;
use OCP\AppFramework\App;
use OCP\AppFramework\Bootstrap\IBootContext;
use OCP\AppFramework\Bootstrap\IBootstrap;
@@ -116,6 +117,7 @@ class Application extends App implements IBootstrap {
false
);
$context->registerEventListener(PostLoginEvent::class, LoginListener::class);
+ $context->registerSetupCheck(LdapInvalidUuids::class);
}
public function boot(IBootContext $context): void {
diff --git a/apps/settings/lib/SetupChecks/LdapInvalidUuids.php b/apps/user_ldap/lib/SetupChecks/LdapInvalidUuids.php
index 11b0105cada..f8c8a5f1fc5 100644
--- a/apps/settings/lib/SetupChecks/LdapInvalidUuids.php
+++ b/apps/user_ldap/lib/SetupChecks/LdapInvalidUuids.php
@@ -24,27 +24,29 @@ declare(strict_types=1);
*
*/
-namespace OCA\Settings\SetupChecks;
+namespace OCA\User_LDAP\SetupChecks;
use OCA\User_LDAP\Mapping\GroupMapping;
use OCA\User_LDAP\Mapping\UserMapping;
use OCP\App\IAppManager;
use OCP\IL10N;
use OCP\IServerContainer;
+use OCP\SetupCheck\ISetupCheck;
-class LdapInvalidUuids {
+class LdapInvalidUuids implements ISetupCheck {
+ private IL10N $l10n;
+ private IServerContainer $server;
+ private UserMapping $userMapping;
+ private GroupMapping $groupMapping;
- /** @var IAppManager */
- private $appManager;
- /** @var IL10N */
- private $l10n;
- /** @var IServerContainer */
- private $server;
-
- public function __construct(IAppManager $appManager, IL10N $l10n, IServerContainer $server) {
- $this->appManager = $appManager;
+ public function __construct(IL10N $l10n, UserMapping $userMapping, GroupMapping $groupMapping) {
$this->l10n = $l10n;
- $this->server = $server;
+ $this->userMapping = $userMapping;
+ $this->groupMapping = $groupMapping;
+ }
+
+ public function getCategory(): string {
+ return 'ldap';
}
public function description(): string {
@@ -56,14 +58,7 @@ class LdapInvalidUuids {
}
public function run(): bool {
- if (!$this->appManager->isEnabledForUser('user_ldap')) {
- return true;
- }
- /** @var UserMapping $userMapping */
- $userMapping = $this->server->get(UserMapping::class);
- /** @var GroupMapping $groupMapping */
- $groupMapping = $this->server->get(GroupMapping::class);
- return count($userMapping->getList(0, 1, true)) === 0
- && count($groupMapping->getList(0, 1, true)) === 0;
+ return count($this->userMapping->getList(0, 1, true)) === 0
+ && count($this->groupMapping->getList(0, 1, true)) === 0;
}
}
diff --git a/lib/composer/composer/autoload_classmap.php b/lib/composer/composer/autoload_classmap.php
index 204b749befc..b656f83e747 100644
--- a/lib/composer/composer/autoload_classmap.php
+++ b/lib/composer/composer/autoload_classmap.php
@@ -1655,6 +1655,7 @@ return array(
'OC\\Settings\\Manager' => $baseDir . '/lib/private/Settings/Manager.php',
'OC\\Settings\\Section' => $baseDir . '/lib/private/Settings/Section.php',
'OC\\Setup' => $baseDir . '/lib/private/Setup.php',
+ 'OC\\SetupCheck\\SetupCheckManager' => $baseDir . '/lib/private/SetupCheck/SetupCheckManager.php',
'OC\\Setup\\AbstractDatabase' => $baseDir . '/lib/private/Setup/AbstractDatabase.php',
'OC\\Setup\\MySQL' => $baseDir . '/lib/private/Setup/MySQL.php',
'OC\\Setup\\OCI' => $baseDir . '/lib/private/Setup/OCI.php',
diff --git a/lib/composer/composer/autoload_static.php b/lib/composer/composer/autoload_static.php
index 9ad208fc854..70f47a58976 100644
--- a/lib/composer/composer/autoload_static.php
+++ b/lib/composer/composer/autoload_static.php
@@ -1688,6 +1688,7 @@ class ComposerStaticInit749170dad3f5e7f9ca158f5a9f04f6a2
'OC\\Settings\\Manager' => __DIR__ . '/../../..' . '/lib/private/Settings/Manager.php',
'OC\\Settings\\Section' => __DIR__ . '/../../..' . '/lib/private/Settings/Section.php',
'OC\\Setup' => __DIR__ . '/../../..' . '/lib/private/Setup.php',
+ 'OC\\SetupCheck\\SetupCheckManager' => __DIR__ . '/../../..' . '/lib/private/SetupCheck/SetupCheckManager.php',
'OC\\Setup\\AbstractDatabase' => __DIR__ . '/../../..' . '/lib/private/Setup/AbstractDatabase.php',
'OC\\Setup\\MySQL' => __DIR__ . '/../../..' . '/lib/private/Setup/MySQL.php',
'OC\\Setup\\OCI' => __DIR__ . '/../../..' . '/lib/private/Setup/OCI.php',
diff --git a/lib/public/SetupCheck/ISetupCheck.php b/lib/public/SetupCheck/ISetupCheck.php
index e4f35b55f3c..05b43778651 100644
--- a/lib/public/SetupCheck/ISetupCheck.php
+++ b/lib/public/SetupCheck/ISetupCheck.php
@@ -19,5 +19,10 @@ interface ISetupCheck {
/**
* @since 25.0.0
*/
+ public function getName(): string;
+
+ /**
+ * @since 25.0.0
+ */
public function run(): SetupResult;
}