interface RestrictIpServiceInterface in Restrict IP 8
Same name and namespace in other branches
- 8.2 src/Service/RestrictIpServiceInterface.php \Drupal\restrict_ip\Service\RestrictIpServiceInterface
- 3.x src/Service/RestrictIpServiceInterface.php \Drupal\restrict_ip\Service\RestrictIpServiceInterface
Hierarchy
- interface \Drupal\restrict_ip\Service\RestrictIpServiceInterface
Expanded class hierarchy of RestrictIpServiceInterface
All classes that implement RestrictIpServiceInterface
2 files declare their use of RestrictIpServiceInterface
- ConfigForm.php in src/
Form/ ConfigForm.php - RestrictIpEventSubscriber.php in src/
EventSubscriber/ RestrictIpEventSubscriber.php
File
- src/
Service/ RestrictIpServiceInterface.php, line 5
Namespace
Drupal\restrict_ip\ServiceView source
interface RestrictIpServiceInterface {
/**
* Test if the user is blocked
*
* @return bool
* TRUE if the user is blocked
* FALSE if the user is not blocked
*/
public function userIsBlocked();
/**
* Run all tests to see if the current user should be blocked or not
* based on their IP address
*
* @param $runInCli bool
* Indicate whether the test should be run even when the code is being run through
* the command line. This will almost always be FALSE, to prevent the user from
* being blocked while running Drush commands, however this needs to be set as
* TRUE when running PHPUnit tests, in order to be able to run the code.
*/
public function testForBlock($runInCli = FALSE);
/**
* Takes a string containing potential IP addresses on separate lines,
* strips them of any code comments, trims them, and turns them into a clean array.
* Note that the elements may or may not be IP addresses and if validation is necessary,
* the array returned from this function should be validated.
*
* @param string $input
* A string containing new-line separated IP addresses. Can contain code comments
*
* @return array
* An array of IP addresses parsed from the $input.
*/
public function cleanIpAddressInput($input);
/**
* Get the IP address of the current user
*
* @return string
* The IP address of the current user
*/
public function getCurrentUserIp();
/**
* Get the current path that the user is on
*
* @return string
* The current path
*/
public function getCurrentPath();
/**
* Get an array of all IP addresses that have been whitelisted through the admin interface
*
* @return array
* An array of addresses whitelisted through the admin interface.
*/
public function getWhitelistedIpAddresses();
/**
* Save whitelisted IP addresses to the system
*
* @param array $ip_addresses
* An array of IP addresses to be saved
* @param bool $overwriteExisting
* A boolean indicating whether existing IP addresses should be deleted before saving
*/
public function saveWhitelistedIpAddresses(array $ipAddresses, $overwriteExisting = TRUE);
/**
* Get an array of all whitelisted pages
*
* @return array
* An array of paths that have been whitelisted
*/
public function getWhitelistedPagePaths();
/**
* Save whitelisted page paths to the system
*
* @param array $whitelistedPaths
* An array of paths to be saved for whitelisting.
* @param bool $overwriteExisting
* A boolean indicating whether existing paths should be deleted before saving
*/
public function saveWhitelistedPagePaths(array $whitelistedPaths, $overwriteExisting = TRUE);
/**
* Get an array of all blacklisted pages
*
* @return array
* An array of paths that have been whitelisted
*/
public function getBlacklistedPagePaths();
/**
* Save blacklisted page paths to the system
*
* @param array $blacklistedPaths
* An array of paths to be saved for blacklisting.
* @param bool $overwriteExisting
* A boolean indicating whether existing paths should be deleted before saving
*/
public function saveBlacklistedPagePaths(array $blacklistedPaths, $overwriteExisting = TRUE);
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
RestrictIpServiceInterface:: |
public | function | * Takes a string containing potential IP addresses on separate lines, * strips them of any code comments, trims them, and turns them into a clean array. * Note that the elements may or may not be IP addresses and if validation is necessary, *… | 1 |
RestrictIpServiceInterface:: |
public | function | * Get an array of all blacklisted pages * * | 1 |
RestrictIpServiceInterface:: |
public | function | * Get the current path that the user is on * * | 1 |
RestrictIpServiceInterface:: |
public | function | * Get the IP address of the current user * * | 1 |
RestrictIpServiceInterface:: |
public | function | * Get an array of all IP addresses that have been whitelisted through the admin interface * * | 1 |
RestrictIpServiceInterface:: |
public | function | * Get an array of all whitelisted pages * * | 1 |
RestrictIpServiceInterface:: |
public | function | * Save blacklisted page paths to the system * * | 1 |
RestrictIpServiceInterface:: |
public | function | * Save whitelisted IP addresses to the system * * | 1 |
RestrictIpServiceInterface:: |
public | function | * Save whitelisted page paths to the system * * | 1 |
RestrictIpServiceInterface:: |
public | function | * Run all tests to see if the current user should be blocked or not * based on their IP address * * | 1 |
RestrictIpServiceInterface:: |
public | function | * Test if the user is blocked * * | 1 |