Skip to content

Drupal 10 Context module to control access to content based on user's IP address

License

Notifications You must be signed in to change notification settings

FLVC/ip_range_access

 
 

Repository files navigation

IP Range Access

Introduction

Drupal 10 Module that provides a Context Condition that checks the user's IP address, and a Context Reaction that denies access to nodes and media. If the Reaction executes, it returns a 403 Access Denied response to the user (or optionally redirect them to a proxy to authenticate before accessing the resource).

This module's primary use case was to provide IP access control to Islandora content, but it can be used without Islandora.

Requirements

Installation

  1. Clone this repo into your Islandora's drupal/web/modules/contrib directory.
  2. Enable the module either under the "Admin > Extend" menu or by running drush en -y ip_range_access.

Configuration

The Condition and Reaction are independent of each other (Context FTW!) but if your intent is to block a user from accessing content based on their IP address, do the following:

  1. Create a Context and choose the "User's IP address" Condition.
  2. Enter the ranges or individual IP addresses from where access is prohibited.
  3. (Optional) Add additional Conditions ("Node has parent", "Node has term", "User role", etc.). You probably want to add the "User's Role" condition to make sure that administrators aren't blocked from accessing content.
  4. Choose the "Deny access to node or media" Reaction and check the box.
    • (Optional) Add the URL of a proxy, such as Ezproxy, to the reaction's configuration, e.g., https://proxy.example.com/login?url=.

To do

See issue list.

Current maintainer

Contributing

Bug reports, improvements, feature requests, and PRs welcome. Before you open a pull request, please open an issue.

License

GPLv2

About

Drupal 10 Context module to control access to content based on user's IP address

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • PHP 100.0%