Completed
Push — master ( 65f8de...49e35f )
by
unknown
20:13 queued 01:20
created
apps/files_sharing/lib/Capabilities.php 1 patch
Indentation   +168 added lines, -168 removed lines patch added patch discarded remove patch
@@ -19,172 +19,172 @@
 block discarded – undo
19 19
  * @package OCA\Files_Sharing
20 20
  */
21 21
 class Capabilities implements ICapability {
22
-	public function __construct(
23
-		private IConfig $config,
24
-		private IManager $shareManager,
25
-		private IAppManager $appManager,
26
-	) {
27
-	}
28
-
29
-	/**
30
-	 * Return this classes capabilities
31
-	 *
32
-	 * @return array{
33
-	 *     files_sharing: array{
34
-	 *         api_enabled: bool,
35
-	 *         public: array{
36
-	 *             enabled: bool,
37
-	 *             password?: array{
38
-	 *                 enforced: bool,
39
-	 *                 askForOptionalPassword: bool
40
-	 *             },
41
-	 *     		   multiple_links?: bool,
42
-	 *             expire_date?: array{
43
-	 *                 enabled: bool,
44
-	 *                 days?: int,
45
-	 *                 enforced?: bool,
46
-	 *             },
47
-	 *             expire_date_internal?: array{
48
-	 *                 enabled: bool,
49
-	 *                 days?: int,
50
-	 *                 enforced?: bool,
51
-	 *             },
52
-	 *             expire_date_remote?: array{
53
-	 *                 enabled: bool,
54
-	 *                 days?: int,
55
-	 *                 enforced?: bool,
56
-	 *             },
57
-	 *             send_mail?: bool,
58
-	 *             upload?: bool,
59
-	 *             upload_files_drop?: bool,
60
-	 *             custom_tokens?: bool,
61
-	 *         },
62
-	 *         user: array{
63
-	 *             send_mail: bool,
64
-	 *             expire_date?: array{
65
-	 *                 enabled: bool,
66
-	 *             },
67
-	 *         },
68
-	 *         resharing: bool,
69
-	 *         group_sharing?: bool,
70
-	 *         group?: array{
71
-	 *             enabled: bool,
72
-	 *             expire_date?: array{
73
-	 *                 enabled: bool,
74
-	 *             },
75
-	 *         },
76
-	 *         default_permissions?: int,
77
-	 *         federation: array{
78
-	 *             outgoing: bool,
79
-	 *             incoming: bool,
80
-	 *             expire_date: array{
81
-	 *                 enabled: bool,
82
-	 *             },
83
-	 *             expire_date_supported: array{
84
-	 *                 enabled: bool,
85
-	 *             },
86
-	 *         },
87
-	 *         sharee: array{
88
-	 *             query_lookup_default: bool,
89
-	 *             always_show_unique: bool,
90
-	 *         },
91
-	 *	   },
92
-	 * }
93
-	 */
94
-	public function getCapabilities() {
95
-		$res = [];
96
-
97
-		if (!$this->shareManager->shareApiEnabled()) {
98
-			$res['api_enabled'] = false;
99
-			$res['public'] = ['enabled' => false];
100
-			$res['user'] = ['send_mail' => false];
101
-			$res['resharing'] = false;
102
-		} else {
103
-			$res['api_enabled'] = true;
104
-
105
-			$public = [];
106
-			$public['enabled'] = $this->shareManager->shareApiAllowLinks();
107
-			if ($public['enabled']) {
108
-				$public['password'] = [];
109
-				$public['password']['enforced'] = $this->shareManager->shareApiLinkEnforcePassword();
110
-
111
-				if ($public['password']['enforced']) {
112
-					$public['password']['askForOptionalPassword'] = false;
113
-				} else {
114
-					$public['password']['askForOptionalPassword'] = ($this->config->getAppValue('core', 'shareapi_enable_link_password_by_default', 'no') === 'yes');
115
-				}
116
-
117
-				$public['expire_date'] = [];
118
-				$public['multiple_links'] = true;
119
-				$public['expire_date']['enabled'] = $this->shareManager->shareApiLinkDefaultExpireDate();
120
-				if ($public['expire_date']['enabled']) {
121
-					$public['expire_date']['days'] = $this->shareManager->shareApiLinkDefaultExpireDays();
122
-					$public['expire_date']['enforced'] = $this->shareManager->shareApiLinkDefaultExpireDateEnforced();
123
-				}
124
-
125
-				$public['expire_date_internal'] = [];
126
-				$public['expire_date_internal']['enabled'] = $this->shareManager->shareApiInternalDefaultExpireDate();
127
-				if ($public['expire_date_internal']['enabled']) {
128
-					$public['expire_date_internal']['days'] = $this->shareManager->shareApiInternalDefaultExpireDays();
129
-					$public['expire_date_internal']['enforced'] = $this->shareManager->shareApiInternalDefaultExpireDateEnforced();
130
-				}
131
-
132
-				$public['expire_date_remote'] = [];
133
-				$public['expire_date_remote']['enabled'] = $this->shareManager->shareApiRemoteDefaultExpireDate();
134
-				if ($public['expire_date_remote']['enabled']) {
135
-					$public['expire_date_remote']['days'] = $this->shareManager->shareApiRemoteDefaultExpireDays();
136
-					$public['expire_date_remote']['enforced'] = $this->shareManager->shareApiRemoteDefaultExpireDateEnforced();
137
-				}
138
-
139
-				$public['send_mail'] = $this->config->getAppValue('core', 'shareapi_allow_public_notification', 'no') === 'yes';
140
-				$public['upload'] = $this->shareManager->shareApiLinkAllowPublicUpload();
141
-				$public['upload_files_drop'] = $public['upload'];
142
-				$public['custom_tokens'] = $this->shareManager->allowCustomTokens();
143
-			}
144
-			$res['public'] = $public;
145
-
146
-			$res['resharing'] = $this->config->getAppValue('core', 'shareapi_allow_resharing', 'yes') === 'yes';
147
-
148
-			$res['user']['send_mail'] = false;
149
-			$res['user']['expire_date']['enabled'] = true;
150
-
151
-			// deprecated in favour of 'group', but we need to keep it for now
152
-			// in order to stay compatible with older clients
153
-			$res['group_sharing'] = $this->shareManager->allowGroupSharing();
154
-
155
-			$res['group'] = [];
156
-			$res['group']['enabled'] = $this->shareManager->allowGroupSharing();
157
-			$res['group']['expire_date']['enabled'] = true;
158
-			$res['default_permissions'] = (int)$this->config->getAppValue('core', 'shareapi_default_permissions', (string)Constants::PERMISSION_ALL);
159
-		}
160
-
161
-		//Federated sharing
162
-		if ($this->appManager->isEnabledForAnyone('federation')) {
163
-			$res['federation'] = [
164
-				'outgoing' => $this->shareManager->outgoingServer2ServerSharesAllowed(),
165
-				'incoming' => $this->config->getAppValue('files_sharing', 'incoming_server2server_share_enabled', 'yes') === 'yes',
166
-				// old bogus one, expire_date was not working before, keeping for compatibility
167
-				'expire_date' => ['enabled' => true],
168
-				// the real deal, signifies that expiration date can be set on federated shares
169
-				'expire_date_supported' => ['enabled' => true],
170
-			];
171
-		} else {
172
-			$res['federation'] = [
173
-				'outgoing' => false,
174
-				'incoming' => false,
175
-				'expire_date' => ['enabled' => false],
176
-				'expire_date_supported' => ['enabled' => false],
177
-			];
178
-		}
179
-
180
-		// Sharee searches
181
-		$res['sharee'] = [
182
-			'query_lookup_default' => $this->config->getSystemValueBool('gs.enabled', false),
183
-			'always_show_unique' => $this->config->getAppValue('files_sharing', 'always_show_unique', 'yes') === 'yes',
184
-		];
185
-
186
-		return [
187
-			'files_sharing' => $res,
188
-		];
189
-	}
22
+    public function __construct(
23
+        private IConfig $config,
24
+        private IManager $shareManager,
25
+        private IAppManager $appManager,
26
+    ) {
27
+    }
28
+
29
+    /**
30
+     * Return this classes capabilities
31
+     *
32
+     * @return array{
33
+     *     files_sharing: array{
34
+     *         api_enabled: bool,
35
+     *         public: array{
36
+     *             enabled: bool,
37
+     *             password?: array{
38
+     *                 enforced: bool,
39
+     *                 askForOptionalPassword: bool
40
+     *             },
41
+     *     		   multiple_links?: bool,
42
+     *             expire_date?: array{
43
+     *                 enabled: bool,
44
+     *                 days?: int,
45
+     *                 enforced?: bool,
46
+     *             },
47
+     *             expire_date_internal?: array{
48
+     *                 enabled: bool,
49
+     *                 days?: int,
50
+     *                 enforced?: bool,
51
+     *             },
52
+     *             expire_date_remote?: array{
53
+     *                 enabled: bool,
54
+     *                 days?: int,
55
+     *                 enforced?: bool,
56
+     *             },
57
+     *             send_mail?: bool,
58
+     *             upload?: bool,
59
+     *             upload_files_drop?: bool,
60
+     *             custom_tokens?: bool,
61
+     *         },
62
+     *         user: array{
63
+     *             send_mail: bool,
64
+     *             expire_date?: array{
65
+     *                 enabled: bool,
66
+     *             },
67
+     *         },
68
+     *         resharing: bool,
69
+     *         group_sharing?: bool,
70
+     *         group?: array{
71
+     *             enabled: bool,
72
+     *             expire_date?: array{
73
+     *                 enabled: bool,
74
+     *             },
75
+     *         },
76
+     *         default_permissions?: int,
77
+     *         federation: array{
78
+     *             outgoing: bool,
79
+     *             incoming: bool,
80
+     *             expire_date: array{
81
+     *                 enabled: bool,
82
+     *             },
83
+     *             expire_date_supported: array{
84
+     *                 enabled: bool,
85
+     *             },
86
+     *         },
87
+     *         sharee: array{
88
+     *             query_lookup_default: bool,
89
+     *             always_show_unique: bool,
90
+     *         },
91
+     *	   },
92
+     * }
93
+     */
94
+    public function getCapabilities() {
95
+        $res = [];
96
+
97
+        if (!$this->shareManager->shareApiEnabled()) {
98
+            $res['api_enabled'] = false;
99
+            $res['public'] = ['enabled' => false];
100
+            $res['user'] = ['send_mail' => false];
101
+            $res['resharing'] = false;
102
+        } else {
103
+            $res['api_enabled'] = true;
104
+
105
+            $public = [];
106
+            $public['enabled'] = $this->shareManager->shareApiAllowLinks();
107
+            if ($public['enabled']) {
108
+                $public['password'] = [];
109
+                $public['password']['enforced'] = $this->shareManager->shareApiLinkEnforcePassword();
110
+
111
+                if ($public['password']['enforced']) {
112
+                    $public['password']['askForOptionalPassword'] = false;
113
+                } else {
114
+                    $public['password']['askForOptionalPassword'] = ($this->config->getAppValue('core', 'shareapi_enable_link_password_by_default', 'no') === 'yes');
115
+                }
116
+
117
+                $public['expire_date'] = [];
118
+                $public['multiple_links'] = true;
119
+                $public['expire_date']['enabled'] = $this->shareManager->shareApiLinkDefaultExpireDate();
120
+                if ($public['expire_date']['enabled']) {
121
+                    $public['expire_date']['days'] = $this->shareManager->shareApiLinkDefaultExpireDays();
122
+                    $public['expire_date']['enforced'] = $this->shareManager->shareApiLinkDefaultExpireDateEnforced();
123
+                }
124
+
125
+                $public['expire_date_internal'] = [];
126
+                $public['expire_date_internal']['enabled'] = $this->shareManager->shareApiInternalDefaultExpireDate();
127
+                if ($public['expire_date_internal']['enabled']) {
128
+                    $public['expire_date_internal']['days'] = $this->shareManager->shareApiInternalDefaultExpireDays();
129
+                    $public['expire_date_internal']['enforced'] = $this->shareManager->shareApiInternalDefaultExpireDateEnforced();
130
+                }
131
+
132
+                $public['expire_date_remote'] = [];
133
+                $public['expire_date_remote']['enabled'] = $this->shareManager->shareApiRemoteDefaultExpireDate();
134
+                if ($public['expire_date_remote']['enabled']) {
135
+                    $public['expire_date_remote']['days'] = $this->shareManager->shareApiRemoteDefaultExpireDays();
136
+                    $public['expire_date_remote']['enforced'] = $this->shareManager->shareApiRemoteDefaultExpireDateEnforced();
137
+                }
138
+
139
+                $public['send_mail'] = $this->config->getAppValue('core', 'shareapi_allow_public_notification', 'no') === 'yes';
140
+                $public['upload'] = $this->shareManager->shareApiLinkAllowPublicUpload();
141
+                $public['upload_files_drop'] = $public['upload'];
142
+                $public['custom_tokens'] = $this->shareManager->allowCustomTokens();
143
+            }
144
+            $res['public'] = $public;
145
+
146
+            $res['resharing'] = $this->config->getAppValue('core', 'shareapi_allow_resharing', 'yes') === 'yes';
147
+
148
+            $res['user']['send_mail'] = false;
149
+            $res['user']['expire_date']['enabled'] = true;
150
+
151
+            // deprecated in favour of 'group', but we need to keep it for now
152
+            // in order to stay compatible with older clients
153
+            $res['group_sharing'] = $this->shareManager->allowGroupSharing();
154
+
155
+            $res['group'] = [];
156
+            $res['group']['enabled'] = $this->shareManager->allowGroupSharing();
157
+            $res['group']['expire_date']['enabled'] = true;
158
+            $res['default_permissions'] = (int)$this->config->getAppValue('core', 'shareapi_default_permissions', (string)Constants::PERMISSION_ALL);
159
+        }
160
+
161
+        //Federated sharing
162
+        if ($this->appManager->isEnabledForAnyone('federation')) {
163
+            $res['federation'] = [
164
+                'outgoing' => $this->shareManager->outgoingServer2ServerSharesAllowed(),
165
+                'incoming' => $this->config->getAppValue('files_sharing', 'incoming_server2server_share_enabled', 'yes') === 'yes',
166
+                // old bogus one, expire_date was not working before, keeping for compatibility
167
+                'expire_date' => ['enabled' => true],
168
+                // the real deal, signifies that expiration date can be set on federated shares
169
+                'expire_date_supported' => ['enabled' => true],
170
+            ];
171
+        } else {
172
+            $res['federation'] = [
173
+                'outgoing' => false,
174
+                'incoming' => false,
175
+                'expire_date' => ['enabled' => false],
176
+                'expire_date_supported' => ['enabled' => false],
177
+            ];
178
+        }
179
+
180
+        // Sharee searches
181
+        $res['sharee'] = [
182
+            'query_lookup_default' => $this->config->getSystemValueBool('gs.enabled', false),
183
+            'always_show_unique' => $this->config->getAppValue('files_sharing', 'always_show_unique', 'yes') === 'yes',
184
+        ];
185
+
186
+        return [
187
+            'files_sharing' => $res,
188
+        ];
189
+    }
190 190
 }
