From 66f5ff72fd2179c2cbb6a7755d36273d51a2e32f Mon Sep 17 00:00:00 2001 From: Jason Robinson Date: Mon, 22 Jul 2019 15:21:19 +0300 Subject: [PATCH] Add `user_type` to returned fields in admin API user list endpoints Mostly user type will be empty (normal user) but there is also the "support" user type. Signed-off-by: Jason Robinson --- changelog.d/5731.misc | 1 + synapse/storage/__init__.py | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) create mode 100644 changelog.d/5731.misc diff --git a/changelog.d/5731.misc b/changelog.d/5731.misc new file mode 100644 index 000000000000..dffae5d874e7 --- /dev/null +++ b/changelog.d/5731.misc @@ -0,0 +1 @@ +Return 'user_type' in admin API user endpoints results. diff --git a/synapse/storage/__init__.py b/synapse/storage/__init__.py index 6b0ca800876c..86a333a91916 100644 --- a/synapse/storage/__init__.py +++ b/synapse/storage/__init__.py @@ -469,7 +469,7 @@ def get_users(self): return self._simple_select_list( table="users", keyvalues={}, - retcols=["name", "password_hash", "is_guest", "admin"], + retcols=["name", "password_hash", "is_guest", "admin", "user_type"], desc="get_users", ) @@ -494,7 +494,7 @@ def get_users_paginate(self, order, start, limit): orderby=order, start=start, limit=limit, - retcols=["name", "password_hash", "is_guest", "admin"], + retcols=["name", "password_hash", "is_guest", "admin", "user_type"], ) count = yield self.runInteraction("get_users_paginate", self.get_user_count_txn) retval = {"users": users, "total": count} @@ -514,7 +514,7 @@ def search_users(self, term): table="users", term=term, col="name", - retcols=["name", "password_hash", "is_guest", "admin"], + retcols=["name", "password_hash", "is_guest", "admin", "user_type"], desc="search_users", )