aboutsummaryrefslogtreecommitdiffstats
path: root/apps/testing/lib/HiddenGroupBackend.php
blob: 96ead46c06e328915b7dc9f0298fa6354dd9dec8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<?php

declare(strict_types=1);

/**
 * SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors
 * SPDX-License-Identifier: AGPL-3.0-or-later
 */

namespace OCA\Testing;

use OCP\Group\Backend\ABackend;
use OCP\Group\Backend\IHideFromCollaborationBackend;

class HiddenGroupBackend extends ABackend implements IHideFromCollaborationBackend {
	public function __construct(
		private string $groupName = 'hidden_group',
	) {
	}

	public function inGroup($uid, $gid): bool {
		return false;
	}

	public function getUserGroups($uid): array {
		return [];
	}

	public function getGroups($search = '', $limit = -1, $offset = 0): array {
		return $offset === 0 ? [$this->groupName] : [];
	}

	public function groupExists($gid): bool {
		return $gid === $this->groupName;
	}

	public function usersInGroup($gid, $search = '', $limit = -1, $offset = 0): array {
		return [];
	}

	public function hideGroup(string $groupId): bool {
		return true;
	}
}