Drupal is a registered trademark of Dries Buytaert
Protected Pages 3.0.0 Major update available for module protected_pages (3.0.0). Commerce Core 3.3.8 Minor update available for module commerce (3.3.8). Search API HTML Element Filter 1.0.7 Minor update available for module search_api_html_element_filter (1.0.7). Layout Builder Reorder 2.0.1 Minor update available for module layout_builder_reorder (2.0.1). Ban 1.1.0 Minor update available for module ban (1.1.0). Field Formatter Range 2.0.0 Major update available for module field_formatter_range (2.0.0). Field Formatter Range 8.x-1.8 Minor update available for module field_formatter_range (8.x-1.8). Varbase Media Header 9.2.1 Minor update available for module varbase_media_header (9.2.1). Search API Solr 4.3.11 Module search_api_solr updated after 14 months of inactivity (4.3.11). Content Translation Redirect Module content_translation_redirect crossed 1,000 active installs.

This module restricts access to specific pages for anonymous and authenticated users. You can configure custom rules to manage access based on user navigation sequences, redirecting users to designated pages if they haven't followed the expected path. It also allows for role-based bypasses and programmatic control over access restrictions.

Module to restrict access from anonymous and regular users to configured pre-defined pages.
Into the /admin/config/pages_restriction/restrict_access configuration page it's possible to setup custom rules to provide access restriction for anonymous and regular users.
Was setup a custom session id to each form rule so we check if the page that user must be redirected depending on user's registering sequence.

Example: homepage|about-us will block access to about-us page and redirect users to homepage.

To possible use the current session id to enable access for multiple pages we need to setup into the form submission the function _pages_restriction_set_next_page_path($next_page_path) where $next_page_path variable should be the current_path();

Example: homepage|about-us|contact|thank-you-page

If you try to access directly the Thank you page without fill all the forms flows and without setup the set_next_page_path() into the previous pages form submit, ("About Us"), ("Contact"), you should be redirected back to the Homepage.

Author: Vitor Grillo

Drupal 8

There is a field to configure your paths using key|value syntax.

You can also configure the roles you want to bypass as the image below:

Bypass

To ignore a path at runtime you can add a bypass with the setBypass function:

\Drupal::service('pages_restriction.session_service')->setBypass($path);

Or if you prefer you can set the "pages_restriction_bypass" session manually. E.g:

$pagesRestrictionBypass[] = $path;
$this->session->set('pages_restriction_bypass', $pagesRestrictionBypass);

Credits


http://www.ciandt.com

Activity

Total releases
1
First release
Dec 2024
Latest release
1 year ago
Releases (12 mo)
0 ▼ from 1
Maintenance
Dormant

Releases

Version Type Release date
2.0.3 Stable Dec 4, 2024