Admin API to list, filter and sort rooms (#6720)

This commit is contained in:
Andrew Morgan 2020-01-22 13:36:43 +00:00 committed by GitHub
parent ae6cf586b0
commit 90a28fb475
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 787 additions and 7 deletions

View file

@ -40,6 +40,21 @@ def historical_admin_path_patterns(path_regex):
)
def admin_patterns(path_regex: str):
"""Returns the list of patterns for an admin endpoint
Args:
path_regex: The regex string to match. This should NOT have a ^
as this will be prefixed.
Returns:
A list of regex patterns.
"""
admin_prefix = "^/_synapse/admin/v1"
patterns = [re.compile(admin_prefix + path_regex)]
return patterns
async def assert_requester_is_admin(auth, request):
"""Verify that the requester is an admin user