Please login to merge, or discard this patch.
apps/files_sharing/tests/CapabilitiesTest.php 1 patch
Indentation   +275 added lines, -275 removed lines patch added patch discarded remove patch
@@ -36,303 +36,303 @@
 block discarded – undo
36 36
  */
37 37
 class CapabilitiesTest extends \Test\TestCase {
38 38
 
39
-	/**
40
-	 * Test for the general part in each return statement and assert.
41
-	 * Strip of the general part on the way.
42
-	 *
43
-	 * @param string[] $data Capabilities
44
-	 * @return string[]
45
-	 */
46
-	private function getFilesSharingPart(array $data) {
47
-		$this->assertArrayHasKey('files_sharing', $data);
48
-		return $data['files_sharing'];
49
-	}
39
+    /**
40
+     * Test for the general part in each return statement and assert.
41
+     * Strip of the general part on the way.
42
+     *
43
+     * @param string[] $data Capabilities
44
+     * @return string[]
45
+     */
46
+    private function getFilesSharingPart(array $data) {
47
+        $this->assertArrayHasKey('files_sharing', $data);
48
+        return $data['files_sharing'];
49
+    }
50 50
 
51
-	/**
52
-	 * Create a mock config object and insert the values in $map to the getAppValue
53
-	 * function. Then obtain the capabilities and extract the first few
54
-	 * levels in the array
55
-	 *
56
-	 * @param (string[])[] $map Map of arguments to return types for the getAppValue function in the mock
57
-	 * @return string[]
58
-	 */
59
-	private function getResults(array $map, bool $federationEnabled = true) {
60
-		$config = $this->getMockBuilder(IConfig::class)->disableOriginalConstructor()->getMock();
61
-		$appManager = $this->getMockBuilder(IAppManager::class)->disableOriginalConstructor()->getMock();
62
-		$config->method('getAppValue')->willReturnMap($map);
63
-		$appManager->method('isEnabledForAnyone')->with('federation')->willReturn($federationEnabled);
64
-		$shareManager = new Manager(
65
-			$this->createMock(LoggerInterface::class),
66
-			$config,
67
-			$this->createMock(ISecureRandom::class),
68
-			$this->createMock(IHasher::class),
69
-			$this->createMock(IMountManager::class),
70
-			$this->createMock(IGroupManager::class),
71
-			$this->createMock(IFactory::class),
72
-			$this->createMock(IProviderFactory::class),
73
-			$this->createMock(IUserManager::class),
74
-			$this->createMock(IRootFolder::class),
75
-			$this->createMock(IMailer::class),
76
-			$this->createMock(IURLGenerator::class),
77
-			$this->createMock(\OC_Defaults::class),
78
-			$this->createMock(IEventDispatcher::class),
79
-			$this->createMock(IUserSession::class),
80
-			$this->createMock(KnownUserService::class),
81
-			$this->createMock(ShareDisableChecker::class),
82
-			$this->createMock(IDateTimeZone::class),
83
-			$this->createMock(IAppConfig::class),
84
-		);
85
-		$cap = new Capabilities($config, $shareManager, $appManager);
86
-		$result = $this->getFilesSharingPart($cap->getCapabilities());
87
-		return $result;
88
-	}
51
+    /**
52
+     * Create a mock config object and insert the values in $map to the getAppValue
53
+     * function. Then obtain the capabilities and extract the first few
54
+     * levels in the array
55
+     *
56
+     * @param (string[])[] $map Map of arguments to return types for the getAppValue function in the mock
57
+     * @return string[]
58
+     */
59
+    private function getResults(array $map, bool $federationEnabled = true) {
60
+        $config = $this->getMockBuilder(IConfig::class)->disableOriginalConstructor()->getMock();
61
+        $appManager = $this->getMockBuilder(IAppManager::class)->disableOriginalConstructor()->getMock();
62
+        $config->method('getAppValue')->willReturnMap($map);
63
+        $appManager->method('isEnabledForAnyone')->with('federation')->willReturn($federationEnabled);
64
+        $shareManager = new Manager(
65
+            $this->createMock(LoggerInterface::class),
66
+            $config,
67
+            $this->createMock(ISecureRandom::class),
68
+            $this->createMock(IHasher::class),
69
+            $this->createMock(IMountManager::class),
70
+            $this->createMock(IGroupManager::class),
71
+            $this->createMock(IFactory::class),
72
+            $this->createMock(IProviderFactory::class),
73
+            $this->createMock(IUserManager::class),
74
+            $this->createMock(IRootFolder::class),
75
+            $this->createMock(IMailer::class),
76
+            $this->createMock(IURLGenerator::class),
77
+            $this->createMock(\OC_Defaults::class),
78
+            $this->createMock(IEventDispatcher::class),
79
+            $this->createMock(IUserSession::class),
80
+            $this->createMock(KnownUserService::class),
81
+            $this->createMock(ShareDisableChecker::class),
82
+            $this->createMock(IDateTimeZone::class),
83
+            $this->createMock(IAppConfig::class),
84
+        );
85
+        $cap = new Capabilities($config, $shareManager, $appManager);
86
+        $result = $this->getFilesSharingPart($cap->getCapabilities());
87
+        return $result;
88
+    }
89 89
 
90
-	public function testEnabledSharingAPI(): void {
91
-		$map = [
92
-			['core', 'shareapi_enabled', 'yes', 'yes'],
93
-		];
94
-		$result = $this->getResults($map);
95
-		$this->assertTrue($result['api_enabled']);
96
-		$this->assertArrayHasKey('public', $result);
97
-		$this->assertArrayHasKey('user', $result);
98
-		$this->assertArrayHasKey('resharing', $result);
99
-	}
90
+    public function testEnabledSharingAPI(): void {
91
+        $map = [
92
+            ['core', 'shareapi_enabled', 'yes', 'yes'],
93
+        ];
94
+        $result = $this->getResults($map);
95
+        $this->assertTrue($result['api_enabled']);
96
+        $this->assertArrayHasKey('public', $result);
97
+        $this->assertArrayHasKey('user', $result);
98
+        $this->assertArrayHasKey('resharing', $result);
99
+    }
100 100
 
101
-	public function testDisabledSharingAPI(): void {
102
-		$map = [
103
-			['core', 'shareapi_enabled', 'yes', 'no'],
104
-		];
105
-		$result = $this->getResults($map);
106
-		$this->assertFalse($result['api_enabled']);
107
-		$this->assertFalse($result['public']['enabled']);
108
-		$this->assertFalse($result['user']['send_mail']);
109
-		$this->assertFalse($result['resharing']);
110
-	}
101
+    public function testDisabledSharingAPI(): void {
102
+        $map = [
103
+            ['core', 'shareapi_enabled', 'yes', 'no'],
104
+        ];
105
+        $result = $this->getResults($map);
106
+        $this->assertFalse($result['api_enabled']);
107
+        $this->assertFalse($result['public']['enabled']);
108
+        $this->assertFalse($result['user']['send_mail']);
109
+        $this->assertFalse($result['resharing']);
110
+    }
111 111
 
112
-	public function testNoLinkSharing(): void {
113
-		$map = [
114
-			['core', 'shareapi_enabled', 'yes', 'yes'],
115
-			['core', 'shareapi_allow_links', 'yes', 'no'],
116
-		];
117
-		$result = $this->getResults($map);
118
-		$this->assertIsArray($result['public']);
119
-		$this->assertFalse($result['public']['enabled']);
120
-	}
112
+    public function testNoLinkSharing(): void {
113
+        $map = [
114
+            ['core', 'shareapi_enabled', 'yes', 'yes'],
115
+            ['core', 'shareapi_allow_links', 'yes', 'no'],
116
+        ];
117
+        $result = $this->getResults($map);
118
+        $this->assertIsArray($result['public']);
119
+        $this->assertFalse($result['public']['enabled']);
120
+    }
121 121
 
122
-	public function testOnlyLinkSharing(): void {
123
-		$map = [
124
-			['core', 'shareapi_enabled', 'yes', 'yes'],
125
-			['core', 'shareapi_allow_links', 'yes', 'yes'],
126
-			['core', 'shareapi_enforce_links_password_excluded_groups', '', ''],
127
-		];
128
-		$result = $this->getResults($map);
129
-		$this->assertIsArray($result['public']);
130
-		$this->assertTrue($result['public']['enabled']);
131
-	}
122
+    public function testOnlyLinkSharing(): void {
123
+        $map = [
124
+            ['core', 'shareapi_enabled', 'yes', 'yes'],
125
+            ['core', 'shareapi_allow_links', 'yes', 'yes'],
126
+            ['core', 'shareapi_enforce_links_password_excluded_groups', '', ''],
127
+        ];
128
+        $result = $this->getResults($map);
129
+        $this->assertIsArray($result['public']);
130
+        $this->assertTrue($result['public']['enabled']);
131
+    }
132 132
 
133
-	public function testLinkPassword(): void {
134
-		$map = [
135
-			['core', 'shareapi_enabled', 'yes', 'yes'],
136
-			['core', 'shareapi_allow_links', 'yes', 'yes'],
137
-			['core', 'shareapi_enforce_links_password_excluded_groups', '', ''],
138
-			['core', 'shareapi_enforce_links_password', 'no', 'yes'],
139
-		];
140
-		$result = $this->getResults($map);
141
-		$this->assertArrayHasKey('password', $result['public']);
142
-		$this->assertArrayHasKey('enforced', $result['public']['password']);
143
-		$this->assertTrue($result['public']['password']['enforced']);
144
-	}
133
+    public function testLinkPassword(): void {
134
+        $map = [
135
+            ['core', 'shareapi_enabled', 'yes', 'yes'],
136
+            ['core', 'shareapi_allow_links', 'yes', 'yes'],
137
+            ['core', 'shareapi_enforce_links_password_excluded_groups', '', ''],
138
+            ['core', 'shareapi_enforce_links_password', 'no', 'yes'],
139
+        ];
140
+        $result = $this->getResults($map);
141
+        $this->assertArrayHasKey('password', $result['public']);
142
+        $this->assertArrayHasKey('enforced', $result['public']['password']);
143
+        $this->assertTrue($result['public']['password']['enforced']);
144
+    }
145 145
 
146
-	public function testLinkNoPassword(): void {
147
-		$map = [
148
-			['core', 'shareapi_enabled', 'yes', 'yes'],
149
-			['core', 'shareapi_allow_links', 'yes', 'yes'],
150
-			['core', 'shareapi_enforce_links_password_excluded_groups', '', ''],
151
-			['core', 'shareapi_enforce_links_password', 'no', 'no'],
152
-		];
153
-		$result = $this->getResults($map);
154
-		$this->assertArrayHasKey('password', $result['public']);
155
-		$this->assertArrayHasKey('enforced', $result['public']['password']);
156
-		$this->assertFalse($result['public']['password']['enforced']);
157
-	}
146
+    public function testLinkNoPassword(): void {
147
+        $map = [
148
+            ['core', 'shareapi_enabled', 'yes', 'yes'],
149
+            ['core', 'shareapi_allow_links', 'yes', 'yes'],
150
+            ['core', 'shareapi_enforce_links_password_excluded_groups', '', ''],
151
+            ['core', 'shareapi_enforce_links_password', 'no', 'no'],
152
+        ];
153
+        $result = $this->getResults($map);
154
+        $this->assertArrayHasKey('password', $result['public']);
155
+        $this->assertArrayHasKey('enforced', $result['public']['password']);
156
+        $this->assertFalse($result['public']['password']['enforced']);
157
+    }
158 158
 
159
-	public function testLinkNoExpireDate(): void {
160
-		$map = [
161
-			['core', 'shareapi_enabled', 'yes', 'yes'],
162
-			['core', 'shareapi_allow_links', 'yes', 'yes'],
163
-			['core', 'shareapi_default_expire_date', 'no', 'no'],
164
-			['core', 'shareapi_enforce_links_password_excluded_groups', '', ''],
165
-		];
166
-		$result = $this->getResults($map);
167
-		$this->assertArrayHasKey('expire_date', $result['public']);
168
-		$this->assertIsArray($result['public']['expire_date']);
169
-		$this->assertFalse($result['public']['expire_date']['enabled']);
170
-	}
159
+    public function testLinkNoExpireDate(): void {
160
+        $map = [
161
+            ['core', 'shareapi_enabled', 'yes', 'yes'],
162
+            ['core', 'shareapi_allow_links', 'yes', 'yes'],
163
+            ['core', 'shareapi_default_expire_date', 'no', 'no'],
164
+            ['core', 'shareapi_enforce_links_password_excluded_groups', '', ''],
165
+        ];
166
+        $result = $this->getResults($map);
167
+        $this->assertArrayHasKey('expire_date', $result['public']);
168
+        $this->assertIsArray($result['public']['expire_date']);
169
+        $this->assertFalse($result['public']['expire_date']['enabled']);
170
+    }
171 171
 
172
-	public function testLinkExpireDate(): void {
173
-		$map = [
174
-			['core', 'shareapi_enabled', 'yes', 'yes'],
175
-			['core', 'shareapi_allow_links', 'yes', 'yes'],
176
-			['core', 'shareapi_default_expire_date', 'no', 'yes'],
177
-			['core', 'shareapi_expire_after_n_days', '7', '7'],
178
-			['core', 'shareapi_enforce_expire_date', 'no', 'no'],
179
-			['core', 'shareapi_enforce_links_password_excluded_groups', '', ''],
180
-		];
181
-		$result = $this->getResults($map);
182
-		$this->assertArrayHasKey('expire_date', $result['public']);
183
-		$this->assertIsArray($result['public']['expire_date']);
184
-		$this->assertTrue($result['public']['expire_date']['enabled']);
185
-		$this->assertArrayHasKey('days', $result['public']['expire_date']);
186
-		$this->assertFalse($result['public']['expire_date']['enforced']);
187
-	}
172
+    public function testLinkExpireDate(): void {
173
+        $map = [
174
+            ['core', 'shareapi_enabled', 'yes', 'yes'],
175
+            ['core', 'shareapi_allow_links', 'yes', 'yes'],
176
+            ['core', 'shareapi_default_expire_date', 'no', 'yes'],
177
+            ['core', 'shareapi_expire_after_n_days', '7', '7'],
178
+            ['core', 'shareapi_enforce_expire_date', 'no', 'no'],
179
+            ['core', 'shareapi_enforce_links_password_excluded_groups', '', ''],
180
+        ];
181
+        $result = $this->getResults($map);
182
+        $this->assertArrayHasKey('expire_date', $result['public']);
183
+        $this->assertIsArray($result['public']['expire_date']);
184
+        $this->assertTrue($result['public']['expire_date']['enabled']);
185
+        $this->assertArrayHasKey('days', $result['public']['expire_date']);
186
+        $this->assertFalse($result['public']['expire_date']['enforced']);
187
+    }
188 188
 
189
-	public function testLinkExpireDateEnforced(): void {
190
-		$map = [
191
-			['core', 'shareapi_enabled', 'yes', 'yes'],
192
-			['core', 'shareapi_allow_links', 'yes', 'yes'],
193
-			['core', 'shareapi_default_expire_date', 'no', 'yes'],
194
-			['core', 'shareapi_enforce_expire_date', 'no', 'yes'],
195
-			['core', 'shareapi_enforce_links_password_excluded_groups', '', ''],
196
-		];
197
-		$result = $this->getResults($map);
198
-		$this->assertArrayHasKey('expire_date', $result['public']);
199
-		$this->assertIsArray($result['public']['expire_date']);
200
-		$this->assertTrue($result['public']['expire_date']['enforced']);
201
-	}
189
+    public function testLinkExpireDateEnforced(): void {
190
+        $map = [
191
+            ['core', 'shareapi_enabled', 'yes', 'yes'],
192
+            ['core', 'shareapi_allow_links', 'yes', 'yes'],
193
+            ['core', 'shareapi_default_expire_date', 'no', 'yes'],
194
+            ['core', 'shareapi_enforce_expire_date', 'no', 'yes'],
195
+            ['core', 'shareapi_enforce_links_password_excluded_groups', '', ''],
196
+        ];
197
+        $result = $this->getResults($map);
198
+        $this->assertArrayHasKey('expire_date', $result['public']);
199
+        $this->assertIsArray($result['public']['expire_date']);
200
+        $this->assertTrue($result['public']['expire_date']['enforced']);
201
+    }
202 202
 
203
-	public function testLinkSendMail(): void {
204
-		$map = [
205
-			['core', 'shareapi_enabled', 'yes', 'yes'],
206
-			['core', 'shareapi_allow_links', 'yes', 'yes'],
207
-			['core', 'shareapi_allow_public_notification', 'no', 'yes'],
208
-			['core', 'shareapi_enforce_links_password_excluded_groups', '', ''],
209
-		];
210
-		$result = $this->getResults($map);
211
-		$this->assertTrue($result['public']['send_mail']);
212
-	}
203
+    public function testLinkSendMail(): void {
204
+        $map = [
205
+            ['core', 'shareapi_enabled', 'yes', 'yes'],
206
+            ['core', 'shareapi_allow_links', 'yes', 'yes'],
207
+            ['core', 'shareapi_allow_public_notification', 'no', 'yes'],
208
+            ['core', 'shareapi_enforce_links_password_excluded_groups', '', ''],
209
+        ];
210
+        $result = $this->getResults($map);
211
+        $this->assertTrue($result['public']['send_mail']);
212
+    }
213 213
 
214
-	public function testLinkNoSendMail(): void {
215
-		$map = [
216
-			['core', 'shareapi_enabled', 'yes', 'yes'],
217
-			['core', 'shareapi_allow_links', 'yes', 'yes'],
218
-			['core', 'shareapi_allow_public_notification', 'no', 'no'],
219
-			['core', 'shareapi_enforce_links_password_excluded_groups', '', ''],
220
-		];
221
-		$result = $this->getResults($map);
222
-		$this->assertFalse($result['public']['send_mail']);
223
-	}
214
+    public function testLinkNoSendMail(): void {
215
+        $map = [
216
+            ['core', 'shareapi_enabled', 'yes', 'yes'],
217
+            ['core', 'shareapi_allow_links', 'yes', 'yes'],
218
+            ['core', 'shareapi_allow_public_notification', 'no', 'no'],
219
+            ['core', 'shareapi_enforce_links_password_excluded_groups', '', ''],
220
+        ];
221
+        $result = $this->getResults($map);
222
+        $this->assertFalse($result['public']['send_mail']);
223
+    }
224 224
 
225
-	public function testResharing(): void {
226
-		$map = [
227
-			['core', 'shareapi_enabled', 'yes', 'yes'],
228
-			['core', 'shareapi_allow_resharing', 'yes', 'yes'],
229
-			['core', 'shareapi_enforce_links_password_excluded_groups', '', ''],
230
-		];
231
-		$result = $this->getResults($map);
232
-		$this->assertTrue($result['resharing']);
233
-	}
225
+    public function testResharing(): void {
226
+        $map = [
227
+            ['core', 'shareapi_enabled', 'yes', 'yes'],
228
+            ['core', 'shareapi_allow_resharing', 'yes', 'yes'],
229
+            ['core', 'shareapi_enforce_links_password_excluded_groups', '', ''],
230
+        ];
231
+        $result = $this->getResults($map);
232
+        $this->assertTrue($result['resharing']);
233
+    }
234 234
 
235
-	public function testNoResharing(): void {
236
-		$map = [
237
-			['core', 'shareapi_enabled', 'yes', 'yes'],
238
-			['core', 'shareapi_allow_resharing', 'yes', 'no'],
239
-			['core', 'shareapi_enforce_links_password_excluded_groups', '', ''],
240
-		];
241
-		$result = $this->getResults($map);
242
-		$this->assertFalse($result['resharing']);
243
-	}
235
+    public function testNoResharing(): void {
236
+        $map = [
237
+            ['core', 'shareapi_enabled', 'yes', 'yes'],
238
+            ['core', 'shareapi_allow_resharing', 'yes', 'no'],
239
+            ['core', 'shareapi_enforce_links_password_excluded_groups', '', ''],
240
+        ];
241
+        $result = $this->getResults($map);
242
+        $this->assertFalse($result['resharing']);
243
+    }
244 244
 
245
-	public function testLinkPublicUpload(): void {
246
-		$map = [
247
-			['core', 'shareapi_enabled', 'yes', 'yes'],
248
-			['core', 'shareapi_allow_links', 'yes', 'yes'],
249
-			['core', 'shareapi_allow_public_upload', 'yes', 'yes'],
250
-			['core', 'shareapi_enforce_links_password_excluded_groups', '', ''],
251
-		];
252
-		$result = $this->getResults($map);
253
-		$this->assertTrue($result['public']['upload']);
254
-		$this->assertTrue($result['public']['upload_files_drop']);
255
-	}
245
+    public function testLinkPublicUpload(): void {
246
+        $map = [
247
+            ['core', 'shareapi_enabled', 'yes', 'yes'],
248
+            ['core', 'shareapi_allow_links', 'yes', 'yes'],
249
+            ['core', 'shareapi_allow_public_upload', 'yes', 'yes'],
250
+            ['core', 'shareapi_enforce_links_password_excluded_groups', '', ''],
251
+        ];
252
+        $result = $this->getResults($map);
253
+        $this->assertTrue($result['public']['upload']);
254
+        $this->assertTrue($result['public']['upload_files_drop']);
255
+    }
256 256
 
257
-	public function testLinkNoPublicUpload(): void {
258
-		$map = [
259
-			['core', 'shareapi_enabled', 'yes', 'yes'],
260
-			['core', 'shareapi_allow_links', 'yes', 'yes'],
261
-			['core', 'shareapi_allow_public_upload', 'yes', 'no'],
262
-			['core', 'shareapi_enforce_links_password_excluded_groups', '', ''],
263
-		];
264
-		$result = $this->getResults($map);
265
-		$this->assertFalse($result['public']['upload']);
266
-		$this->assertFalse($result['public']['upload_files_drop']);
267
-	}
257
+    public function testLinkNoPublicUpload(): void {
258
+        $map = [
259
+            ['core', 'shareapi_enabled', 'yes', 'yes'],
260
+            ['core', 'shareapi_allow_links', 'yes', 'yes'],
261
+            ['core', 'shareapi_allow_public_upload', 'yes', 'no'],
262
+            ['core', 'shareapi_enforce_links_password_excluded_groups', '', ''],
263
+        ];
264
+        $result = $this->getResults($map);
265
+        $this->assertFalse($result['public']['upload']);
266
+        $this->assertFalse($result['public']['upload_files_drop']);
267
+    }
268 268
 
269
-	public function testNoGroupSharing(): void {
270
-		$map = [
271
-			['core', 'shareapi_enabled', 'yes', 'yes'],
272
-			['core', 'shareapi_allow_group_sharing', 'yes', 'no'],
273
-		];
274
-		$result = $this->getResults($map);
275
-		$this->assertFalse($result['group_sharing']);
276
-	}
269
+    public function testNoGroupSharing(): void {
270
+        $map = [
271
+            ['core', 'shareapi_enabled', 'yes', 'yes'],
272
+            ['core', 'shareapi_allow_group_sharing', 'yes', 'no'],
273
+        ];
274
+        $result = $this->getResults($map);
275
+        $this->assertFalse($result['group_sharing']);
276
+    }
277 277
 
278
-	public function testGroupSharing(): void {
279
-		$map = [
280
-			['core', 'shareapi_enabled', 'yes', 'yes'],
281
-			['core', 'shareapi_allow_group_sharing', 'yes', 'yes'],
282
-		];
283
-		$result = $this->getResults($map);
284
-		$this->assertTrue($result['group_sharing']);
285
-	}
278
+    public function testGroupSharing(): void {
279
+        $map = [
280
+            ['core', 'shareapi_enabled', 'yes', 'yes'],
281
+            ['core', 'shareapi_allow_group_sharing', 'yes', 'yes'],
282
+        ];
283
+        $result = $this->getResults($map);
284
+        $this->assertTrue($result['group_sharing']);
285
+    }
286 286
 
287
-	public function testFederatedSharingIncoming(): void {
288
-		$map = [
289
-			['files_sharing', 'incoming_server2server_share_enabled', 'yes', 'yes'],
290
-		];
291
-		$result = $this->getResults($map);
292
-		$this->assertArrayHasKey('federation', $result);
293
-		$this->assertTrue($result['federation']['incoming']);
294
-	}
287
+    public function testFederatedSharingIncoming(): void {
288
+        $map = [
289
+            ['files_sharing', 'incoming_server2server_share_enabled', 'yes', 'yes'],
290
+        ];
291
+        $result = $this->getResults($map);
292
+        $this->assertArrayHasKey('federation', $result);
293
+        $this->assertTrue($result['federation']['incoming']);
294
+    }
295 295
 
296
-	public function testFederatedSharingNoIncoming(): void {
297
-		$map = [
298
-			['files_sharing', 'incoming_server2server_share_enabled', 'yes', 'no'],
299
-		];
300
-		$result = $this->getResults($map);
301
-		$this->assertArrayHasKey('federation', $result);
302
-		$this->assertFalse($result['federation']['incoming']);
303
-	}
296
+    public function testFederatedSharingNoIncoming(): void {
297
+        $map = [
298
+            ['files_sharing', 'incoming_server2server_share_enabled', 'yes', 'no'],
299
+        ];
300
+        $result = $this->getResults($map);
301
+        $this->assertArrayHasKey('federation', $result);
302
+        $this->assertFalse($result['federation']['incoming']);
303
+    }
304 304
 
305
-	public function testFederatedSharingOutgoing(): void {
306
-		$map = [
307
-			['files_sharing', 'outgoing_server2server_share_enabled', 'yes', 'yes'],
308
-		];
309
-		$result = $this->getResults($map);
310
-		$this->assertArrayHasKey('federation', $result);
311
-		$this->assertTrue($result['federation']['outgoing']);
312
-	}
305
+    public function testFederatedSharingOutgoing(): void {
306
+        $map = [
307
+            ['files_sharing', 'outgoing_server2server_share_enabled', 'yes', 'yes'],
308
+        ];
309
+        $result = $this->getResults($map);
310
+        $this->assertArrayHasKey('federation', $result);
311
+        $this->assertTrue($result['federation']['outgoing']);
312
+    }
313 313
 
314
-	public function testFederatedSharingNoOutgoing(): void {
315
-		$map = [
316
-			['files_sharing', 'outgoing_server2server_share_enabled', 'yes', 'no'],
317
-		];
318
-		$result = $this->getResults($map);
319
-		$this->assertArrayHasKey('federation', $result);
320
-		$this->assertFalse($result['federation']['outgoing']);
321
-	}
314
+    public function testFederatedSharingNoOutgoing(): void {
315
+        $map = [
316
+            ['files_sharing', 'outgoing_server2server_share_enabled', 'yes', 'no'],
317
+        ];
318
+        $result = $this->getResults($map);
319
+        $this->assertArrayHasKey('federation', $result);
320
+        $this->assertFalse($result['federation']['outgoing']);
321
+    }
322 322
 
323
-	public function testFederatedSharingExpirationDate(): void {
324
-		$result = $this->getResults([]);
325
-		$this->assertArrayHasKey('federation', $result);
326
-		$this->assertEquals(['enabled' => true], $result['federation']['expire_date']);
327
-		$this->assertEquals(['enabled' => true], $result['federation']['expire_date_supported']);
328
-	}
323
+    public function testFederatedSharingExpirationDate(): void {
324
+        $result = $this->getResults([]);
325
+        $this->assertArrayHasKey('federation', $result);
326
+        $this->assertEquals(['enabled' => true], $result['federation']['expire_date']);
327
+        $this->assertEquals(['enabled' => true], $result['federation']['expire_date_supported']);
328
+    }
329 329
 
330
-	public function testFederatedSharingDisabled(): void {
331
-		$result = $this->getResults([], false);
332
-		$this->assertArrayHasKey('federation', $result);
333
-		$this->assertFalse($result['federation']['incoming']);
334
-		$this->assertFalse($result['federation']['outgoing']);
335
-		$this->assertEquals(['enabled' => false], $result['federation']['expire_date']);
336
-		$this->assertEquals(['enabled' => false], $result['federation']['expire_date_supported']);
337
-	}
330
+    public function testFederatedSharingDisabled(): void {
331
+        $result = $this->getResults([], false);
332
+        $this->assertArrayHasKey('federation', $result);
333
+        $this->assertFalse($result['federation']['incoming']);
334
+        $this->assertFalse($result['federation']['outgoing']);
335
+        $this->assertEquals(['enabled' => false], $result['federation']['expire_date']);
336
+        $this->assertEquals(['enabled' => false], $result['federation']['expire_date_supported']);
337
+    }
338 338
 }
Please login to merge, or discard this patch.