2025-05-12 12:40:35 -04:00
< ? 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 ;
2025-07-16 12:14:18 -04:00
use OCP\Config\Lexicon\Entry ;
use OCP\Config\Lexicon\ILexicon ;
2025-07-29 05:12:54 -04:00
use OCP\Config\Lexicon\Preset ;
2025-07-16 12:14:18 -04:00
use OCP\Config\Lexicon\Strictness ;
use OCP\Config\ValueType ;
2025-05-12 12:40:35 -04:00
/**
* Config Lexicon for core .
*
* Please Add & Manage your Config Keys in that file and keep the Lexicon up to date !
*/
2025-07-16 12:14:18 -04:00
class ConfigLexicon implements ILexicon {
2025-05-12 12:40:35 -04:00
public const SHAREAPI_ALLOW_FEDERATION_ON_PUBLIC_SHARES = 'shareapi_allow_federation_on_public_shares' ;
2025-07-29 05:12:54 -04:00
public const SHARE_CUSTOM_TOKEN = 'shareapi_allow_custom_tokens' ;
2025-08-07 09:58:35 -04:00
public const SHARE_LINK_PASSWORD_DEFAULT = 'shareapi_enable_link_password_by_default' ;
public const SHARE_LINK_PASSWORD_ENFORCED = 'shareapi_enforce_links_password' ;
2025-08-13 08:03:25 -04:00
public const SHARE_LINK_EXPIRE_DATE_DEFAULT = 'shareapi_default_expire_date' ;
public const SHARE_LINK_EXPIRE_DATE_ENFORCED = 'shareapi_enforce_expire_date' ;
2025-07-24 18:43:07 -04:00
public const USER_LANGUAGE = 'lang' ;
2025-08-12 11:05:37 -04:00
public const OCM_DISCOVERY_ENABLED = 'ocm_discovery_enabled' ;
2025-09-19 12:31:37 -04:00
public const OCM_INVITE_ACCEPT_DIALOG = 'ocm_invite_accept_dialog' ;
2025-08-16 17:43:14 -04:00
public const USER_LOCALE = 'locale' ;
public const USER_TIMEZONE = 'timezone' ;
2025-09-24 06:03:52 -04:00
public const UNIFIED_SEARCH_MIN_SEARCH_LENGTH = 'unified_search_min_search_length' ;
2025-07-24 18:43:07 -04:00
public const LASTCRON_TIMESTAMP = 'lastcron' ;
2025-05-12 12:40:35 -04:00
2025-07-16 12:14:18 -04:00
public function getStrictness () : Strictness {
return Strictness :: IGNORE ;
2025-05-12 12:40:35 -04:00
}
public function getAppConfigs () : array {
return [
2025-07-16 12:14:18 -04:00
new Entry (
2025-05-12 12:40:35 -04:00
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)' ,
2025-07-16 12:14:18 -04:00
lazy : true ,
2025-05-12 12:40:35 -04:00
),
2025-07-29 05:12:54 -04:00
new Entry (
key : self :: SHARE_CUSTOM_TOKEN ,
type : ValueType :: BOOL ,
defaultRaw : fn ( Preset $p ) : bool => match ( $p ) {
Preset :: FAMILY , Preset :: PRIVATE => true ,
default => false ,
},
2025-08-26 12:03:44 -04:00
definition : 'Allow users to customize share URL' ,
2025-07-29 05:12:54 -04:00
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.' ,
),
2025-08-14 06:52:28 -04:00
new Entry ( self :: SHARE_LINK_PASSWORD_DEFAULT , ValueType :: BOOL , false , 'Ask for a password when sharing document by default' ),
2025-08-07 09:58:35 -04:00
new Entry (
key : self :: SHARE_LINK_PASSWORD_ENFORCED ,
type : ValueType :: BOOL ,
defaultRaw : fn ( Preset $p ) : bool => match ( $p ) {
Preset :: SCHOOL , Preset :: UNIVERSITY , Preset :: SHARED , Preset :: SMALL , Preset :: MEDIUM , Preset :: LARGE => true ,
default => false ,
},
2025-08-26 12:03:44 -04:00
definition : 'Enforce password protection for shared documents'
2025-08-07 09:58:35 -04:00
),
2025-08-13 08:03:25 -04:00
new Entry (
key : self :: SHARE_LINK_EXPIRE_DATE_DEFAULT ,
type : ValueType :: BOOL ,
defaultRaw : fn ( Preset $p ) : bool => match ( $p ) {
Preset :: SHARED , Preset :: SMALL , Preset :: MEDIUM , Preset :: LARGE => true ,
default => false ,
},
2025-08-26 12:03:44 -04:00
definition : 'Default expiration date for shares via link or mail'
2025-08-13 08:03:25 -04:00
),
new Entry (
key : self :: SHARE_LINK_EXPIRE_DATE_ENFORCED ,
type : ValueType :: BOOL ,
defaultRaw : fn ( Preset $p ) : bool => match ( $p ) {
Preset :: SHARED , Preset :: SMALL , Preset :: MEDIUM , Preset :: LARGE => true ,
default => false ,
},
definition : 'Enforce expiration date for shares via link or mail'
),
2025-07-24 18:43:07 -04:00
new Entry ( self :: LASTCRON_TIMESTAMP , ValueType :: INT , 0 , 'timestamp of last cron execution' ),
2025-08-12 11:05:37 -04:00
new Entry ( self :: OCM_DISCOVERY_ENABLED , ValueType :: BOOL , true , 'enable/disable OCM' , lazy : true ),
2025-09-19 12:31:37 -04:00
new Entry ( self :: OCM_INVITE_ACCEPT_DIALOG , ValueType :: STRING , '' , 'route to local invite accept dialog' , lazy : true , note : 'set as empty string to disable feature' ),
2025-09-24 06:03:52 -04:00
new Entry ( self :: UNIFIED_SEARCH_MIN_SEARCH_LENGTH , ValueType :: INT , 1 , 'Minimum search length to trigger the request' , lazy : false , rename : 'unified-search.min-search-length' ),
2025-05-12 12:40:35 -04:00
];
}
public function getUserConfigs () : array {
2025-07-24 18:43:07 -04:00
return [
2025-08-16 17:43:14 -04:00
new Entry ( self :: USER_LANGUAGE , ValueType :: STRING , definition : 'language' ),
new Entry ( self :: USER_LOCALE , ValueType :: STRING , definition : 'locale' ),
new Entry ( self :: USER_TIMEZONE , ValueType :: STRING , definition : 'timezone' ),
2025-07-24 18:43:07 -04:00
];
2025-05-12 12:40:35 -04:00
}
}