aboutsummaryrefslogtreecommitdiffstats
path: root/core/AppInfo/ConfigLexicon.php
blob: df8243019ad3b4712a0860c1c77da70eb2320f86 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
<?php

declare(strict_types=1);
/**
 * SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors
 * SPDX-License-Identifier: AGPL-3.0-or-later
 */

namespace OC\Core\AppInfo;

use OCP\Config\Lexicon\Entry;
use OCP\Config\Lexicon\ILexicon;
use OCP\Config\Lexicon\Preset;
use OCP\Config\Lexicon\Strictness;
use OCP\Config\ValueType;

/**
 * Config Lexicon for core.
 *
 * Please Add & Manage your Config Keys in that file and keep the Lexicon up to date!
 */
class ConfigLexicon implements ILexicon {
	public const SHAREAPI_ALLOW_FEDERATION_ON_PUBLIC_SHARES = 'shareapi_allow_federation_on_public_shares';
	public const SHARE_CUSTOM_TOKEN = 'shareapi_allow_custom_tokens';
	public const USER_LANGUAGE = 'lang';
	public const LASTCRON_TIMESTAMP = 'lastcron';

	public function getStrictness(): Strictness {
		return Strictness::IGNORE;
	}

	public function getAppConfigs(): array {
		return [
			new Entry(
				key: self::SHAREAPI_ALLOW_FEDERATION_ON_PUBLIC_SHARES,
				type: ValueType::BOOL,
				defaultRaw: true,
				definition: 'adds share permission to public shares to allow adding them to your Nextcloud (federation)',
				lazy: true,
			),
			new Entry(
				key: self::SHARE_CUSTOM_TOKEN,
				type: ValueType::BOOL,
				defaultRaw: fn (Preset $p): bool => match ($p) {
					Preset::FAMILY, Preset::PRIVATE => true,
					default => false,
				},
				definition: 'Allow users to set custom share link tokens',
				lazy: true,
				note: 'Shares with guessable tokens may be accessed easily. Shares with custom tokens will continue to be accessible after this setting has been disabled.',
			),
			new Entry(self::LASTCRON_TIMESTAMP, ValueType::INT, 0, 'timestamp of last cron execution'),
		];
	}

	public function getUserConfigs(): array {
		return [
			new Entry(self::USER_LANGUAGE, ValueType::STRING, null, 'language'),
		];
	}
}