summary refs log tree commit diff
path: root/synapse/api
diff options
context:
space:
mode:
authorNeil Johnson <neil@matrix.org>2018-12-14 18:20:59 +0000
committerGitHub <noreply@github.com>2018-12-14 18:20:59 +0000
commitd2f7c4e6b1efbdd3275d02a19220a10cf00a8f66 (patch)
tree3fc3b14dbbc3effc3974f6f529894c49ef0c1b02 /synapse/api
parentSettings Fix deleting e2e room keys on xenial (#4295) (diff)
downloadsynapse-d2f7c4e6b1efbdd3275d02a19220a10cf00a8f66.tar.xz
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.
Diffstat (limited to 'synapse/api')
-rw-r--r--synapse/api/auth.py5
-rw-r--r--synapse/api/constants.py8
2 files changed, 11 insertions, 2 deletions
diff --git a/synapse/api/auth.py b/synapse/api/auth.py
index 5309899703..b8a9af7158 100644
--- a/synapse/api/auth.py
+++ b/synapse/api/auth.py
@@ -802,9 +802,10 @@ class Auth(object):
             threepid should never be set at the same time.
         """
 
-        # Never fail an auth check for the server notices users
+        # Never fail an auth check for the server notices users or support user
         # This can be a problem where event creation is prohibited due to blocking
-        if user_id == self.hs.config.server_notices_mxid:
+        is_support = yield self.store.is_support_user(user_id)
+        if user_id == self.hs.config.server_notices_mxid or is_support:
             return
 
         if self.hs.config.hs_disabled:
diff --git a/synapse/api/constants.py b/synapse/api/constants.py
index f20e0fcf0b..b7f25a42a2 100644
--- a/synapse/api/constants.py
+++ b/synapse/api/constants.py
@@ -119,3 +119,11 @@ KNOWN_ROOM_VERSIONS = {
 
 ServerNoticeMsgType = "m.server_notice"
 ServerNoticeLimitReached = "m.server_notice.usage_limit_reached"
+
+
+class UserTypes(object):
+    """Allows for user type specific behaviour. With the benefit of hindsight
+    'admin' and 'guest' users should also be UserTypes. Normal users are type None
+    """
+    SUPPORT = "support"
+    ALL_USER_TYPES = (SUPPORT)