groupManager = $groupManager; $this->config = $config; } #[\Override] public function getNamespace(): string { return $this->namespace; } #[\Override] public function search(string $term): array { $c1 = $this->config->getAppValue('core', 'shareapi_allow_group_sharing', 'yes'); $c2 = $this->config->getAppValue('core', 'shareapi_only_share_with_group_members', 'no'); if ($c1 !== 'yes' || $c2 !== 'no') { return []; } $groups = $this->groupManager->search($term); return array_map( static fn ($g) => [ 'id' => $g->getGID(), 'name' => $g->getDisplayName() ], $groups ); } #[\Override] public function getUsers(string $groupId): array { if (!$this->groupManager->groupExists($groupId)) { throw new ServiceException("$groupId ({$this->getNamespace()}) does not exist"); } $users = $this->groupManager->get($groupId)->getUsers(); return array_map( static fn ($user) => [ 'id' => $user->getUID(), 'name' => $user->getDisplayName(), 'email' => $user->getEMailAddress() ], $users ); } }