1
0
mirror of https://github.com/dkmstr/openuds.git synced 2024-12-24 21:34:41 +03:00

Fixed GetRootUser

This commit is contained in:
Adolfo Gómez García 2022-03-13 15:41:45 +01:00
parent 410b0952e9
commit b41a8e38cf
2 changed files with 4 additions and 6 deletions

View File

@ -361,8 +361,6 @@ class Handler:
and username == GlobalConfig.SUPER_USER_LOGIN.get(True)
and authId == -1
):
return typing.cast(
'User', getRootUser().user
) # We are sure getRootUser() is always valid
return getRootUser()
return Authenticator.objects.get(pk=authId).users.get(name=username)

View File

@ -102,7 +102,7 @@ def getUDSCookie(
return cookie
def getRootUser() -> AuthResult:
def getRootUser() -> User:
"""
Returns an user not in DB that is ROOT for the platform
@ -122,7 +122,7 @@ def getRootUser() -> AuthResult:
user.getGroups = lambda: [] # type: ignore
user.updateLastAccess = lambda: None # type: ignore
user.logout = lambda: None # type: ignore
return AuthResult(user=user)
return user
# Decorator to make easier protect pages that needs to be logged in
@ -275,7 +275,7 @@ def authenticate(
and username == GlobalConfig.SUPER_USER_LOGIN.get(True)
and password == GlobalConfig.SUPER_USER_PASS.get(True)
):
return getRootUser()
return AuthResult(user=getRootUser())
gm = auths.GroupsManager(authenticator)
authInstance = authenticator.getInstance()