circles icon indicating copy to clipboard operation
circles copied to clipboard

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

Open viniciuscb opened this issue 7 years ago • 2 comments

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?

viniciuscb avatar Nov 12 '18 14:11 viniciuscb

This feature would be very useful. I sent a pull request for an auditing feature and I already have other demands to improve it, allowing notification (via app activity) of file sharing for all members of a closed circle. But to create this new feature, I need to recover all members of circle. Today, I get notify only admin.

fgsl avatar Nov 27 '18 14:11 fgsl

@viniciuscb I think this is fixed, right ?

ArtificialOwl avatar Apr 15 '19 15:04 ArtificialOwl