Remove redundant API access check decorators.

Review Request #13390 — Created Oct. 30, 2023 and submitted — Latest diff uploaded

Information

Review Board
release-5.0.x

Reviewers

Our base class for API resources checks for Local Site access and login
requirements by way of decorators on the get(), get_list(), and
delete() methods (create() and update() implementations all apply
their own decorators today).

Most of our resources augment these handler functions, utilizing these
decorators. However, many of these then re-apply the same decorators,
creating redundant checks that may hit the database a second time
unnecessarily.

This change audits the code, carefully removing only the redundant
decorators. This was done by adding assertions to the decorators to see
if they were already applied and then, one-by-one, running the test
suite, seeing an assertion in loading the code, and removing the
duplicate decorator. No decorators other than those flagged as
duplicates have been removed.

This has the additional effect of improving performance on Local Sites
by reducing the database queries by 1 for each request.

All unit tests passed.

Tested a handful of queries using in-progress query assertion work
and verified that the excess queries were gone.

Commits

Files

    Loading...