Respond to API requests with 503 when read-only mode
Review Request #8657 — Created Jan. 21, 2017 and submitted — Latest diff uploaded
Read-only mode is a setting an admin can enable to prevent writes to
the database. This can be used when the site is under maintenence or
being upgraded. The previous commit added the siteconfig attribute and
a checkbox to toggle the mode. This commit adds a new 503 error to
Review Board's webapi. Furthermore, all requests that hit RB's API
usingPUT
,POST
,DELETE
methods while read-only mode is on, and
the user is not a superuser, will return the new 503 error. A utility
fileread_only.py
has been added which deals with the logic and
caching of determining when a user should be affected by read-only
mode.
Added new Python unit tests that send API requests as superuser and
non-superuser
Ran the Python unit test suite
Check that modifying/deleting review requests and comments works
properly