Find all user sub accounts

@param string $appUserId
@return \Doctrine\Common\Collections\ArrayCollection
332092
public function findAll($appUserId)
    {
        $url = sprintf('users/%s/subaccounts/', $appUserId);
        return $this->getAll($url, $this->entityClassName);
    }
90737
public function getAll($appId = null, array $queryParams = [])
    {
        $response = $this->api->applications()->profiles()->getAll($appId, $queryParams);

        return new ProfilesResponse($response);
    }
1190770
public function findGmailUserById(string $userId)
    {
        foreach ($this->gmailUsers as $user) {
            /** @var GmailUserInterface $user */
            if ($user->getUserId() === $userId) {
                return $user;
            }
        }

        return;
    }
503636
protected function getDirectPermissionsByUser($userId)
	{
		$assignments = $this->domain->assignment->getAssignments($userId);
		return ItemHelper::allPermissionsByAssignments($this->items, $assignments);
	}
646142
public function fetchUserForSession($userId) {
        $select = $this->select()
            ->from($this->getName(), Garp_Auth::getInstance()->getSessionColumns())
            ->where('id = ?', $userId);
        return $this->fetchRow($select);
    }
30734
protected function getUser4Id($userId): ?UserInterface
    {
        /** @var \PServerCore\Entity\Repository\User $userRepository */
        $userRepository = $this->entityManager->getRepository($this->entityOptions->getUser());

        return $userRepository->getUser4Id($userId);
    }
812221
public function getAll($appId, $profileId, array $queryParams)
    {
        $response = $this->api->applications()->profiles()->sanitizers()->getAll($appId, $profileId, $queryParams);

        return new SanitizersResponse($response);
    }
981600
public static function getWardForUser($userId)
    {
        $entityManager = (object) DoctrineBootstrap::getEntityManager();
        $user = $entityManager->getRepository('Hospitalplugin\Entities\User')->findOneById($userId);
        return $user->getWard();
    }
201324
public function findAllByGroupId( $userGroupId )
    {
        $platform = $this->getDbAdapter()
                         ->getPlatform();

        /* @var $from \Zork\Db\Sql\TableIdentifier */
        $from = $this->getTableInSchema( 'user_right_x_user_group' );

        if ( $from instanceof TableIdentifier )
        {
            $from = $from->getIdentifierChain();
        }
        else
        {
            $from = (array) (string) $from;
        }

        return $this->findAll( array(
            new Expression( $platform->quoteIdentifier( 'id' ) . ' IN (
                SELECT ' . $platform->quoteIdentifier( 'rightId' ) . '
                  FROM ' . $platform->quoteIdentifierChain( $from ) . '
                 WHERE ' . $platform->quoteIdentifier( 'groupId' ) . ' = ?
            )', $userGroupId ),
        ) );
    }
904764
public function getUserTypeEntities($entityId = false) {
        if (!empty($entityId)) {
            $filter = is_array($entityId) ? $entityId : array(
                'ENTITY_ID' => $entityId
            );
        } else {
            $filter = array();
        }


        /** @noinspection PhpDynamicAsStaticMethodCallInspection */
        $dbres = \CUserTypeEntity::GetList(array(), $filter);
        $result = array();
        while ($item = $dbres->Fetch()) {
            $result[] = $this->getUserTypeEntityById($item['ID']);

        }
        return $result;
    }
181552
public static function get_children_of_user($userid) {
        global $DB;

        // Get users that the user has role assignments to.
        $allusernames = get_all_user_name_fields(true, 'u');
        $sql = "SELECT u.id, $allusernames
                  FROM {role_assignments} ra, {context} c, {user} u
                 WHERE ra.userid = :userid
                       AND ra.contextid = c.id
                       AND c.instanceid = u.id
                       AND c.contextlevel = :contextlevel";
        $params = [
            'userid' => $userid,
            'contextlevel' => CONTEXT_USER
        ];

        // The final list of users that we will return.
        $finalresults = [];

        // Our prospective list of users.
        if ($candidates = $DB->get_records_sql($sql, $params)) {
            foreach ($candidates as $key => $child) {
                $childcontext = \context_user::instance($child->id);
                if (has_capability('tool/dataprivacy:makedatarequestsforchildren', $childcontext, $userid)) {
                    $finalresults[$key] = $child;
                }
            }
        }
        return $finalresults;
    }
161828
public function update($appUserId, BankAccount $bankAccount)
    {
        $url = sprintf('users/%s/bankaccounts/%s', $appUserId, $bankAccount->getId());
        return $this->updateObject($url, $bankAccount);
    }
801006
public function setAppId($appId = null)
    {
        return $this->set($this->appIdColumn, $appId ?: wei()->app->getId());
    }
1062151
public function syncMappingUser(int $userId): array
    {
        return $this->getApi()->request($this->getApi()->sprintf('/admin/ldap/user/:user_id/sync', (string)$userId),
            Request::METHOD_POST);
    }
577967
public function GetByUserID($UserID) {
      return $this->SQL->Select()
         ->From('Role')
         ->Join('UserRole', 'Role.RoleID = UserRole.RoleID')
         ->Where('UserRole.UserID', $UserID)
         ->Get();
   }
131142
protected function _getUserEntity($userId) {
		if (is_a($userId, EntityInterface::class)) {
			return $userId;
		}

		if (is_string($userId) || is_integer($userId)) {
			$entity = $this->UserTable->newEntity();

			return $this->UserTable->patchEntity(
				$entity,
				[$this->UserTable->primaryKey() => $userId],
				['guard' => false]
			);
		}

		if (is_array($userId)) {
			$entity = $this->UserTable->newEntity();

			return $this->UserTable->patchEntity(
				$entity,
				$userId,
				['guard' => false]
			);
		}
	}
1009844
public function deleteUser($userId)
    {
        try {
            return $this->innerGateway->deleteUser($userId);
        } catch (DBALException $e) {
            throw new RuntimeException('Database error', 0, $e);
        } catch (PDOException $e) {
            throw new RuntimeException('Database error', 0, $e);
        }
    }