From 4e900ece42eb0d28c2773d328b4ab459b0d3aaf3 Mon Sep 17 00:00:00 2001 From: Amanda Graven Date: Fri, 1 Apr 2022 10:31:30 +0200 Subject: Add set_user_admin function to the module API (#12341) --- synapse/module_api/__init__.py | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'synapse/module_api') diff --git a/synapse/module_api/__init__.py b/synapse/module_api/__init__.py index 3c7dcca74d..f7f95bae29 100644 --- a/synapse/module_api/__init__.py +++ b/synapse/module_api/__init__.py @@ -515,6 +515,17 @@ class ModuleApi: """ return await self._store.is_server_admin(UserID.from_string(user_id)) + async def set_user_admin(self, user_id: str, admin: bool) -> None: + """Sets if a user is a server admin. + + Added in Synapse v1.56.0. + + Args: + user_id: The Matrix ID of the user to set admin status for. + admin: True iff the user is to be a server admin, false otherwise. + """ + await self._store.set_server_admin(UserID.from_string(user_id), admin) + def get_qualified_user_id(self, username: str) -> str: """Qualify a user id, if necessary -- cgit 1.5.1