Skip to content

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

Open

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions