Commit efb904b0 authored by Blaize Kaye's avatar Blaize Kaye
Browse files

Issue #3276516 by bomoko: FSA is adding non-FSA users to the ACL

parent 1460efa3
Loading
Loading
Loading
Loading
+13 −6
Original line number Diff line number Diff line
@@ -46,7 +46,10 @@ class FsaEventSubscriber implements EventSubscriberInterface {
   * @param \Drupal\Core\Session\AccountProxy $currentUser
   *   The account proxy service.
   */
  public function __construct(ConfigFactoryInterface $configFactory, AccountProxy $currentUser) {
  public function __construct(
    ConfigFactoryInterface $configFactory,
    AccountProxy $currentUser
  ) {
    $this->currentUser = $currentUser;
    $this->config = $configFactory;
  }
@@ -110,7 +113,8 @@ class FsaEventSubscriber implements EventSubscriberInterface {
   * @return array|mixed|null
   */
  protected function getStandardAclName() {
    return $this->config->get('fastly_streamline_access.settings')->get('acl_name');;
    return $this->config->get('fastly_streamline_access.settings')
      ->get('acl_name');;
  }

  /**
@@ -190,10 +194,13 @@ class FsaEventSubscriber implements EventSubscriberInterface {
   * React to an FSA triggered event
   */
  public function fsaResponse() {
    if ($this->currentUser->hasPermission('access protected lagoon routes')) {
      try {
        $this->addIpToACL();
      } catch (\Exception $exception) {
      \Drupal::logger('fastly_streamline_access')->error($exception->getMessage());
        \Drupal::logger('fastly_streamline_access')
          ->error($exception->getMessage());
      }
    }
  }

@@ -204,8 +211,7 @@ class FsaEventSubscriber implements EventSubscriberInterface {
   *   Config crud event.
   */
  public function pageResponse(FilterResponseEvent $event) {
    if ($this->currentUser->hasPermission('access protected lagoon routes') &&
      in_array(
    if (in_array(
      \Drupal::routeMatch()
        ->getRouteName(),
      self::FSA_TRIGGER_ROUTES
@@ -213,7 +219,8 @@ class FsaEventSubscriber implements EventSubscriberInterface {
      try {
        $this->fsaResponse();
      } catch (\Exception $exception) {
        \Drupal::logger('fastly_streamline_access')->error($exception->getMessage());
        \Drupal::logger('fastly_streamline_access')
          ->error($exception->getMessage());
      }
    }
  }