Redirect some views in read-only mode, hide links to these views

Review Request #8811 - Created March 11, 2017 and updated

Kanghee Park
Review Board
8810, 8657, 8648
8861, 8812, 8824, 8847
reviewboard, students

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. This commit adds a decorator that wraps
login_required. If no arguments are passed into the new
login_required it will behave the same as django's login_required.
If a boolean value for redirect_read_only is set to true, a decorator
that checks whether the user is in read-only mode and should redirect
will be returned.

"New Review Request" and "My Accounts" now redirect to a Read-Only page
and "Register" redirects to "Log-in". Buttons to these pages are
removed for users affected in read-only mode.

  • Check that accessing New Review Request and My Accounts redirects to
    503 page logged in as non-admin in read-only mode
  • Check that accessing Register when logged in or not redirects to the
    log-in page
  • Check that links to New Review/My Accounts/Register are removed for
    non-admins/unauthenticated users
  • Check that submitting Register form when in read-only mode does not
    do any writes
  • 0
  • 0
  • 12
  • 2
  • 14
Description From Last Updated
Review Bot
Kanghee Park
Review Bot
Barret Rennie
Kanghee Park
Review Bot
Barret Rennie
Kanghee Park
Kanghee Park
Review request changed

Checks run (2 succeeded, 1 failed with error)

JSHint passed.
PEP8 Style Checker internal error.
Pyflakes passed.