Problem/Motivation

I need to retrict the access to specific external URLs to Authenticated users.
However - when I try to configure URL Restriction by Role (/admin/config/search/path/url-restriction-by-role) I get an error when pressing save if it's anything but an internal URL ("The website encountered an unexpected error. Try again later.") See attached files.

Steps to reproduce

  1. Install and enable Url Restriction by Role
  2. Go to configuration (/admin/config/search/path/url-restriction-by-role)
  3. Enter external URL - ex. http://microsoft.com
  4. Press Save configuration

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

claudiadesiderio made their first commit to this issue’s fork.

claudiadesiderio’s picture

Good afternoon mogens.lynnerup@gmail.com,

Thank you for your feedback.
After analysing your report, we verified that an error was indeed being generated when attempting to submit the form if the URL contained a dot. This error has already been resolved, as we have added a new validation that prevents this error in the latest version of our module.

However, our module is not designed to restrict access to external URLs, as it only acts on the URLs of the website on which it is installed, as can be seen in our description.

Therefore, we suggest some possibilities for what you want to do:

  • Visual blocking through twig
  • Creating a Route subscriber
  • Or with a more archaic and less recommended alternative, which would be to create a specific permission for accessing external links. This permission would then have to work in conjunction with custom code that would prevent users from accessing these links.

It should be noted that either of these alternatives will only be effective if accessed through the website itself and will not completely block these links.

Kind regards,
Cláudia Desidério

claudiadesiderio’s picture

Version: 2.0.0 » 2.0.1
Component: User interface » Code
Assigned: Unassigned » claudiadesiderio
Status: Active » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

claudiadesiderio’s picture

Status: Fixed » Closed (fixed)