Use admin_patterns for all admin APIs. (#8331)

This reduces duplication of the admin prefix in regular expressions.
This commit is contained in:
Patrick Cloke 2020-09-17 07:04:15 -04:00 committed by GitHub
parent 53284c425e
commit c3c9732c53
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 20 additions and 26 deletions

View file

@ -12,14 +12,13 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import re
from synapse.http.servlet import (
RestServlet,
assert_params_in_dict,
parse_json_object_from_request,
)
from synapse.rest.admin import assert_requester_is_admin
from synapse.rest.admin._base import admin_patterns
class PurgeRoomServlet(RestServlet):
@ -35,7 +34,7 @@ class PurgeRoomServlet(RestServlet):
{}
"""
PATTERNS = (re.compile("^/_synapse/admin/v1/purge_room$"),)
PATTERNS = admin_patterns("/purge_room$")
def __init__(self, hs):
"""