From 4fb3518450d8941ad8bd31d4508f49a90e47397b Mon Sep 17 00:00:00 2001 From: Artyom Vancyan Date: Wed, 24 May 2023 13:42:42 +0400 Subject: [PATCH 1/4] GH-20: Improve the naming of the variables --- src/django_forbid/skills/forbid_device.py | 6 +++--- src/django_forbid/skills/forbid_network.py | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/django_forbid/skills/forbid_device.py b/src/django_forbid/skills/forbid_device.py index ef67573..c6fc6e7 100644 --- a/src/django_forbid/skills/forbid_device.py +++ b/src/django_forbid/skills/forbid_device.py @@ -39,8 +39,8 @@ def __call__(self, request): if Access(devices).grants(device_type): return self.get_response(request) - # Redirects to the FORBIDDEN_KIT URL if set. - if Settings.has("OPTIONS.URL.FORBIDDEN_KIT"): - return redirect(Settings.get("OPTIONS.URL.FORBIDDEN_KIT")) + # Redirects to the FORBIDDEN_DEV URL if set. + if Settings.has("OPTIONS.URL.FORBIDDEN_DEV"): + return redirect(Settings.get("OPTIONS.URL.FORBIDDEN_DEV")) return HttpResponseForbidden() diff --git a/src/django_forbid/skills/forbid_network.py b/src/django_forbid/skills/forbid_network.py index 08dd2c7..e32c900 100644 --- a/src/django_forbid/skills/forbid_network.py +++ b/src/django_forbid/skills/forbid_network.py @@ -42,9 +42,9 @@ def erase_response_attributes(): if geoip2_tz != "N/A" and client_tz != geoip2_tz: erase_response_attributes() - # Redirects to the FORBIDDEN_VPN URL if set. - if Settings.has("OPTIONS.URL.FORBIDDEN_VPN"): - return redirect(Settings.get("OPTIONS.URL.FORBIDDEN_VPN")) + # Redirects to the FORBIDDEN_NET URL if set. + if Settings.has("OPTIONS.URL.FORBIDDEN_NET"): + return redirect(Settings.get("OPTIONS.URL.FORBIDDEN_NET")) return HttpResponseForbidden() # Restores the response from the session. From f3cc82cae2050aaf81491cb84572a9b8d23de787 Mon Sep 17 00:00:00 2001 From: Artyom Vancyan Date: Wed, 24 May 2023 13:42:52 +0400 Subject: [PATCH 2/4] Upgrade the version to `0.1.0` --- src/django_forbid/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/django_forbid/__init__.py b/src/django_forbid/__init__.py index 00ec2dc..3dc1f76 100644 --- a/src/django_forbid/__init__.py +++ b/src/django_forbid/__init__.py @@ -1 +1 @@ -__version__ = "0.0.9" +__version__ = "0.1.0" From 2aa00bb171607bb2f224f87e575ac5b58f2562ce Mon Sep 17 00:00:00 2001 From: Artyom Vancyan Date: Wed, 24 May 2023 13:43:06 +0400 Subject: [PATCH 3/4] GH-20: Update documents related to changes --- README.md | 10 +++++----- docs/integration/settings/index.md | 10 +++++----- docs/integration/settings/variables.md | 8 ++++---- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index f92856a..5fdbba9 100644 --- a/README.md +++ b/README.md @@ -53,9 +53,9 @@ following keys: - `OPTIONS` - a dictionary for additional settings - `VPN` - use VPN detection and forbid access to VPN users - `URL` - set of URLs to redirect to when the user is located in a forbidden country or using a VPN - - `FORBIDDEN_LOC` - the URL to redirect to when the user is located in a forbidden country - - `FORBIDDEN_VPN` - the URL to redirect to when the user is using a VPN - - `FORBIDDEN_KIT` - the URL to redirect to when the user is using a forbidden device + - `FORBIDDEN_LOC` - the URL to redirect to when the user is located in a forbidden geolocation + - `FORBIDDEN_NET` - the URL to redirect to when the user is using a forbidden network (VPN) + - `FORBIDDEN_DEV` - the URL to redirect to when the user is using a forbidden device The available device types are: `smartphone`, `peripheral` - refers to all hardware components that are attached to a computer, `wearable` - common types of wearable technology include smartwatches and smartglasses, `phablet` - a @@ -72,8 +72,8 @@ DJANGO_FORBID = { 'VPN': True, 'URL': { 'FORBIDDEN_LOC': 'forbidden_location', - 'FORBIDDEN_VPN': 'forbidden_network', - 'FORBIDDEN_KIT': 'forbidden_device', + 'FORBIDDEN_NET': 'forbidden_network', + 'FORBIDDEN_DEV': 'forbidden_device', }, }, } diff --git a/docs/integration/settings/index.md b/docs/integration/settings/index.md index 772bcab..83a25ae 100644 --- a/docs/integration/settings/index.md +++ b/docs/integration/settings/index.md @@ -12,9 +12,9 @@ following keys. - `OPTIONS` - a dictionary for additional settings - `VPN` - use VPN detection and forbid access to VPN users - `URL` - set of URLs to redirect to when the user is located in a forbidden country or using a VPN - - `FORBIDDEN_LOC` - the URL to redirect to when the user is located in a forbidden country - - `FORBIDDEN_VPN` - the URL to redirect to when the user is using a VPN - - `FORBIDDEN_KIT` - the URL to redirect to when the user is using a forbidden device + - `FORBIDDEN_LOC` - the URL to redirect to when the user is located in a forbidden geolocation + - `FORBIDDEN_NET` - the URL to redirect to when the user is using a forbidden network (VPN) + - `FORBIDDEN_DEV` - the URL to redirect to when the user is using a forbidden device These variables are all covered in more detail at the [next page](./variables.md). @@ -32,8 +32,8 @@ DJANGO_FORBID = { 'VPN': True, 'URL': { 'FORBIDDEN_LOC': 'forbidden_location', - 'FORBIDDEN_VPN': 'forbidden_network', - 'FORBIDDEN_KIT': 'forbidden_device', + 'FORBIDDEN_NET': 'forbidden_network', + 'FORBIDDEN_DEV': 'forbidden_device', }, }, } diff --git a/docs/integration/settings/variables.md b/docs/integration/settings/variables.md index 656e479..05aa6ae 100644 --- a/docs/integration/settings/variables.md +++ b/docs/integration/settings/variables.md @@ -100,16 +100,16 @@ the default Django 403 page. The URL can be absolute or relative. #### Forbidden Network -- Key: `FORBIDDEN_VPN` +- Key: `FORBIDDEN_NET` - Type: `str` - Default: `''` -This URL is used when the user is using a virtual private network (VPN). If not specified, the user will see the default -Django 403 page. The URL can be absolute or relative. +This URL is used when the user is using a virtual private network (VPN) while VPN detection is enabled. If not +specified, the user will see the default Django 403 page. The URL can be absolute or relative. #### Forbidden Device -- Key: `FORBIDDEN_KIT` +- Key: `FORBIDDEN_DEV` - Type: `str` - Default: `''` From c6a4de95e5c07fa93a1a67980c280e9a18e26819 Mon Sep 17 00:00:00 2001 From: Artyom Vancyan Date: Wed, 24 May 2023 13:43:14 +0400 Subject: [PATCH 4/4] GH-20: Update the development status --- setup.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.cfg b/setup.cfg index 5e623ff..8ff549f 100644 --- a/setup.cfg +++ b/setup.cfg @@ -30,7 +30,7 @@ license_file = LICENSE platforms = unix, linux, osx, win32 classifiers = Operating System :: OS Independent - Development Status :: 4 - Beta + Development Status :: 5 - Production/Stable Framework :: Django Framework :: Django :: 2.1 Framework :: Django :: 2.2