Open Webform in a modal, but deny access to the form url
Not sure if its the best way but I had something similar to do to allow viewing an entity only on a specified route and if some other conditions were met.
I created an EventSubscriber which basically decides if the user is allowed to access the page or not.
&lt;?php

namespace Drupal\MY_CUSTOM_MODULE\EventSubscriber;

use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpKernel\KernelEvents;
use Symfony\Component\HttpKernel\Event\GetResponseEvent;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;

/**
 * Custom class RedirectSubscriber.
 */
class RedirectSubscriber implements EventSubscriberInterface {

  /**
   * Custom function to check if we should redirect.
   */
  public function checkForRedirection(GetResponseEvent $event) {

    $route = \Drupal::routeMatch()-&gt;getRouteName();

    // If route is group add form.
    if (isset($route) &amp;&amp; $route == &quot;entity.group.add_form&quot;) {
      if (&quot;MY CONDITION IS NOT MET&quot;) {
        //REDIRECT OR DO SOMETHING ELSE
        $event-&gt;setResponse(new RedirectResponse('/random-page url'));
      }
    }
  }

  /**
   * {@inheritdoc}
   */
  public static function getSubscribedEvents() {
    return [
      KernelEvents::REQUEST =&gt; 'checkForRedirection',
    ];
  }

}

Also, if you decide to do this, don't forget to register your event subscriber in the services.yml file.
services:
  MY_CUSTOM_MODULE_redirect_event_subscriber:
    class: Drupal\MY_CUSTOM_MODULE\EventSubscriber\RedirectSubscriber
    tags:
      - {name: event_subscriber}