Skip to main content
Drupal is a registered trademark of Dries Buytaert
Release: OpenID Connect / OAuth client 3.0.0-alpha9 New alpha version released for module openid_connect (3.0.0-alpha9). Release: Opensolr Search 4.5.0 Minor update available for module opensolr_search (4.5.0). Release: Timelinr 1.0.1 Minor update available for module timelinr (1.0.1). Usage Milestone: Simplify Module simplify crossed 10,000 active installs. Usage Milestone: Views Reference Filter Module entityreference_filter crossed 10,000 active installs. Usage Milestone: Dropdown Language Module dropdown_language crossed 10,000 active installs. Usage Milestone: Paragraphs Browser Module paragraphs_browser crossed 10,000 active installs. Usage Milestone: OpenAPI Module openapi crossed 10,000 active installs. Usage Milestone: Decoupled Router Module decoupled_router crossed 10,000 active installs. Module Revived: Entityqueue Buttons 1.1.2 Module entityqueue_buttons updated after 8 months of inactivity (1.1.2).

Pages Restriction Access

1,424 sites Security covered Drupal 8–11
View on drupal.org

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

Depends on

Dependencies of the latest stable release

  • system Drupal core >= 8.5

Required by

Tracked projects that depend on this one

No tracked projects depend on this one yet.

Activity

Tracked releases
2
Tracked since
Dec 2024
Latest release
1 year ago
Releases (12 mo)
0 ▼ from 2
Maintenance
Dormant

Releases

Version Type Core Release date
2.0.3 Stable 8–11 Dec 4, 2024
2.0.2 Stable 8–11 Dec 3, 2024