refactoring for name improvements

This commit is contained in:
Adolfo Gómez García 2019-08-12 14:50:11 +02:00
parent 445c890209
commit 1c9ba0738a
7 changed files with 11 additions and 10 deletions

View File

@ -43,6 +43,8 @@ from uds.core.auths.Exceptions import InvalidUserException
if typing.TYPE_CHECKING:
from uds.core.auths.GroupsManager import GroupsManager
from uds.models import Authenticator as DBAuthenticator
from uds.models.User import User as DBUser
logger = logging.getLogger(__name__)
@ -148,7 +150,6 @@ class Authenticator(Module): # pylint: disable=too-many-public-methods
from uds.core.auths.User import User
from uds.core.auths.Group import Group
from uds.models import Authenticator as DBAuthenticator, User as DBUser
# : The type of user provided, normally standard user will be enough.
# : This is here so if we need it in some case, we can write our own
@ -160,7 +161,7 @@ class Authenticator(Module): # pylint: disable=too-many-public-methods
# : group class
groupType: typing.ClassVar[typing.Type[Group]] = Group
def __init__(self, dbAuth: DBAuthenticator, environment: Environment, values: typing.Optional[typing.Dict[str, str]]):
def __init__(self, dbAuth: 'DBAuthenticator', environment: Environment, values: typing.Optional[typing.Dict[str, str]]):
"""
Instantiathes the authenticator.
@param dbAuth: Database object for the authenticator
@ -193,7 +194,7 @@ class Authenticator(Module): # pylint: disable=too-many-public-methods
"""
return self._dbAuth
def recreateGroups(self, user: DBUser) -> None:
def recreateGroups(self, user: 'DBUser') -> None:
"""
Helper method, not needed to be overriden.
It simply checks if the source is external and if so, recreates

View File

@ -37,6 +37,8 @@ import typing
from uds.core.util.State import State
from .Group import Group
if typing.TYPE_CHECKING:
from uds.models import Authenticator as DBAuthenticator
logger = logging.getLogger(__name__)
@ -60,11 +62,9 @@ class GroupsManager:
Managed groups names are compared using case insensitive comparison.
"""
from uds.models import Authenticator as DBAuthenticator
_groups: typing.Dict[str, dict]
def __init__(self, dbAuthenticator: DBAuthenticator):
def __init__(self, dbAuthenticator: 'DBAuthenticator'):
"""
Initializes the groups manager.
The dbAuthenticator is the database record of the authenticator

View File

@ -45,7 +45,7 @@ from uds.models.Util import getSqlDatetime
from uds.core.util import (calendar, log)
from uds.models.ServicesPool import ServicePool
from uds.models.Transport import Transport
from uds.models.Authenticator import Authenticator
from uds.models.authenticator import Authenticator
# from django.utils.translation import ugettext_lazy as _, ugettext

View File

@ -40,7 +40,7 @@ from uds.core.util.State import State
from uds.core.util import log
from .UUIDModel import UUIDModel
from .Authenticator import Authenticator
from .authenticator import Authenticator
from .User import User
from .Util import UnsavedForeignKey, getSqlDatetime

View File

@ -36,7 +36,7 @@ import typing
from django.db import models
from django.db.models import signals
from uds.models.Authenticator import Authenticator
from uds.models.authenticator import Authenticator
from uds.models.Util import UnsavedForeignKey
from uds.models.Util import NEVER
from uds.models.Util import getSqlDatetime

View File

@ -52,7 +52,7 @@ from .Transport import Transport
from .Network import Network
# Authenticators
from .Authenticator import Authenticator
from .authenticator import Authenticator
from .User import User
from .UserPreference import UserPreference
from .Group import Group