Remove redundant API access check decorators.
Review Request #13390 — Created Oct. 30, 2023 and submitted
Our base class for API resources checks for Local Site access and login
requirements by way of decorators on the
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
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.
- Added back a decorator to the diffcommit resource, since we override rather than augmenting
- Added assertions to the standard unit test mixins to make sure that every single HTTP handler has Local Site and login-related decorators applied.
Revision 2 (+122 -148)