mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-07 23:55:05 -04:00
Add a shadow-banned flag to users. (#8092)
This commit is contained in:
parent
b069b78bb4
commit
ac77cdb64e
12 changed files with 83 additions and 12 deletions
|
@ -304,7 +304,7 @@ class RegistrationWorkerStore(SQLBaseStore):
|
|||
|
||||
def _query_for_auth(self, txn, token):
|
||||
sql = (
|
||||
"SELECT users.name, users.is_guest, access_tokens.id as token_id,"
|
||||
"SELECT users.name, users.is_guest, users.shadow_banned, access_tokens.id as token_id,"
|
||||
" access_tokens.device_id, access_tokens.valid_until_ms"
|
||||
" FROM users"
|
||||
" INNER JOIN access_tokens on users.name = access_tokens.user_id"
|
||||
|
@ -952,6 +952,7 @@ class RegistrationStore(RegistrationBackgroundUpdateStore):
|
|||
create_profile_with_displayname=None,
|
||||
admin=False,
|
||||
user_type=None,
|
||||
shadow_banned=False,
|
||||
):
|
||||
"""Attempts to register an account.
|
||||
|
||||
|
@ -968,6 +969,8 @@ class RegistrationStore(RegistrationBackgroundUpdateStore):
|
|||
admin (boolean): is an admin user?
|
||||
user_type (str|None): type of user. One of the values from
|
||||
api.constants.UserTypes, or None for a normal user.
|
||||
shadow_banned (bool): Whether the user is shadow-banned,
|
||||
i.e. they may be told their requests succeeded but we ignore them.
|
||||
|
||||
Raises:
|
||||
StoreError if the user_id could not be registered.
|
||||
|
@ -986,6 +989,7 @@ class RegistrationStore(RegistrationBackgroundUpdateStore):
|
|||
create_profile_with_displayname,
|
||||
admin,
|
||||
user_type,
|
||||
shadow_banned,
|
||||
)
|
||||
|
||||
def _register_user(
|
||||
|
@ -999,6 +1003,7 @@ class RegistrationStore(RegistrationBackgroundUpdateStore):
|
|||
create_profile_with_displayname,
|
||||
admin,
|
||||
user_type,
|
||||
shadow_banned,
|
||||
):
|
||||
user_id_obj = UserID.from_string(user_id)
|
||||
|
||||
|
@ -1028,6 +1033,7 @@ class RegistrationStore(RegistrationBackgroundUpdateStore):
|
|||
"appservice_id": appservice_id,
|
||||
"admin": 1 if admin else 0,
|
||||
"user_type": user_type,
|
||||
"shadow_banned": shadow_banned,
|
||||
},
|
||||
)
|
||||
else:
|
||||
|
@ -1042,6 +1048,7 @@ class RegistrationStore(RegistrationBackgroundUpdateStore):
|
|||
"appservice_id": appservice_id,
|
||||
"admin": 1 if admin else 0,
|
||||
"user_type": user_type,
|
||||
"shadow_banned": shadow_banned,
|
||||
},
|
||||
)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue