diff --git a/README.md b/README.md index ea97708..b72f5e5 100644 --- a/README.md +++ b/README.md @@ -16,9 +16,9 @@ Restrict access to any activity by ip-address. This plugin can be used to make a ![Moodle38](https://img.shields.io/badge/moodle-3.8-brightgreen.svg) ![Moodle39](https://img.shields.io/badge/moodle-3.9-brightgreen.svg) ![Moodle310](https://img.shields.io/badge/moodle-3.10-brightgreen.svg) +![Moodle40](https://img.shields.io/badge/moodle-4.00-brightgreen.svg) ![PHP7.2](https://img.shields.io/badge/PHP-7.2-brightgreen.svg) - -![Screenshot](https://moodle.org/pluginfile.php/50/local_plugins/plugin_screenshots/2292/2019-05-15_11-01-39.png) +![PHP7.3](https://img.shields.io/badge/PHP-7.3-brightgreen.svg) ## List of features - Supports comma separate list of ip-addresses @@ -60,3 +60,5 @@ Contributions are welcome and will be fully credited. We accept contributions vi ## Changelog - 2022021100 Thanks for adding ip-range support @[juacas](https://github.com/juacas) +- 2022052800 Fixed the [issue 6](https://github.com/MFreakNL/moodle-availability_ipaddress/issues/6) @[hamzatamyachte](https://github.com/hamzatamyachte) +- 2022052801 Test in Moodle 4.0 @[hamzatamyachte](https://github.com/hamzatamyachte) diff --git a/classes/condition.php b/classes/condition.php index a6814e0..3161f3a 100644 --- a/classes/condition.php +++ b/classes/condition.php @@ -82,15 +82,15 @@ class condition extends \core_availability\condition { public function is_available($not, info $info, $grabthelot, $userid) : bool { if (empty($this->ipaddresses)) { - return true; + return !$not; } // Check if ip-address matches. if (address_in_subnet(getremoteaddr(), trim($this->ipaddresses))) { - return true; + return !$not; } - return false; + return $not; } /** diff --git a/version.php b/version.php index ca0fd5c..5dcab06 100644 --- a/version.php +++ b/version.php @@ -27,7 +27,7 @@ defined('MOODLE_INTERNAL') || die(); $plugin->component = 'availability_ipaddress'; -$plugin->version = 2022021100; +$plugin->version = 2022052801; $plugin->release = '3.11.0'; $plugin->requires = 2016120500; $plugin->maturity = MATURITY_STABLE;