nextcloud / nextcloud/circles

create internal function to get all members of circle, independent of current logged-in user

Open
#250 2 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

1. to develop bug
Dominant language
JavaScript
Stars
177
Forks
68
Avg merge
2d 22h
Merged PRs (30d)
60

Description

Every time I need to get all the members of a circle I need to set the current User as the circle owner, and then get all members.

			$origUser = $this->userSession->getUser();
			foreach ($circles as $circleId) {
				try {
					$circle = \OCA\Circles\Api\v1\Circles::detailsCircle($circleId);
					$this->userSession->setUser($this->userManager->get($circle->getOwner()->getUserId()));
					$circle = \OCA\Circles\Api\v1\Circles::detailsCircle($circleId);
					$members = $circle->getMembers();
					foreach ($members as $member) {
						$users[] = $member->getUserId();
					}
				} catch (QueryException $e) {
				}
			}
			$this->userSession->setUser($origUser);

I needed to do this several times, in an implementation of calendar reminders to circle members and also in circle -> matrix integration. Is there a way in the api to query for all circle members, independently of the current logged-in user? If not yet, can one be created?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the API entry point \OCA\Circles\Api\v1\Circles::detailsCircle and trace how getMembers() is restricted by the current user. Compare that flow with the session-switching example in the issue. Done means an internal API path can retrieve all members of a circle without changing the logged-in user, supporting the calendar-reminder and Matrix integration use cases.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
api, backend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.