Commit 5322d507 authored by echel0n's avatar echel0n
Browse files

Decreased noise of saving config during auth methods

parent c5179439
......@@ -58,11 +58,21 @@ class APIBaseHandler(BaseHandler, ABC):
sickrage.app.config.save(mark_dirty=True)
if sickrage.app.config.user.sub_id == decoded_token.get('sub'):
save_config = False
if not sickrage.app.config.user.username:
sickrage.app.config.user.username = decoded_token.get('preferred_username')
sickrage.app.config.user.email = decoded_token.get('email')
sickrage.app.config.user.permissions = UserPermission.SUPERUSER
sickrage.app.config.save()
save_config = True
if not sickrage.app.config.user.email:
sickrage.app.config.user.email = decoded_token.get('email')
save_config = True
if not sickrage.app.config.user.permissions == UserPermission.SUPERUSER:
sickrage.app.config.user.permissions = UserPermission.SUPERUSER
save_config = True
if save_config:
sickrage.app.config.save()
if sickrage.app.config.user.sub_id == decoded_token.get('sub'):
sentry_sdk.set_user({
......
......@@ -67,11 +67,21 @@ class LoginHandler(BaseHandler, ABC):
sickrage.app.config.save(mark_dirty=True)
if sickrage.app.config.user.sub_id == decoded_token.get('sub'):
save_config = False
if not sickrage.app.config.user.username:
sickrage.app.config.user.username = decoded_token.get('preferred_username')
sickrage.app.config.user.email = decoded_token.get('email')
sickrage.app.config.user.permissions = UserPermission.SUPERUSER
sickrage.app.config.save()
save_config = True
if not sickrage.app.config.user.email:
sickrage.app.config.user.email = decoded_token.get('email')
save_config = True
if not sickrage.app.config.user.permissions == UserPermission.SUPERUSER:
sickrage.app.config.user.permissions = UserPermission.SUPERUSER
save_config = True
if save_config:
sickrage.app.config.save()
if sickrage.app.config.user.sub_id == decoded_token.get('sub'):
sentry_sdk.set_user({
......@@ -140,11 +150,21 @@ class LoginHandler(BaseHandler, ABC):
sickrage.app.config.save(mark_dirty=True)
if sickrage.app.config.user.sub_id == decoded_token.get('sub'):
save_config = False
if not sickrage.app.config.user.username:
sickrage.app.config.user.username = decoded_token.get('preferred_username')
sickrage.app.config.user.email = decoded_token.get('email')
sickrage.app.config.user.permissions = UserPermission.SUPERUSER
sickrage.app.config.save()
save_config = True
if not sickrage.app.config.user.email:
sickrage.app.config.user.email = decoded_token.get('email')
save_config = True
if not sickrage.app.config.user.permissions == UserPermission.SUPERUSER:
sickrage.app.config.user.permissions = UserPermission.SUPERUSER
save_config = True
if save_config:
sickrage.app.config.save()
if sickrage.app.config.user.sub_id == decoded_token.get('sub'):
sentry_sdk.set_user({
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment