-
Notifications
You must be signed in to change notification settings - Fork 405
Add an admin API to search for children of a room #19021
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Changes from 8 commits
f963b82
e664088
58c6a79
fcb54a3
5f50fd5
76b86cf
8f78840
501257e
6d8c5c0
6148cb7
c187583
e119448
99eb9eb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
Add an [Admin API](https://element-hq.github.io/synapse/latest/usage/administration/admin_api/index.html) to allow an admin | ||
to search for room details and any children in a provided room. |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -63,6 +63,43 @@ | |
logger = logging.getLogger(__name__) | ||
|
||
|
||
class AdminRoomHierarchy(RestServlet): | ||
""" | ||
Given a room returns room details on that room and any children of the provided room. | ||
Does not return information about remote rooms which the server is not currently | ||
participating in | ||
H-Shay marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
""" | ||
|
||
PATTERNS = admin_patterns("/rooms/(?P<room_id>[^/]*)/hierarchy$") | ||
|
||
def __init__(self, hs: "HomeServer"): | ||
self._auth = hs.get_auth() | ||
self._room_summary_handler = hs.get_room_summary_handler() | ||
self._store = hs.get_datastores().main | ||
self._storage_controllers = hs.get_storage_controllers() | ||
|
||
async def on_GET( | ||
self, request: SynapseRequest, room_id: str | ||
) -> Tuple[int, JsonDict]: | ||
requester = await self._auth.get_user_by_req(request) | ||
await assert_user_is_admin(self._auth, requester) | ||
|
||
max_depth = parse_integer(request, "max_depth") | ||
limit = parse_integer(request, "limit") | ||
|
||
room_entry_summary = await self._room_summary_handler.get_room_hierarchy( | ||
requester, | ||
room_id, | ||
omit_remote_rooms=True, | ||
H-Shay marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
admin_skip_room_visibility_check=True, | ||
max_depth=max_depth, | ||
limit=limit, | ||
from_token=parse_string(request, "from"), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
) | ||
|
||
return HTTPStatus.OK, room_entry_summary | ||
|
||
|
||
class RoomRestV2Servlet(RestServlet): | ||
"""Delete a room from server asynchronously with a background task. | ||
|
Uh oh!
There was an error while loading. Please reload this page.