summary refs log tree commit diff
path: root/synapse/handlers/admin.py
diff options
context:
space:
mode:
authorErik Johnston <erikj@jki.re>2017-02-06 16:21:10 +0100
committerGitHub <noreply@github.com>2017-02-06 16:21:10 +0100
commitaf6da6db2d0add31b1839cff6bdb68fdd48e6a00 (patch)
tree5729f10fdbdfeab40c850e80b20910409a1f30c3 /synapse/handlers/admin.py
parentMerge branch 'master' of github.com:matrix-org/synapse into develop (diff)
parentadmin,storage: added more administrator functionalities (diff)
downloadsynapse-af6da6db2d0add31b1839cff6bdb68fdd48e6a00.tar.xz
Merge pull request #1784 from morteza-araby/user-admin
Administration functionalities
Diffstat (limited to 'synapse/handlers/admin.py')
-rw-r--r--synapse/handlers/admin.py44
1 files changed, 43 insertions, 1 deletions
diff --git a/synapse/handlers/admin.py b/synapse/handlers/admin.py
index 084e33ca6a..f36b358b45 100644
--- a/synapse/handlers/admin.py
+++ b/synapse/handlers/admin.py
@@ -19,7 +19,6 @@ from ._base import BaseHandler
 
 import logging
 
-
 logger = logging.getLogger(__name__)
 
 
@@ -54,3 +53,46 @@ class AdminHandler(BaseHandler):
         }
 
         defer.returnValue(ret)
+
+    @defer.inlineCallbacks
+    def get_users(self):
+        """Function to reterive a list of users in users table.
+
+        Args:
+        Returns:
+            defer.Deferred: resolves to list[dict[str, Any]]
+        """
+        ret = yield self.store.get_users()
+
+        defer.returnValue(ret)
+
+    @defer.inlineCallbacks
+    def get_users_paginate(self, order, start, limit):
+        """Function to reterive a paginated list of users from
+        users list. This will return a json object, which contains
+        list of users and the total number of users in users table.
+
+        Args:
+            order (str): column name to order the select by this column
+            start (int): start number to begin the query from
+            limit (int): number of rows to reterive
+        Returns:
+            defer.Deferred: resolves to json object {list[dict[str, Any]], count}
+        """
+        ret = yield self.store.get_users_paginate(order, start, limit)
+
+        defer.returnValue(ret)
+
+    @defer.inlineCallbacks
+    def search_users(self, term):
+        """Function to search users list for one or more users with
+        the matched term.
+
+        Args:
+            term (str): search term
+        Returns:
+            defer.Deferred: resolves to list[dict[str, Any]]
+        """
+        ret = yield self.store.search_users(term)
+
+        defer.returnValue(ret)