Auth media/r0/config

This commit is contained in:
Will Hunt 2018-07-27 12:17:40 +01:00
parent bf13c184cd
commit bf30fd8342
1 changed files with 5 additions and 1 deletions

View File

@ -14,6 +14,7 @@
# limitations under the License.
#
from twisted.internet import defer
from twisted.web.resource import Resource
from twisted.web.server import NOT_DONE_YET
from synapse.http.server import respond_with_json, wrap_json_request_handler
@ -26,6 +27,7 @@ class MediaConfigResource(Resource):
Resource.__init__(self)
config = hs.get_config()
self.clock = hs.get_clock()
self.auth = hs.get_auth()
self.limits_dict = {
"m.upload.size": config.max_upload_size,
}
@ -35,8 +37,10 @@ class MediaConfigResource(Resource):
return NOT_DONE_YET
@wrap_json_request_handler
@defer.inlineCallbacks
def _async_render_GET(self, request):
return respond_with_json(request, 200, self.limits_dict)
yield self.auth.get_user_by_req(request)
respond_with_json(request, 200, self.limits_dict)
def render_OPTIONS(self, request):
respond_with_json(request, 200, {}, send_cors=True)