mirror of
https://github.com/LdesignMedia/moodle-availability_ipaddress.git
synced 2026-05-17 05:48:41 +02:00
Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f24ef270a5 | ||
|
|
0e7ec99338 | ||
|
|
3b489f3406 | ||
|
|
84ea4a9165 | ||
|
|
9d6f7e51b9 | ||
|
|
855f8fecaa |
10
README.md
10
README.md
@@ -16,9 +16,9 @@ Restrict access to any activity by ip-address. This plugin can be used to make a
|
|||||||

|

|
||||||

|

|
||||||

|

|
||||||
|

|
||||||

|

|
||||||
|

|
||||||

|
|
||||||
|
|
||||||
## List of features
|
## List of features
|
||||||
- Supports comma separate list of ip-addresses
|
- Supports comma separate list of ip-addresses
|
||||||
@@ -56,3 +56,9 @@ The GNU GENERAL PUBLIC LICENSE. Please see [License File](LICENSE) for more info
|
|||||||
## Contributing
|
## Contributing
|
||||||
|
|
||||||
Contributions are welcome and will be fully credited. We accept contributions via Pull Requests on Github.
|
Contributions are welcome and will be fully credited. We accept contributions via Pull Requests on Github.
|
||||||
|
|
||||||
|
## 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)
|
||||||
|
|||||||
@@ -28,8 +28,6 @@ namespace availability_ipaddress;
|
|||||||
|
|
||||||
use core_availability\info;
|
use core_availability\info;
|
||||||
|
|
||||||
defined('MOODLE_INTERNAL') || die;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class condition
|
* Class condition
|
||||||
*
|
*
|
||||||
@@ -82,15 +80,15 @@ class condition extends \core_availability\condition {
|
|||||||
public function is_available($not, info $info, $grabthelot, $userid) : bool {
|
public function is_available($not, info $info, $grabthelot, $userid) : bool {
|
||||||
|
|
||||||
if (empty($this->ipaddresses)) {
|
if (empty($this->ipaddresses)) {
|
||||||
return true;
|
return !$not;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if ip-address matches.
|
// Check if ip-address matches.
|
||||||
if (address_in_subnet(getremoteaddr(), trim($this->ipaddresses))) {
|
if (address_in_subnet(getremoteaddr(), trim($this->ipaddresses))) {
|
||||||
return true;
|
return !$not;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return $not;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -166,7 +164,7 @@ class condition extends \core_availability\condition {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -25,7 +25,6 @@
|
|||||||
**/
|
**/
|
||||||
|
|
||||||
namespace availability_ipaddress;
|
namespace availability_ipaddress;
|
||||||
defined('MOODLE_INTERNAL') || die;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class frontend
|
* Class frontend
|
||||||
|
|||||||
@@ -26,8 +26,6 @@
|
|||||||
|
|
||||||
namespace availability_ipaddress\privacy;
|
namespace availability_ipaddress\privacy;
|
||||||
|
|
||||||
defined('MOODLE_INTERNAL') || die();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Privacy Subsystem for availability_ipaddress implementing null_provider.
|
* Privacy Subsystem for availability_ipaddress implementing null_provider.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -27,7 +27,7 @@
|
|||||||
defined('MOODLE_INTERNAL') || die();
|
defined('MOODLE_INTERNAL') || die();
|
||||||
|
|
||||||
$plugin->component = 'availability_ipaddress';
|
$plugin->component = 'availability_ipaddress';
|
||||||
$plugin->version = 2022021100;
|
$plugin->version = 2022052801;
|
||||||
$plugin->release = '3.11.0';
|
$plugin->release = '3.11.2';
|
||||||
$plugin->requires = 2016120500;
|
$plugin->requires = 2016120500;
|
||||||
$plugin->maturity = MATURITY_STABLE;
|
$plugin->maturity = MATURITY_STABLE;
|
||||||
|
|||||||
Reference in New Issue
Block a user