teppokoivula/user-restrictions
Composer 安装命令:
composer require teppokoivula/user-restrictions
包简介
README 文档
README
This module provides additional restrictions for users. As of this writing it can be used to restrict login attempts to the admin using a predefined set of IPs or geolocations.
Note: geolocation data is fetched from an external API, which may require credentials. This feature has been built with ipgeolocation.io in mind, but should technically work with any other service as well — as long as said service returns data in JSON format.
Configuration settings are defined via $config->UserRestrictions:
$config->UserRestrictions = [
'login_restriction_enabled' => !$this->config->debug,
'login_restriction_enabled_for' => [
// array containing users that are restricted; supported formats:
// 'my_admin_username' or 'user:my_admin_user' (username)
// 41 or 'user:41' (user ID)
// 'role:superuser' (role)
// 'regex:/.*/' (regex pattern, which is matched against username)
],
'valid_ip_addresses' => [
// list of valid IP addresses; supported formats:
// '127.0.0.1' (individual IP)
// '127.0.0.1-127.0.0.255' (IP range)
// '127.0.0.0/24' (CIDR)
],
'valid_geolocations' => [
// list of valid geolocations; supported formats:
// 'Finland' or 'country:Finland' (country)
// 'prefix:value' (any other valid geolocation data key)
],
'geolocation_api_url' => 'https://api.ipgeolocation.io/v2/ipgeo?apiKey={api_key}&ip={ip}',
'geolocation_api_key' => '',
'display_errors' => false,
'log_errors' => true,
];
统计信息
- 总下载量: 0
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Unknown
- 更新时间: 2025-05-03