Sulu\Bundle\MediaBundle\Collection\Manager\CollectionManager::getCurrentUser PHP Method

getCurrentUser() protected method

Returns the current user from the token storage.
protected getCurrentUser ( ) : Sulu\Component\Security\Authentication\UserInterface | null
return Sulu\Component\Security\Authentication\UserInterface | null
    protected function getCurrentUser()
    {
        if ($this->tokenStorage && ($token = $this->tokenStorage->getToken())) {
            $user = $token->getUser();
            if ($user instanceof UserInterface) {
                return $user;
            }
        }
        return;
    }