From 1138306e7ec965efe28b6c9c718f1f9264b9a12e Mon Sep 17 00:00:00 2001 From: Armin Ster Date: Fri, 24 Mar 2023 20:35:01 +0100 Subject: [PATCH 1/2] Make ip list setting changeable --- drf_ip_restrictions/permissions.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drf_ip_restrictions/permissions.py b/drf_ip_restrictions/permissions.py index fe6d3cd..74fcc9f 100644 --- a/drf_ip_restrictions/permissions.py +++ b/drf_ip_restrictions/permissions.py @@ -7,12 +7,14 @@ class AllowedIpList(object): Ensure the request's IP address is on the ip white list configured in Django settings. """ + setting_ip_list = "ALLOWED_IP_LIST" + def has_permission(self, request, view): client_ip, is_routable = get_client_ip(request) if client_ip: settings = ip_restriction_settings() - allowed_ips = settings.ALLOWED_IP_LIST + allowed_ips = getattr(settings, self.setting_ip_list) for allowed_ip in allowed_ips: if client_ip == allowed_ip or client_ip.startswith(allowed_ip): return True From dc74de56f2c7d0eb6a54eeaf1992e944f6548c88 Mon Sep 17 00:00:00 2001 From: Armin Ster Date: Tue, 28 Mar 2023 15:25:24 +0200 Subject: [PATCH 2/2] Fixes for ci lint pipeline --- tests/testapp/migrations/0001_initial.py | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/testapp/migrations/0001_initial.py b/tests/testapp/migrations/0001_initial.py index d81e34f..0aec845 100644 --- a/tests/testapp/migrations/0001_initial.py +++ b/tests/testapp/migrations/0001_initial.py @@ -4,7 +4,6 @@ class Migration(migrations.Migration): - initial = True dependencies = []