Fix Local variable 'user' referenced before assignement

This commit is contained in:
croneter 2021-01-11 16:21:37 +01:00
parent 70e6e4350e
commit a867acb0f8

View file

@ -361,6 +361,7 @@ class Service(object):
app.ACCOUNT.set_authenticated() app.ACCOUNT.set_authenticated()
return True return True
user = None
while True: while True:
# Could not use settings - try to get Plex user list from plex.tv # Could not use settings - try to get Plex user list from plex.tv
if app.ACCOUNT.plex_token: if app.ACCOUNT.plex_token:
@ -416,11 +417,15 @@ class Service(object):
utils.settings('username', value=username) utils.settings('username', value=username)
utils.settings('userid', value=user_id) utils.settings('userid', value=user_id)
utils.settings('accessToken', value=token) utils.settings('accessToken', value=token)
utils.settings('plex_restricteduser', if user:
'true' if user.isManaged else 'false') utils.settings('plex_restricteduser',
'true' if user.isManaged else 'false')
app.CONN.restricted_user = user.isManaged
else:
utils.settings('plex_restricteduser', 'false')
app.CONN.restricted_user = False
app.ACCOUNT.load() app.ACCOUNT.load()
app.ACCOUNT.set_authenticated() app.ACCOUNT.set_authenticated()
app.CONN.restricted_user = user.isManaged
return True return True
def ServiceEntryPoint(self): def ServiceEntryPoint(self):