teppokoivula/user-restrictions 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

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

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: Unknown
  • 更新时间: 2025-05-03

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固