You are here

class PagesRestrictionSessionService in Pages Restriction Access 8

Pages Restriction Session Service.

Hierarchy

Expanded class hierarchy of PagesRestrictionSessionService

1 string reference to 'PagesRestrictionSessionService'
pages_restriction.services.yml in ./pages_restriction.services.yml
pages_restriction.services.yml
1 service uses PagesRestrictionSessionService
pages_restriction.session_service in ./pages_restriction.services.yml
Drupal\pages_restriction\Service\PagesRestrictionSessionService

File

src/Service/PagesRestrictionSessionService.php, line 10

Namespace

Drupal\pages_restriction\Service
View source
class PagesRestrictionSessionService {

  /**
   * Symfony session handler.
   *
   * @var \Symfony\Component\HttpFoundation\Session\Session
   */
  private $session;

  /**
   * {@inheritdoc}
   */
  public function __construct(Session $session) {
    $this->session = $session;
  }

  /**
   * Set Bypass.
   */
  public function setBypass($path) {

    // Get current bypass values.
    $pages_restriction_bypass = $this->session
      ->get('pages_restriction_bypass');

    // Set next URL on bypass session.
    $pages_restriction_bypass[] = $path;

    // Update Bypass Session.
    $this->session
      ->set('pages_restriction_bypass', $pages_restriction_bypass);

    // Return Bypass Session.
    return $pages_restriction_bypass;
  }

}

Members