mirror of
https://github.com/LdesignMedia/moodle-availability_ipaddress.git
synced 2026-10-22 19:18:06 +02:00
06a5f9c8c901032f7813b7b3310cc98456b6a34e
The custom IP field and the predefined ranges form accepted invalid entries such as 2001:db8::1garbage, 192.168.1.0/24garbage or 192.168.1.0/999. address_in_subnet() silently skips those entries, so a "must not" restriction with a typo let blocked users in. Validation now only accepts formats address_in_subnet() can match: a single address, a subnet (mask 0-32 / 0-128) or a range in the last group with end >= start. IPv6 forms cleanremoteaddr() cannot parse are rejected as well. JS and PHP share the same rules; PHP also checks each entry against address_in_subnet() as a safety net. - Allow spaces after commas in the restriction field - Support IPv6 ranges, e.g. 2001:db8::1-ff - Add PHPUnit tests for helper::is_valid_ipaddress_list() - Bump version to 2026101500 (5.3.2)
Moodle - availability ip address plugin
Enhance activity security by restricting access based on IP address. This plugin allows you to control the availability of any chosen activity, making it accessible only to users from specified IP addresses.
Author
- Author: Luuk Verhoeven, ldesignmedia.nl
- Author: Vincent Cornelis, ldesignmedia.nl
- Min. required: Moodle 4.0
- Supports PHP: 7.3+
List of features
- Supports comma separate list of ip-addresses
- Subnet support, eg 192.168.1.0/24
- Inline ip-address validation
- Turning on/off with eye icon, without losing the input value.
Installation
- Copy this plugin to the
availability\condition\ipaddressfolder on the server - Login as administrator
- Go to Site Administrator > Notification
- Install the plugin
Usage
- Add or edit an activity in a Moodle course.
- Go to the section "Restrict access"
- Click IP address in the modal
- There's a new input field that supports a list of comma separated ip address e.g. 127.0.0.1, 192.168.1.0/24
- The users with matching ip addresses can view the activity.
- Save the activity
Security
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
License
The GNU GENERAL PUBLIC LICENSE. Please see License File for more information.
Contributing
Contributions are welcome and will be fully credited. We accept contributions via Pull Requests on Github.
Changelog
See CHANGELOG.md for a full list of changes.
Languages
PHP
100%