, array{}> * @throws OCSBadRequestException Updating visibility is not possible * @throws OCSForbiddenException Not allowed to edit other users visibility * @throws OCSNotFoundException Account not found * * 200: Visibility updated successfully */ #[NoAdminRequired] #[PasswordConfirmationRequired] #[UserRateLimit(limit: 40, period: 600)] #[ApiRoute(verb: 'PUT', url: '/{targetUserId}', root: '/profile')] public function setVisibility(string $targetUserId, string $paramId, string $visibility): DataResponse { $requestingUser = $this->userSession->getUser(); $targetUser = $this->userManager->get($targetUserId); if (!$this->userManager->userExists($targetUserId)) { throw new OCSNotFoundException('Account does not exist'); } if ($requestingUser !== $targetUser) { throw new OCSForbiddenException('People can only edit their own visibility settings'); } // Ensure that a profile config is created in the database $this->profileManager->getProfileConfig($targetUser, $targetUser); $config = $this->configMapper->get($targetUserId); if (!in_array($paramId, array_keys($config->getVisibilityMap()), true)) { throw new OCSBadRequestException('Account does not have a profile parameter with ID: ' . $paramId); } $config->setVisibility($paramId, $visibility); $this->configMapper->update($config); return new DataResponse(); } }