@@ -15,40 +15,40 @@ |
||
15 | 15 | use OCP\Settings\ISettings; |
16 | 16 | |
17 | 17 | class Presets implements ISettings { |
18 | - public function __construct( |
|
19 | - private ServerVersion $serverVersion, |
|
20 | - private IConfig $config, |
|
21 | - private IL10N $l, |
|
22 | - private readonly PresetManager $presetManager, |
|
23 | - private IInitialState $initialState, |
|
24 | - ) { |
|
25 | - } |
|
26 | - |
|
27 | - public function getForm() { |
|
28 | - $presets = $this->presetManager->retrieveLexiconPreset(); |
|
29 | - $selectedPreset = $this->presetManager->getLexiconPreset(); |
|
30 | - $presetsApps = $this->presetManager->retrieveLexiconPresetApps(); |
|
31 | - |
|
32 | - $this->initialState->provideInitialState('settings-selected-preset', $selectedPreset->name); |
|
33 | - $this->initialState->provideInitialState('settings-presets', $presets); |
|
34 | - $this->initialState->provideInitialState('settings-presets-apps', $presetsApps); |
|
35 | - |
|
36 | - return new TemplateResponse('settings', 'settings/admin/presets', [], ''); |
|
37 | - } |
|
38 | - |
|
39 | - public function getSection() { |
|
40 | - return 'presets'; |
|
41 | - } |
|
42 | - |
|
43 | - public function getPriority() { |
|
44 | - return 0; |
|
45 | - } |
|
46 | - |
|
47 | - public function getName(): ?string { |
|
48 | - return $this->l->t('Settings presets'); |
|
49 | - } |
|
50 | - |
|
51 | - public function getAuthorizedAppConfig(): array { |
|
52 | - return []; |
|
53 | - } |
|
18 | + public function __construct( |
|
19 | + private ServerVersion $serverVersion, |
|
20 | + private IConfig $config, |
|
21 | + private IL10N $l, |
|
22 | + private readonly PresetManager $presetManager, |
|
23 | + private IInitialState $initialState, |
|
24 | + ) { |
|
25 | + } |
|
26 | + |
|
27 | + public function getForm() { |
|
28 | + $presets = $this->presetManager->retrieveLexiconPreset(); |
|
29 | + $selectedPreset = $this->presetManager->getLexiconPreset(); |
|
30 | + $presetsApps = $this->presetManager->retrieveLexiconPresetApps(); |
|
31 | + |
|
32 | + $this->initialState->provideInitialState('settings-selected-preset', $selectedPreset->name); |
|
33 | + $this->initialState->provideInitialState('settings-presets', $presets); |
|
34 | + $this->initialState->provideInitialState('settings-presets-apps', $presetsApps); |
|
35 | + |
|
36 | + return new TemplateResponse('settings', 'settings/admin/presets', [], ''); |
|
37 | + } |
|
38 | + |
|
39 | + public function getSection() { |
|
40 | + return 'presets'; |
|
41 | + } |
|
42 | + |
|
43 | + public function getPriority() { |
|
44 | + return 0; |
|
45 | + } |
|
46 | + |
|
47 | + public function getName(): ?string { |
|
48 | + return $this->l->t('Settings presets'); |
|
49 | + } |
|
50 | + |
|
51 | + public function getAuthorizedAppConfig(): array { |
|
52 | + return []; |
|
53 | + } |
|
54 | 54 | } |
@@ -14,25 +14,25 @@ |
||
14 | 14 | |
15 | 15 | class Presets implements IIconSection { |
16 | 16 | |
17 | - public function __construct( |
|
18 | - private IL10N $l, |
|
19 | - private IURLGenerator $urlGenerator, |
|
20 | - ) { |
|
21 | - } |
|
22 | - |
|
23 | - public function getIcon(): string { |
|
24 | - return $this->urlGenerator->imagePath('settings', 'library_add_check.svg'); |
|
25 | - } |
|
26 | - |
|
27 | - public function getID(): string { |
|
28 | - return 'presets'; |
|
29 | - } |
|
30 | - |
|
31 | - public function getName(): string { |
|
32 | - return $this->l->t('Settings presets'); |
|
33 | - } |
|
34 | - |
|
35 | - public function getPriority(): int { |
|
36 | - return 0; |
|
37 | - } |
|
17 | + public function __construct( |
|
18 | + private IL10N $l, |
|
19 | + private IURLGenerator $urlGenerator, |
|
20 | + ) { |
|
21 | + } |
|
22 | + |
|
23 | + public function getIcon(): string { |
|
24 | + return $this->urlGenerator->imagePath('settings', 'library_add_check.svg'); |
|
25 | + } |
|
26 | + |
|
27 | + public function getID(): string { |
|
28 | + return 'presets'; |
|
29 | + } |
|
30 | + |
|
31 | + public function getName(): string { |
|
32 | + return $this->l->t('Settings presets'); |
|
33 | + } |
|
34 | + |
|
35 | + public function getPriority(): int { |
|
36 | + return 0; |
|
37 | + } |
|
38 | 38 | } |
@@ -20,81 +20,81 @@ |
||
20 | 20 | * Please Add & Manage your Config Keys in that file and keep the Lexicon up to date! |
21 | 21 | */ |
22 | 22 | class ConfigLexicon implements ILexicon { |
23 | - public const SHAREAPI_ALLOW_FEDERATION_ON_PUBLIC_SHARES = 'shareapi_allow_federation_on_public_shares'; |
|
24 | - public const SHARE_CUSTOM_TOKEN = 'shareapi_allow_custom_tokens'; |
|
25 | - public const SHARE_LINK_PASSWORD_DEFAULT = 'shareapi_enable_link_password_by_default'; |
|
26 | - public const SHARE_LINK_PASSWORD_ENFORCED = 'shareapi_enforce_links_password'; |
|
27 | - public const SHARE_LINK_EXPIRE_DATE_DEFAULT = 'shareapi_default_expire_date'; |
|
28 | - public const SHARE_LINK_EXPIRE_DATE_ENFORCED = 'shareapi_enforce_expire_date'; |
|
29 | - public const USER_LANGUAGE = 'lang'; |
|
30 | - public const OCM_DISCOVERY_ENABLED = 'ocm_discovery_enabled'; |
|
31 | - public const USER_LOCALE = 'locale'; |
|
32 | - public const USER_TIMEZONE = 'timezone'; |
|
23 | + public const SHAREAPI_ALLOW_FEDERATION_ON_PUBLIC_SHARES = 'shareapi_allow_federation_on_public_shares'; |
|
24 | + public const SHARE_CUSTOM_TOKEN = 'shareapi_allow_custom_tokens'; |
|
25 | + public const SHARE_LINK_PASSWORD_DEFAULT = 'shareapi_enable_link_password_by_default'; |
|
26 | + public const SHARE_LINK_PASSWORD_ENFORCED = 'shareapi_enforce_links_password'; |
|
27 | + public const SHARE_LINK_EXPIRE_DATE_DEFAULT = 'shareapi_default_expire_date'; |
|
28 | + public const SHARE_LINK_EXPIRE_DATE_ENFORCED = 'shareapi_enforce_expire_date'; |
|
29 | + public const USER_LANGUAGE = 'lang'; |
|
30 | + public const OCM_DISCOVERY_ENABLED = 'ocm_discovery_enabled'; |
|
31 | + public const USER_LOCALE = 'locale'; |
|
32 | + public const USER_TIMEZONE = 'timezone'; |
|
33 | 33 | |
34 | - public const LASTCRON_TIMESTAMP = 'lastcron'; |
|
34 | + public const LASTCRON_TIMESTAMP = 'lastcron'; |
|
35 | 35 | |
36 | - public function getStrictness(): Strictness { |
|
37 | - return Strictness::IGNORE; |
|
38 | - } |
|
36 | + public function getStrictness(): Strictness { |
|
37 | + return Strictness::IGNORE; |
|
38 | + } |
|
39 | 39 | |
40 | - public function getAppConfigs(): array { |
|
41 | - return [ |
|
42 | - new Entry( |
|
43 | - key: self::SHAREAPI_ALLOW_FEDERATION_ON_PUBLIC_SHARES, |
|
44 | - type: ValueType::BOOL, |
|
45 | - defaultRaw: true, |
|
46 | - definition: 'adds share permission to public shares to allow adding them to your Nextcloud (federation)', |
|
47 | - lazy: true, |
|
48 | - ), |
|
49 | - new Entry( |
|
50 | - key: self::SHARE_CUSTOM_TOKEN, |
|
51 | - type: ValueType::BOOL, |
|
52 | - defaultRaw: fn (Preset $p): bool => match ($p) { |
|
53 | - Preset::FAMILY, Preset::PRIVATE => true, |
|
54 | - default => false, |
|
55 | - }, |
|
56 | - definition: 'Allow users to customize share URL', |
|
57 | - lazy: true, |
|
58 | - note: 'Shares with guessable tokens may be accessed easily. Shares with custom tokens will continue to be accessible after this setting has been disabled.', |
|
59 | - ), |
|
60 | - new Entry(self::SHARE_LINK_PASSWORD_DEFAULT, ValueType::BOOL, false, 'Ask for a password when sharing document by default'), |
|
61 | - new Entry( |
|
62 | - key: self::SHARE_LINK_PASSWORD_ENFORCED, |
|
63 | - type: ValueType::BOOL, |
|
64 | - defaultRaw: fn (Preset $p): bool => match ($p) { |
|
65 | - Preset::SCHOOL, Preset::UNIVERSITY, Preset::SHARED, Preset::SMALL, Preset::MEDIUM, Preset::LARGE => true, |
|
66 | - default => false, |
|
67 | - }, |
|
68 | - definition: 'Enforce password protection for shared documents' |
|
69 | - ), |
|
70 | - new Entry( |
|
71 | - key: self::SHARE_LINK_EXPIRE_DATE_DEFAULT, |
|
72 | - type: ValueType::BOOL, |
|
73 | - defaultRaw: fn (Preset $p): bool => match ($p) { |
|
74 | - Preset::SHARED, Preset::SMALL, Preset::MEDIUM, Preset::LARGE => true, |
|
75 | - default => false, |
|
76 | - }, |
|
77 | - definition: 'Default expiration date for shares via link or mail' |
|
78 | - ), |
|
79 | - new Entry( |
|
80 | - key: self::SHARE_LINK_EXPIRE_DATE_ENFORCED, |
|
81 | - type: ValueType::BOOL, |
|
82 | - defaultRaw: fn (Preset $p): bool => match ($p) { |
|
83 | - Preset::SHARED, Preset::SMALL, Preset::MEDIUM, Preset::LARGE => true, |
|
84 | - default => false, |
|
85 | - }, |
|
86 | - definition: 'Enforce expiration date for shares via link or mail' |
|
87 | - ), |
|
88 | - new Entry(self::LASTCRON_TIMESTAMP, ValueType::INT, 0, 'timestamp of last cron execution'), |
|
89 | - new Entry(self::OCM_DISCOVERY_ENABLED, ValueType::BOOL, true, 'enable/disable OCM', lazy: true), |
|
90 | - ]; |
|
91 | - } |
|
40 | + public function getAppConfigs(): array { |
|
41 | + return [ |
|
42 | + new Entry( |
|
43 | + key: self::SHAREAPI_ALLOW_FEDERATION_ON_PUBLIC_SHARES, |
|
44 | + type: ValueType::BOOL, |
|
45 | + defaultRaw: true, |
|
46 | + definition: 'adds share permission to public shares to allow adding them to your Nextcloud (federation)', |
|
47 | + lazy: true, |
|
48 | + ), |
|
49 | + new Entry( |
|
50 | + key: self::SHARE_CUSTOM_TOKEN, |
|
51 | + type: ValueType::BOOL, |
|
52 | + defaultRaw: fn (Preset $p): bool => match ($p) { |
|
53 | + Preset::FAMILY, Preset::PRIVATE => true, |
|
54 | + default => false, |
|
55 | + }, |
|
56 | + definition: 'Allow users to customize share URL', |
|
57 | + lazy: true, |
|
58 | + note: 'Shares with guessable tokens may be accessed easily. Shares with custom tokens will continue to be accessible after this setting has been disabled.', |
|
59 | + ), |
|
60 | + new Entry(self::SHARE_LINK_PASSWORD_DEFAULT, ValueType::BOOL, false, 'Ask for a password when sharing document by default'), |
|
61 | + new Entry( |
|
62 | + key: self::SHARE_LINK_PASSWORD_ENFORCED, |
|
63 | + type: ValueType::BOOL, |
|
64 | + defaultRaw: fn (Preset $p): bool => match ($p) { |
|
65 | + Preset::SCHOOL, Preset::UNIVERSITY, Preset::SHARED, Preset::SMALL, Preset::MEDIUM, Preset::LARGE => true, |
|
66 | + default => false, |
|
67 | + }, |
|
68 | + definition: 'Enforce password protection for shared documents' |
|
69 | + ), |
|
70 | + new Entry( |
|
71 | + key: self::SHARE_LINK_EXPIRE_DATE_DEFAULT, |
|
72 | + type: ValueType::BOOL, |
|
73 | + defaultRaw: fn (Preset $p): bool => match ($p) { |
|
74 | + Preset::SHARED, Preset::SMALL, Preset::MEDIUM, Preset::LARGE => true, |
|
75 | + default => false, |
|
76 | + }, |
|
77 | + definition: 'Default expiration date for shares via link or mail' |
|
78 | + ), |
|
79 | + new Entry( |
|
80 | + key: self::SHARE_LINK_EXPIRE_DATE_ENFORCED, |
|
81 | + type: ValueType::BOOL, |
|
82 | + defaultRaw: fn (Preset $p): bool => match ($p) { |
|
83 | + Preset::SHARED, Preset::SMALL, Preset::MEDIUM, Preset::LARGE => true, |
|
84 | + default => false, |
|
85 | + }, |
|
86 | + definition: 'Enforce expiration date for shares via link or mail' |
|
87 | + ), |
|
88 | + new Entry(self::LASTCRON_TIMESTAMP, ValueType::INT, 0, 'timestamp of last cron execution'), |
|
89 | + new Entry(self::OCM_DISCOVERY_ENABLED, ValueType::BOOL, true, 'enable/disable OCM', lazy: true), |
|
90 | + ]; |
|
91 | + } |
|
92 | 92 | |
93 | - public function getUserConfigs(): array { |
|
94 | - return [ |
|
95 | - new Entry(self::USER_LANGUAGE, ValueType::STRING, definition: 'language'), |
|
96 | - new Entry(self::USER_LOCALE, ValueType::STRING, definition: 'locale'), |
|
97 | - new Entry(self::USER_TIMEZONE, ValueType::STRING, definition: 'timezone'), |
|
98 | - ]; |
|
99 | - } |
|
93 | + public function getUserConfigs(): array { |
|
94 | + return [ |
|
95 | + new Entry(self::USER_LANGUAGE, ValueType::STRING, definition: 'language'), |
|
96 | + new Entry(self::USER_LOCALE, ValueType::STRING, definition: 'locale'), |
|
97 | + new Entry(self::USER_TIMEZONE, ValueType::STRING, definition: 'timezone'), |
|
98 | + ]; |
|
99 | + } |
|
100 | 100 | } |