Skip to content

Commit ce1bed4

Browse files
committed
Fix tests and add a new one to test the new feature
Signed-off-by: Carl Schwan <[email protected]>
1 parent cb4d0c9 commit ce1bed4

File tree

3 files changed

+23
-4
lines changed

3 files changed

+23
-4
lines changed

apps/files_sharing/tests/CapabilitiesTest.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@ public function testOnlyLinkSharing() {
139139
$map = [
140140
['core', 'shareapi_enabled', 'yes', 'yes'],
141141
['core', 'shareapi_allow_links', 'yes', 'yes'],
142+
['core', 'shareapi_enforce_links_password_excluded_groups', '', ''],
142143
];
143144
$result = $this->getResults($map);
144145
$this->assertIsArray($result['public']);
@@ -149,6 +150,7 @@ public function testLinkPassword() {
149150
$map = [
150151
['core', 'shareapi_enabled', 'yes', 'yes'],
151152
['core', 'shareapi_allow_links', 'yes', 'yes'],
153+
['core', 'shareapi_enforce_links_password_excluded_groups', '', ''],
152154
['core', 'shareapi_enforce_links_password', 'no', 'yes'],
153155
];
154156
$result = $this->getResults($map);
@@ -161,6 +163,7 @@ public function testLinkNoPassword() {
161163
$map = [
162164
['core', 'shareapi_enabled', 'yes', 'yes'],
163165
['core', 'shareapi_allow_links', 'yes', 'yes'],
166+
['core', 'shareapi_enforce_links_password_excluded_groups', '', ''],
164167
['core', 'shareapi_enforce_links_password', 'no', 'no'],
165168
];
166169
$result = $this->getResults($map);
@@ -174,6 +177,7 @@ public function testLinkNoExpireDate() {
174177
['core', 'shareapi_enabled', 'yes', 'yes'],
175178
['core', 'shareapi_allow_links', 'yes', 'yes'],
176179
['core', 'shareapi_default_expire_date', 'no', 'no'],
180+
['core', 'shareapi_enforce_links_password_excluded_groups', '', ''],
177181
];
178182
$result = $this->getResults($map);
179183
$this->assertArrayHasKey('expire_date', $result['public']);
@@ -188,6 +192,7 @@ public function testLinkExpireDate() {
188192
['core', 'shareapi_default_expire_date', 'no', 'yes'],
189193
['core', 'shareapi_expire_after_n_days', '7', '7'],
190194
['core', 'shareapi_enforce_expire_date', 'no', 'no'],
195+
['core', 'shareapi_enforce_links_password_excluded_groups', '', ''],
191196
];
192197
$result = $this->getResults($map);
193198
$this->assertArrayHasKey('expire_date', $result['public']);
@@ -203,6 +208,7 @@ public function testLinkExpireDateEnforced() {
203208
['core', 'shareapi_allow_links', 'yes', 'yes'],
204209
['core', 'shareapi_default_expire_date', 'no', 'yes'],
205210
['core', 'shareapi_enforce_expire_date', 'no', 'yes'],
211+
['core', 'shareapi_enforce_links_password_excluded_groups', '', ''],
206212
];
207213
$result = $this->getResults($map);
208214
$this->assertArrayHasKey('expire_date', $result['public']);
@@ -215,6 +221,7 @@ public function testLinkSendMail() {
215221
['core', 'shareapi_enabled', 'yes', 'yes'],
216222
['core', 'shareapi_allow_links', 'yes', 'yes'],
217223
['core', 'shareapi_allow_public_notification', 'no', 'yes'],
224+
['core', 'shareapi_enforce_links_password_excluded_groups', '', ''],
218225
];
219226
$result = $this->getResults($map);
220227
$this->assertTrue($result['public']['send_mail']);
@@ -225,6 +232,7 @@ public function testLinkNoSendMail() {
225232
['core', 'shareapi_enabled', 'yes', 'yes'],
226233
['core', 'shareapi_allow_links', 'yes', 'yes'],
227234
['core', 'shareapi_allow_public_notification', 'no', 'no'],
235+
['core', 'shareapi_enforce_links_password_excluded_groups', '', ''],
228236
];
229237
$result = $this->getResults($map);
230238
$this->assertFalse($result['public']['send_mail']);
@@ -234,6 +242,7 @@ public function testResharing() {
234242
$map = [
235243
['core', 'shareapi_enabled', 'yes', 'yes'],
236244
['core', 'shareapi_allow_resharing', 'yes', 'yes'],
245+
['core', 'shareapi_enforce_links_password_excluded_groups', '', ''],
237246
];
238247
$result = $this->getResults($map);
239248
$this->assertTrue($result['resharing']);
@@ -243,6 +252,7 @@ public function testNoResharing() {
243252
$map = [
244253
['core', 'shareapi_enabled', 'yes', 'yes'],
245254
['core', 'shareapi_allow_resharing', 'yes', 'no'],
255+
['core', 'shareapi_enforce_links_password_excluded_groups', '', ''],
246256
];
247257
$result = $this->getResults($map);
248258
$this->assertFalse($result['resharing']);
@@ -253,6 +263,7 @@ public function testLinkPublicUpload() {
253263
['core', 'shareapi_enabled', 'yes', 'yes'],
254264
['core', 'shareapi_allow_links', 'yes', 'yes'],
255265
['core', 'shareapi_allow_public_upload', 'yes', 'yes'],
266+
['core', 'shareapi_enforce_links_password_excluded_groups', '', ''],
256267
];
257268
$result = $this->getResults($map);
258269
$this->assertTrue($result['public']['upload']);
@@ -264,6 +275,7 @@ public function testLinkNoPublicUpload() {
264275
['core', 'shareapi_enabled', 'yes', 'yes'],
265276
['core', 'shareapi_allow_links', 'yes', 'yes'],
266277
['core', 'shareapi_allow_public_upload', 'yes', 'no'],
278+
['core', 'shareapi_enforce_links_password_excluded_groups', '', ''],
267279
];
268280
$result = $this->getResults($map);
269281
$this->assertFalse($result['public']['upload']);

apps/settings/js/admin.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,10 @@ window.addEventListener('DOMContentLoaded', function(){
9494
$("#setDefaultRemoteExpireDate").toggleClass('hidden', !this.checked);
9595
});
9696

97+
$('#enforceLinkPassword').change(function() {
98+
$("#selectPasswordsExcludedGroups").toggleClass('hidden', !this.checked);
99+
});
100+
97101
$('#publicShareDisclaimer').change(function() {
98102
$("#publicShareDisclaimerText").toggleClass('hidden', !this.checked);
99103
if(!this.checked) {

apps/settings/templates/settings/admin/sharing.php

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -119,10 +119,13 @@
119119
print_unescaped('checked="checked"');
120120
} ?> />
121121
<label for="enforceLinkPassword"><?php p($l->t('Enforce password protection'));?></label><br/>
122-
123-
<p id="selectPasswordsExcludedGroups" class="indent <?php if (!$_['enforceLinkPassword']) { p('hidden'); } ?>">
124-
<input name="shareapi_enforce_links_password_excluded_groups" id="passwordsExcludedGroups" value="<?php p($_['allowLinksExcludeGroups']) ?>" style="width: 400px" class="noJSAutoUpdate"/>
125-
</p>
122+
<div id="selectPasswordsExcludedGroups" class="indent <?php if (!$_['enforceLinkPassword']) { p('hidden'); } ?>">
123+
<div class="indent">
124+
<label for="shareapi_enforce_links_password_excluded_groups"><?php p($l->t('Exclude groups from password requirements:'));?>
125+
<br />
126+
<input name="shareapi_enforce_links_password_excluded_groups" id="passwordsExcludedGroups" value="<?php p($_['allowLinksExcludeGroups']) ?>" style="width: 400px" class="noJSAutoUpdate"/>
127+
</div>
128+
</div>
126129

127130
<input type="checkbox" name="shareapi_default_expire_date" id="shareapiDefaultExpireDate" class="checkbox" value="1" <?php if ($_['shareDefaultExpireDateSet'] === 'yes') { print_unescaped('checked="checked"'); } ?> />
128131

0 commit comments

Comments
 (0)