Code Duplication    Length = 8-8 lines in 4 locations

apps/dav/lib/Connector/Sabre/Principal.php 2 locations

@@ 226-233 (lines=8) @@
223
		// If sharing is restricted to group members only,
224
		// return only members that have groups in common
225
		$restrictGroups = false;
226
		if ($this->shareManager->shareWithGroupMembersOnly()) {
227
			$user = $this->userSession->getUser();
228
			if (!$user) {
229
				return [];
230
			}
231
232
			$restrictGroups = $this->groupManager->getUserGroupIds($user);
233
		}
234
235
		foreach ($searchProperties as $prop => $value) {
236
			switch ($prop) {
@@ 328-335 (lines=8) @@
325
		// If sharing is restricted to group members only,
326
		// return only members that have groups in common
327
		$restrictGroups = false;
328
		if ($this->shareManager->shareWithGroupMembersOnly()) {
329
			$user = $this->userSession->getUser();
330
			if (!$user) {
331
				return null;
332
			}
333
334
			$restrictGroups = $this->groupManager->getUserGroupIds($user);
335
		}
336
337
		if (strpos($uri, 'mailto:') === 0) {
338
			if ($principalPrefix === 'principals/users') {

apps/dav/lib/DAV/GroupPrincipalBackend.php 2 locations

@@ 204-211 (lines=8) @@
201
		// If sharing is restricted to group members only,
202
		// return only members that have groups in common
203
		$restrictGroups = false;
204
		if ($this->shareManager->shareWithGroupMembersOnly()) {
205
			$user = $this->userSession->getUser();
206
			if (!$user) {
207
				return [];
208
			}
209
210
			$restrictGroups = $this->groupManager->getUserGroupIds($user);
211
		}
212
213
		foreach ($searchProperties as $prop => $value) {
214
			switch ($prop) {
@@ 269-276 (lines=8) @@
266
		// If sharing is restricted to group members only,
267
		// return only members that have groups in common
268
		$restrictGroups = false;
269
		if ($this->shareManager->shareWithGroupMembersOnly()) {
270
			$user = $this->userSession->getUser();
271
			if (!$user) {
272
				return null;
273
			}
274
275
			$restrictGroups = $this->groupManager->getUserGroupIds($user);
276
		}
277
278
		if (strpos($uri, 'principal:principals/groups/') === 0) {
279
			$name = urlencode(substr($uri, 28));