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 theget()
,get_list()
, and
delete()
methods (create()
andupdate()
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.
Summary | ID |
---|---|
42bf8f3d98acb5c272e88693086893f66547756d |
- Change Summary:
-
- Added back a decorator to the diffcommit resource, since we override rather than augmenting
get()
. - Added assertions to the standard unit test mixins to make sure that every single HTTP handler has Local Site and login-related decorators applied.
- Added back a decorator to the diffcommit resource, since we override rather than augmenting
- Commits:
-
Summary ID 9aeb7ec5c50bd24ca84bc450b19f12b15d87310e 42bf8f3d98acb5c272e88693086893f66547756d - Diff:
-
Revision 2 (+122 -148)