add a domain allow list

Created on 17 August 2022, over 2 years ago
Updated 25 August 2022, over 2 years ago

Problem/Motivation

ShURLy setting has a check box "Forbid URL target by custom pattern" with a regular expression to define the forbidden urls. My use case is to have a list/expression defining an allowed list (only domains/urls in the allowed list can be created)

Proposed resolution

Ideally we would have an allowed list (text area) with a list of allowed domains, or regex patterns to match against domains. If a long url domain is not on the list the short url ill not be created. Also have a permission to allow allowed role to bypass the domain restrictions.

✨ Feature request
Status

Needs review

Version

1.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States jrglasgow Idaho

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡ΊπŸ‡ΈUnited States scott_earnest

    Drupal 11 Compatibility

    New parameter added to \Drupal\Core\Form\ConfigFormBase::__construct
    Drupal change record: https://www.drupal.org/node/3404140 β†’

    On "ConfigFormBase", you now must pass "TypedConfigManagerInterface" in the __construct function

    page "/admin/config/search/shurly/settings/domains" throws error:

    ArgumentCountError: Too few arguments to function Drupal\Core\Form\ConfigFormBase::__construct(), 1 passed in /app/docroot/modules/contrib/shurly/shurly_domains/src/Form/ShurlyDomainsSettings.php on line 18 and exactly 2 expected in Drupal\Core\Form\ConfigFormBase->__construct() (line 43 of core/lib/Drupal/Core/Form/ConfigFormBase.php).

    New patch for D11:
    shurly_domain_D11-3304340-6.diff β†’

  • πŸ‡ΊπŸ‡ΈUnited States scott_earnest

    Testing Steps

    Visit the Shurly Domain settings:
    - /admin/config/search/shurly/settings/domains

    As a site administrator, add regex domain patterns in the "Allowed Domains" field, for example:

    .*\.gov$
    .*\.mil$
    

    As a site "user" try to add a domain that is not supported, like "www.google.com"

    Verify that the "Custom error message" from the Shurly Domains settings is displayed.

    Either add the appropriate pattern to the allowed domains or try to enter a valid domain.

    Verify that the domain is added successfully.

    RTBC +1

Production build 0.71.5 2024