Ensure the list media admin API is always available (#5966)
* Ensure the list media admin API is always available This API is required for some external media repo implementations to operate (mostly for doing quarantine operations on a room). * changelog
This commit is contained in:
parent
6b6086b8bf
commit
2f416fc997
|
@ -0,0 +1 @@
|
||||||
|
Fix admin API for listing media in a room not being available with an external media repo.
|
|
@ -41,7 +41,7 @@ from synapse.rest.admin._base import (
|
||||||
assert_user_is_admin,
|
assert_user_is_admin,
|
||||||
historical_admin_path_patterns,
|
historical_admin_path_patterns,
|
||||||
)
|
)
|
||||||
from synapse.rest.admin.media import register_servlets_for_media_repo
|
from synapse.rest.admin.media import ListMediaInRoom, register_servlets_for_media_repo
|
||||||
from synapse.rest.admin.purge_room_servlet import PurgeRoomServlet
|
from synapse.rest.admin.purge_room_servlet import PurgeRoomServlet
|
||||||
from synapse.rest.admin.server_notice_servlet import SendServerNoticeServlet
|
from synapse.rest.admin.server_notice_servlet import SendServerNoticeServlet
|
||||||
from synapse.rest.admin.users import UserAdminServlet
|
from synapse.rest.admin.users import UserAdminServlet
|
||||||
|
@ -761,9 +761,12 @@ def register_servlets_for_client_rest_resource(hs, http_server):
|
||||||
DeleteGroupAdminRestServlet(hs).register(http_server)
|
DeleteGroupAdminRestServlet(hs).register(http_server)
|
||||||
AccountValidityRenewServlet(hs).register(http_server)
|
AccountValidityRenewServlet(hs).register(http_server)
|
||||||
|
|
||||||
# Load the media repo ones if we're using them.
|
# Load the media repo ones if we're using them. Otherwise load the servlets which
|
||||||
|
# don't need a media repo (typically readonly admin APIs).
|
||||||
if hs.config.can_load_media_repo:
|
if hs.config.can_load_media_repo:
|
||||||
register_servlets_for_media_repo(hs, http_server)
|
register_servlets_for_media_repo(hs, http_server)
|
||||||
|
else:
|
||||||
|
ListMediaInRoom(hs).register(http_server)
|
||||||
|
|
||||||
# don't add more things here: new servlets should only be exposed on
|
# don't add more things here: new servlets should only be exposed on
|
||||||
# /_synapse/admin so should not go here. Instead register them in AdminRestResource.
|
# /_synapse/admin so should not go here. Instead register them in AdminRestResource.
|
||||||
|
|
Loading…
Reference in New Issue