IpAccessControlService
class IpAccessControlService implements LoggerAwareInterface (View source)
Traits
Trait LoggerAwareTrait A trait used with LoggerAwareInterface
Constants
IPRANGEFLAG_BLACKLIST |
Bit mask for denylist ranges. |
IPRANGEFLAG_WHITELIST |
Bit mask for allowlist ranges. |
IPRANGEFLAG_MANUAL |
Bit mask for manually generated ranges. |
IPRANGEFLAG_AUTOMATIC |
Bit mask for automatically generated ranges. |
IPRANGETYPE_BLACKLIST_MANUAL |
IP range type: manually added to the denylist. |
IPRANGETYPE_BLACKLIST_AUTOMATIC |
IP range type: automatically added to the denylist. |
IPRANGETYPE_WHITELIST_MANUAL |
IP range type: manually added to the allowlist. |
Properties
protected EntityManagerInterface | $em | ||
protected Site | $site | ||
protected IpAccessControlCategory | $category | The IP Access Control Category. |
|
protected AddressInterface | $defaultIpAddress |
Methods
No description
Initialize the instance.
Get the IP Access Control Category.
Check if an IP address is denylisted.
Check if an IP address is allowlisted.
Create and save an IP Access Control Event.
Check if the IP address has reached the threshold.
Add an IP address to the list of denylisted IP address when too many events occur.
Add persist an IP address range type.
Get the list of currently available ranges.
Get a saved range for this category given its ID.
Delete the recorded events.
Clear the IP addresses automatically denylisted.
Get the (localized) message telling the users that their IP address has been banned.
No description
Details
getLoggerChannel()
No description
__construct(EntityManagerInterface $em, Site $site, IpAccessControlCategory $category, AddressInterface $defaultIpAddress)
Initialize the instance.
IpAccessControlCategory
getCategory()
Get the IP Access Control Category.
bool
isBlacklisted(AddressInterface $ipAddress = null)
deprecated
deprecated
No description
bool
isDenylisted(AddressInterface $ipAddress = null)
Check if an IP address is denylisted.
bool
isWhitelisted(AddressInterface $ipAddress = null)
deprecated
deprecated
No description
bool
isAllowlisted(AddressInterface $ipAddress = null)
Check if an IP address is allowlisted.
IpAccessControlEvent|null
registerEvent(AddressInterface $ipAddress = null, bool $evenIfDisabled = false)
Create and save an IP Access Control Event.
bool
isThresholdReached(AddressInterface $ipAddress = null, bool $evenIfDisabled = false)
Check if the IP address has reached the threshold.
IpAccessControlRange|null
addToDenylistForThresholdReached(AddressInterface $ipAddress = null, bool $evenIfDisabled = false)
Add an IP address to the list of denylisted IP address when too many events occur.
IpAccessControlRange
createRange(RangeInterface $range, int $type, DateTime $expiration = null)
Add persist an IP address range type.
Collection|IpAccessControlRange[]
getRanges(int $type, bool $includeExpired = false)
Get the list of currently available ranges.
getRangeByID(int $id)
Get a saved range for this category given its ID.
deleteRange(IpAccessControlRange|int $range)
Delete a saved range given its instance or its ID.
int
deleteEvents(int|null $minAge = null)
Delete the recorded events.
int
deleteAutomaticDenylist(bool $onlyExpired = true)
Clear the IP addresses automatically denylisted.
string
getErrorMessage()
Get the (localized) message telling the users that their IP address has been banned.
IpAccessControlRange|null
getRange(AddressInterface $ipAddress = null)
No description