We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 7c61071 commit 557abb5Copy full SHA for 557abb5
5 files changed
lib/Constants.php
@@ -15,17 +15,22 @@ class Constants {
15
*/
16
public const CONFIG_KEY_ALLOWPERMITALL = 'allowPermitAll';
17
public const CONFIG_KEY_ALLOWPUBLICLINK = 'allowPublicLink';
18
+ public const CONFIG_KEY_ALLOWCUSTOMPUBLICTOKEN = 'allowCustomPublicShareTokens';
19
public const CONFIG_KEY_ALLOWSHOWTOALL = 'allowShowToAll';
20
public const CONFIG_KEY_CREATIONALLOWEDGROUPS = 'creationAllowedGroups';
21
public const CONFIG_KEY_RESTRICTCREATION = 'restrictCreation';
22
public const CONFIG_KEYS = [
23
self::CONFIG_KEY_ALLOWPERMITALL,
24
self::CONFIG_KEY_ALLOWPUBLICLINK,
25
+ self::CONFIG_KEY_ALLOWCUSTOMPUBLICTOKEN,
26
self::CONFIG_KEY_ALLOWSHOWTOALL,
27
self::CONFIG_KEY_CREATIONALLOWEDGROUPS,
28
self::CONFIG_KEY_RESTRICTCREATION
29
];
30
31
+ public const PUBLIC_SHARE_TOKEN_MIN_LENGTH = 8;
32
+ public const PUBLIC_SHARE_TOKEN_MAX_LENGTH = 256;
33
+
34
/**
35
* Maximum String lengths, the database is set to store.
36
lib/Service/ConfigService.php
@@ -37,7 +37,10 @@ public function getAllowPermitAll(): bool {
37
public function getAllowPublicLink(): bool {
38
return json_decode($this->config->getAppValue($this->appName, Constants::CONFIG_KEY_ALLOWPUBLICLINK, 'true'));
39
}
40
- public function getAllowShowToAll() : bool {
+ public function getAllowCustomPublicToken(): bool {
41
+ return json_decode($this->config->getAppValue($this->appName, Constants::CONFIG_KEY_ALLOWCUSTOMPUBLICTOKEN, 'false'));
42
+ }
43
+ public function getAllowShowToAll(): bool {
44
return json_decode($this->config->getAppValue($this->appName, Constants::CONFIG_KEY_ALLOWSHOWTOALL, 'true'));
45
46
private function getUnformattedCreationAllowedGroups(): array {
@@ -57,6 +60,7 @@ public function getAppConfig(): array {
57
60
return [
58
61
Constants::CONFIG_KEY_ALLOWPERMITALL => $this->getAllowPermitAll(),
59
62
Constants::CONFIG_KEY_ALLOWPUBLICLINK => $this->getAllowPublicLink(),
63
+ Constants::CONFIG_KEY_ALLOWCUSTOMPUBLICTOKEN => $this->getAllowCustomPublicToken(),
64
Constants::CONFIG_KEY_ALLOWSHOWTOALL => $this->getAllowShowToAll(),
65
Constants::CONFIG_KEY_CREATIONALLOWEDGROUPS => $this->getCreationAllowedGroups(),
66
Constants::CONFIG_KEY_RESTRICTCREATION => $this->getRestrictCreation(),
src/FormsSettings.vue
@@ -32,6 +32,13 @@
@update:modelValue="onAllowPublicLinkChange">
{{ t('forms', 'Allow sharing by link') }}
</NcCheckboxRadioSwitch>
+ <NcCheckboxRadioSwitch
+ ref="switchAllowCustomPublicShareTokens"
+ v-model="appConfig.allowCustomPublicShareTokens"
+ type="switch"
+ @update:modelValue="onAllowCustomPublicShareTokensChange">
+ {{ t('forms', 'Allow custom public share tokens') }}
+ </NcCheckboxRadioSwitch>
<NcCheckboxRadioSwitch
ref="switchAllowPermitAll"
v-model="appConfig.allowPermitAll"
@@ -115,6 +122,13 @@ export default {
115
122
el.loading = false
116
123
},
117
124
125
+ async onAllowCustomPublicShareTokensChange(newVal) {
126
+ const el = this.$refs.switchAllowCustomPublicShareTokens
127
+ el.loading = true
128
+ await this.saveAppConfig('allowCustomPublicShareTokens', newVal)
129
+ el.loading = false
130
+ },
131
118
132
async onAllowPermitAllChange(newVal) {
119
133
const el = this.$refs.switchAllowPermitAll
120
134
el.loading = true
tests/Unit/Controller/ConfigControllerTest.php
@@ -69,16 +69,21 @@ public function testGetAppConfig() {
69
70
public static function dataUpdateAppConfig() {
71
72
- 'booleanConfig' => [
+ 'booleanConfigAllowPermitAll' => [
73
'configKey' => 'allowPermitAll',
74
'configValue' => true,
75
'strConfig' => 'true'
76
],
77
+ 'booleanConfigAllowShowToAll' => [
78
'configKey' => 'allowShowToAll',
79
80
81
82
+ 'booleanConfigAllowCustomPublicShareTokens' => [
83
+ 'configKey' => 'allowCustomPublicShareTokens',
84
+ 'configValue' => true,
85
+ 'strConfig' => 'true'
86
+ ],
87
'arrayConfig' => [
88
89
'configValue' => [
tests/Unit/Service/ConfigServiceTest.php
@@ -62,6 +62,7 @@ public static function dataGetAppConfig() {
'strConfig' => [
'allowPermitAll' => 'false',
'allowPublicLink' => 'false',
+ 'allowCustomPublicShareTokens' => 'true',
'allowShowToAll' => 'false',
67
'creationAllowedGroups' => '["group1", "group2", "nonExisting"]',
68
'restrictCreation' => 'true',
@@ -73,6 +74,7 @@ public static function dataGetAppConfig() {
'expected' => [
'allowPermitAll' => false,
'allowPublicLink' => false,
+ 'allowCustomPublicShareTokens' => true,
'allowShowToAll' => false,
'creationAllowedGroups' => [
[
@@ -136,6 +138,7 @@ public static function dataGetAppConfig_Default() {
136
138
137
139
'allowPermitAll' => true,
140
'allowPublicLink' => true,
141
+ 'allowCustomPublicShareTokens' => false,
142
'allowShowToAll' => true,
143
'creationAllowedGroups' => [],
144
'restrictCreation' => false,
0 commit comments