magenettic/module-ip-whitelist 问题修复 & 功能扩展

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

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

magenettic/module-ip-whitelist

Composer 安装命令:

composer require magenettic/module-ip-whitelist

包简介

IP whitelist for admin login in Magento 2

README 文档

README

IP whitelist for admin login in Magento 2.4.x

Overview

This module restricts admin panel access to a configurable list of allowed IP addresses, adding an extra security layer for your Magento store.

Features

1. Enable/Disable IP Whitelist

Toggle the IP filter on or off from the admin configuration panel.

2. Allowed IP Addresses (Whitelist)

Define a list of IP addresses that are permitted to access the admin panel. One IP per line.

Configuration

Navigate to: Stores > Settings > Configuration > Advanced > Admin > Security

Setting Description
Enable IP Whitelist Enable/disable the IP whitelist filter
Allowed IP Addresses (Whitelist) Enter IP addresses one per line (e.g., 192.168.1.1)

Requirements

  • Magento 2.4.x
  • PHP 8.2+

Installation

Composer Installation

composer require magenettic/module-ip-whitelist

Manual Installation

bin/magento module:enable Magenettic_IpWhitelist
bin/magento setup:upgrade
bin/magento cache:flush

Validation Flow

Admin login attempt
    |
    v
Is IP Whitelist enabled?
    |-- No  --> Allow login (proceed normally)
    |
    +-- Yes --> Check if client IP is in allowed list
                  |-- Yes --> Allow login
                  +-- No  --> Reject with "Access denied" message

Module Structure

Magenettic/IpWhitelist/
├── Helper/Data.php                    # Configuration helper
├── Plugin/AdminLoginPlugin.php        # Admin login validation
├── Test/Unit/
│   ├── Helper/DataTest.php            # Helper unit tests
│   └── Plugin/AdminLoginPluginTest.php # Plugin unit tests
├── etc/
│   ├── adminhtml/system.xml           # Configuration fields
│   ├── adminhtml/di.xml               # Plugin registration
│   ├── config.xml                     # Default configuration
│   └── module.xml                     # Module declaration
├── i18n/
│   └── pt_BR.csv                      # Portuguese (Brazil) translation
├── composer.json
├── README.md
└── registration.php

Testing

Unit Tests

vendor/bin/phpunit -c dev/tests/unit/phpunit.xml.dist app/code/Magenettic/IpWhitelist/Test/Unit/

Test Coverage

Component Tests Coverage
Helper\Data 9 tests isEnabled, getAllowedIps, isIpAllowed
Plugin\AdminLoginPlugin 4 tests beforeLogin (enabled/disabled, IP allowed/blocked)

License

MIT

统计信息

  • 总下载量: 0
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 2
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-06-24

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固