Fixed mitration from MFA

This commit is contained in:
Adolfo Gómez García 2022-06-28 16:30:14 +02:00
parent 29fd2c068a
commit 365e2c56d3
7 changed files with 7 additions and 56 deletions

View File

@ -35,7 +35,7 @@ import random
import logging
import typing
from django.utils.translation import ugettext_noop as _
from django.utils.translation import gettext_noop as _
from uds.models import getSqlDatetime
from uds.core import Module
from uds.core.auths import exceptions

View File

@ -111,7 +111,7 @@ class gui:
CREDENTIALS_TAB: typing.ClassVar[str] = gettext_noop('Credentials')
TUNNEL_TAB: typing.ClassVar[str] = gettext_noop('Tunnel')
DISPLAY_TAB: typing.ClassVar[str] = gettext_noop('Display')
MFA_TAB: typing.ClassVar[str] = ugettext_noop('MFA')
MFA_TAB: typing.ClassVar[str] = gettext_noop('MFA')
# : Static Callbacks simple registry
callbacks: typing.Dict[

View File

@ -56,7 +56,7 @@ class GlobalRequestMiddleware:
def __init__(self, get_response: typing.Callable[[HttpRequest], HttpResponse]):
self._get_response: typing.Callable[[HttpRequest], HttpResponse] = get_response
def _process_response(self, request: ExtendedHttpRequest, response: HttpResponse):
def _process_response(self, request: 'ExtendedHttpRequest', response: HttpResponse):
# Remove IP from global cache (processing responses after this will make global request unavailable,
# but can be got from request again)

View File

@ -1,48 +0,0 @@
# Generated by Django 3.2.8 on 2021-10-27 12:21
from django.db import migrations
# From REST API:
# Pair of section/value removed from current UDS version
REMOVED = {
'UDS': (
'allowPreferencesAccess',
'customHtmlLogin',
'UDS Theme',
'UDS Theme Enhaced',
'css',
'allowPreferencesAccess',
'loginUrl',
'maxLoginTries',
'loginBlockTime',
'maxPreparingServices',
'maxRemovingServices',
'ignoreLimits',
),
'Cluster': ('Destination CPU Load', 'Migration CPU Load', 'Migration Free Memory'),
'IPAUTH': ('autoLogin',),
'VMWare': ('minUsableDatastoreGB', 'maxRetriesOnError'),
'HyperV': ('minUsableDatastoreGB',),
'Security': ('adminIdleTime', 'userSessionLength', 'Master Key'),
'SAML': ('IDP Metadata cache', 'Global logout on exit')
}
def clean_config(apps, schema_editor):
Config = apps.get_model('uds', 'Config')
# Remove all configs that are in REMOVED
for section, keys in REMOVED.items():
for key in keys:
Config.objects.filter(section=section, key=key).delete()
class Migration(migrations.Migration):
dependencies = [
('uds', '0001_squashed_0042_auto_20210628_1533'),
]
operations = [
#
migrations.RunPython(clean_config, lambda apps, schema_editor: None),
]

View File

@ -1,4 +1,4 @@
# Generated by Django 4.0.3 on 2022-05-19 17:25
# Generated by Django 4.0.3 on 2022-06-28 16:26
from django.db import migrations, models
import django.db.models.deletion
@ -8,7 +8,7 @@ import uds.models.notifications
class Migration(migrations.Migration):
dependencies = [
('uds', '0043_clean_unused_config'),
('uds', '0043_auto_20220623_1934'),
]
operations = [

View File

@ -46,7 +46,7 @@ from .util import NEVER
# Not imported at runtime, just for type checking
if typing.TYPE_CHECKING:
from uds.models import User, Group, Network, MFA
from uds.models import User, Group, Network
logger = logging.getLogger(__name__)
@ -82,7 +82,7 @@ class Authenticator(ManagedObjectModel, TaggingMixin):
networks: 'models.manager.RelatedManager[Network]'
# MFA associated to this authenticator. Can be null
mfa = models.ForeignKey(MFA, on_delete=models.SET_NULL, null=True, blank=True, related_name='authenticators')
mfa = models.ForeignKey('MFA', on_delete=models.SET_NULL, null=True, blank=True, related_name='authenticators')
class Meta(ManagedObjectModel.Meta): # pylint: disable=too-few-public-methods
"""

View File

@ -31,7 +31,6 @@
"""
import logging
from django.utils.translation import ugettext_lazy as _
from django import forms