Remove redundant API access check decorators.

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

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.

Summary ID
Remove redundant API access check decorators.
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.
42bf8f3d98acb5c272e88693086893f66547756d
david
  1. Ship It!
  2. 
      
maubin
  1. Ship It!
  2. 
      
chipx86
david
  1. Ship It!
  2. 
      
chipx86
Review request changed
Status:
Completed
Change Summary:
Pushed to release-5.0.x (469cf6f)