mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-08-06 12:14:12 -04:00
create support user (#4141)
Allow for the creation of a support user. A support user can access the server, join rooms, interact with other users, but does not appear in the user directory nor does it contribute to monthly active user limits.
This commit is contained in:
parent
e93a0ebf50
commit
d2f7c4e6b1
20 changed files with 371 additions and 47 deletions
|
@ -16,6 +16,8 @@
|
|||
|
||||
from twisted.internet import defer
|
||||
|
||||
from synapse.api.constants import UserTypes
|
||||
|
||||
from tests import unittest
|
||||
from tests.utils import setup_test_homeserver
|
||||
|
||||
|
@ -99,6 +101,26 @@ class RegistrationStoreTestCase(unittest.TestCase):
|
|||
user = yield self.store.get_user_by_access_token(self.tokens[0])
|
||||
self.assertIsNone(user, "access token was not deleted without device_id")
|
||||
|
||||
@defer.inlineCallbacks
|
||||
def test_is_support_user(self):
|
||||
TEST_USER = "@test:test"
|
||||
SUPPORT_USER = "@support:test"
|
||||
|
||||
res = yield self.store.is_support_user(None)
|
||||
self.assertFalse(res)
|
||||
yield self.store.register(user_id=TEST_USER, token="123", password_hash=None)
|
||||
res = yield self.store.is_support_user(TEST_USER)
|
||||
self.assertFalse(res)
|
||||
|
||||
yield self.store.register(
|
||||
user_id=SUPPORT_USER,
|
||||
token="456",
|
||||
password_hash=None,
|
||||
user_type=UserTypes.SUPPORT
|
||||
)
|
||||
res = yield self.store.is_support_user(SUPPORT_USER)
|
||||
self.assertTrue(res)
|
||||
|
||||
|
||||
class TokenGenerator:
|
||||
def __init__(self):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue