We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent c0482b8 commit 8dc7e3dCopy full SHA for 8dc7e3d
4 files changed
lib/Constants.php
@@ -15,6 +15,7 @@ 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';
@@ -24,6 +25,7 @@ class Constants {
24
25
public const CONFIG_KEYS = [
26
self::CONFIG_KEY_ALLOWPERMITALL,
27
self::CONFIG_KEY_ALLOWPUBLICLINK,
28
+ self::CONFIG_KEY_ALLOWCUSTOMPUBLICTOKEN,
29
self::CONFIG_KEY_ALLOWSHOWTOALL,
30
self::CONFIG_KEY_CREATIONALLOWEDGROUPS,
31
self::CONFIG_KEY_RESTRICTCREATION,
@@ -41,6 +43,10 @@ class Constants {
41
43
self::CONFIG_KEY_CONFIRMATIONEMAILRATELIMIT => 'int',
42
44
];
45
46
+ public const PUBLIC_SHARE_TOKEN_MIN_LENGTH = 8;
47
+ public const PUBLIC_SHARE_TOKEN_MAX_LENGTH = 256;
48
+ public const PUBLIC_SHARE_HASH_REQUIREMENT = '[a-zA-Z0-9]{' . self::PUBLIC_SHARE_TOKEN_MIN_LENGTH . ',' . self::PUBLIC_SHARE_TOKEN_MAX_LENGTH . '}';
49
+
50
/**
51
* Maximum String lengths, the database is set to store.
52
lib/Service/ConfigService.php
@@ -38,7 +38,10 @@ public function getAllowPermitAll(): bool {
38
public function getAllowPublicLink(): bool {
39
return $this->appConfig->getAppValueBool(Constants::CONFIG_KEY_ALLOWPUBLICLINK, true);
40
}
- public function getAllowShowToAll() : bool {
+ public function getAllowCustomPublicToken(): bool {
+ return json_decode($this->config->getAppValue($this->appName, Constants::CONFIG_KEY_ALLOWCUSTOMPUBLICTOKEN, 'false'));
+ }
+ public function getAllowShowToAll(): bool {
return $this->appConfig->getAppValueBool(Constants::CONFIG_KEY_ALLOWSHOWTOALL, true);
private function getUnformattedCreationAllowedGroups(): array {
@@ -74,6 +77,7 @@ public function getAppConfig(): array {
74
77
return [
75
78
Constants::CONFIG_KEY_ALLOWPERMITALL => $this->getAllowPermitAll(),
76
79
Constants::CONFIG_KEY_ALLOWPUBLICLINK => $this->getAllowPublicLink(),
80
+ Constants::CONFIG_KEY_ALLOWCUSTOMPUBLICTOKEN => $this->getAllowCustomPublicToken(),
81
Constants::CONFIG_KEY_ALLOWSHOWTOALL => $this->getAllowShowToAll(),
82
Constants::CONFIG_KEY_CREATIONALLOWEDGROUPS => $this->getCreationAllowedGroups(),
83
Constants::CONFIG_KEY_RESTRICTCREATION => $this->getRestrictCreation(),
tests/Unit/Controller/ConfigControllerTest.php
@@ -68,6 +68,11 @@ public static function dataUpdateAppConfig() {
68
'configValue' => true,
69
'strConfig' => 'true'
70
],
71
+ 'booleanConfigAllowCustomPublicShareTokens' => [
72
+ 'configKey' => 'allowCustomPublicShareTokens',
73
+ 'configValue' => true,
+ 'strConfig' => 'true'
+ ],
'arrayCreationAllowedGroups' => [
'configKey' => 'creationAllowedGroups',
'configValue' => [
tests/Unit/Service/ConfigServiceTest.php
@@ -57,6 +57,7 @@ public static function dataGetAppConfig() {
57
'strConfig' => [
58
'allowPermitAll' => 'false',
59
'allowPublicLink' => 'false',
60
+ 'allowCustomPublicShareTokens' => 'true',
61
'allowShowToAll' => 'false',
62
'creationAllowedGroups' => '["group1", "group2", "nonExisting"]',
63
'restrictCreation' => 'true',
@@ -71,6 +72,7 @@ public static function dataGetAppConfig() {
'expected' => [
'allowPermitAll' => false,
'allowPublicLink' => false,
+ 'allowCustomPublicShareTokens' => true,
'allowShowToAll' => false,
'creationAllowedGroups' => [
[
@@ -160,6 +162,7 @@ public static function dataGetAppConfig_Default() {
160
162
161
163
'allowPermitAll' => true,
164
'allowPublicLink' => true,
165
+ 'allowCustomPublicShareTokens' => false,
166
'allowShowToAll' => true,
167
'creationAllowedGroups' => [],
168
'restrictCreation' => false,
0 commit comments