public function getAvailableSites()
    {
        $sites = array();
        $token = $this->tokenStorage->getToken();
        if ($token instanceof TokenInterface) {
            if ($this->authorizationChecker->isGranted(ContributionRoleInterface::PLATFORM_ADMIN)) {
                return $this->siteRepository->findByDeleted(false);
            }

            if (($user = $token->getUser()) instanceof GroupableInterface) {
                foreach ($user->getGroups() as $group) {
                    /** @var SiteInterface $site */
                    $site = $group->getSite();
                    if (null !== $site && !$group->isDeleted() && !$site->isDeleted()) {
                        $sites[$site->getId()] = $site;
                    }
                }
            }
        }

        return $sites;
    }
public function getAvailableSites()
    {
        $sites = array();
        $token = $this->tokenStorage->getToken();
        if ($token instanceof TokenInterface) {
            if ($this->authorizationChecker->isGranted(ContributionRoleInterface::PLATFORM_ADMIN)) {
                return $this->siteRepository->findByDeleted(false);
            }

            if (($user = $token->getUser()) instanceof GroupableInterface) {
                foreach ($user->getGroups() as $group) {
                    /** @var SiteInterface $site */
                    $site = $group->getSite();
                    if (null !== $site && !$group->isDeleted() && !$site->isDeleted()) {
                        $sites[$site->getId()] = $site;
                    }
                }
            }
        }

        return $sites;
    }
public function getAvailableSites ( ) { $ sites = array ( ) ; $ token = $ this -> tokenStorage -> getToken ( ) ; if ( $ token instanceof TokenInterface ) { if ( $ this -> authorizationChecker -> isGranted ( ContributionRoleInterface :: PLATFORM_ADMIN ) ) { return $ this -> siteRepository -> findByDeleted ( false ) ; } if ( ( $ user = $ token -> getUser ( ) ) instanceof GroupableInterface ) { foreach ( $ user -> getGroups ( ) as $ group ) { /** @var SiteInterface $site */ $ site = $ group -> getSite ( ) ; if ( null !== $ site && ! $ group -> isDeleted ( ) && ! $ site -> isDeleted ( ) ) { $ sites [ $ site -> getId ( ) ] = $ site ; } } } } return $ sites ; }
Get availables sites on platform

@return array<SiteInterface>
Get availables sites on platform