Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Commit

Permalink
Have ClientReaderSlavedStore inherit RegistrationStore (#5806)
Browse files Browse the repository at this point in the history
  • Loading branch information
anoadragon453 committed Feb 20, 2020
2 parents 6e7f378 + 5d018d2 commit 0d0b430
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 21 deletions.
1 change: 1 addition & 0 deletions changelog.d/5806.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix error when trying to login as a deactivated user when using a worker to handle login.
42 changes: 21 additions & 21 deletions synapse/storage/registration.py
Original file line number Diff line number Diff line change
Expand Up @@ -591,6 +591,27 @@ def get_id_servers_user_bound(self, user_id, medium, address):
desc="get_id_servers_user_bound",
)

@cachedInlineCallbacks()
def get_user_deactivated_status(self, user_id):
"""Retrieve the value for the `deactivated` property for the provided user.
Args:
user_id (str): The ID of the user to retrieve the status for.
Returns:
defer.Deferred(bool): The requested value.
"""

res = yield self._simple_select_one_onecol(
table="users",
keyvalues={"name": user_id},
retcol="deactivated",
desc="get_user_deactivated_status",
)

# Convert the integer into a boolean.
return res == 1


class RegistrationStore(
RegistrationWorkerStore, background_updates.BackgroundUpdateStore
Expand Down Expand Up @@ -1339,24 +1360,3 @@ def set_user_deactivated_status(self, user_id, deactivated):
user_id,
deactivated,
)

@cachedInlineCallbacks()
def get_user_deactivated_status(self, user_id):
"""Retrieve the value for the `deactivated` property for the provided user.
Args:
user_id (str): The ID of the user to retrieve the status for.
Returns:
defer.Deferred(bool): The requested value.
"""

res = yield self._simple_select_one_onecol(
table="users",
keyvalues={"name": user_id},
retcol="deactivated",
desc="get_user_deactivated_status",
)

# Convert the integer into a boolean.
return res == 1

0 comments on commit 0d0b430

Please sign in to comment.