-
Notifications
You must be signed in to change notification settings - Fork 361
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Check space/org permissions by id, not guid #3021
Merged
philippthun
merged 7 commits into
cloudfoundry:main
from
sap-contributions:cut-guid-lookups
Oct 28, 2022
Merged
Check space/org permissions by id, not guid #3021
philippthun
merged 7 commits into
cloudfoundry:main
from
sap-contributions:cut-guid-lookups
Oct 28, 2022
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
will-gant
force-pushed
the
cut-guid-lookups
branch
16 times, most recently
from
October 18, 2022 15:32
9a680a9
to
2417c9a
Compare
philippthun
reviewed
Oct 19, 2022
Cool, just ran this successfully through the cf-acceptance-tests (a partial run), swapping this PR in for apps |
Prior to this many controllers did a DB query for a space/org to retrieve its guid, which was ultimately passed to VCAP::CloudController::Membership, which would use the guid to do a DB query looking up the exact same thing so its id could be retrieved. In these cases we now retrieve the id in the first query and just pass this through.
Prior to this many controllers did a DB query for a space/org to retrieve its guid, which was ultimately passed to VCAP::CloudController::Membership, which would use the guid to do a DB query looking up the exact same thing so its id could be retrieved. In these cases we now retrieve the id in the first query and just pass this through.
will-gant
force-pushed
the
cut-guid-lookups
branch
from
October 20, 2022 14:19
2417c9a
to
d61a5c6
Compare
philippthun
reviewed
Oct 24, 2022
will-gant
force-pushed
the
cut-guid-lookups
branch
from
October 25, 2022 15:14
d7e2ea4
to
f633438
Compare
philippthun
reviewed
Oct 27, 2022
philippthun
approved these changes
Oct 28, 2022
will-gant
added a commit
to sap-contributions/cloud_controller_ng
that referenced
this pull request
Dec 16, 2022
Prior to this many controllers did a DB query for a space/org to retrieve its guid, which was ultimately passed to VCAP::CloudController::Membership, which would use the guid to do a DB query looking up the exact same thing so its id could be retrieved. In these cases we now retrieve the id in the first query and just pass this through.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Thanks for contributing to cloud_controller_ng. To speed up the process of reviewing your pull request please provide us with:
A short explanation of the proposed change:
Optimizes the way controllers check user permissions by cutting out lots and lots of duplicate DB queries for spaces and orgs.
An explanation of the use cases your change solves:
Until now we've been doing something like this for a large chunk of API calls:
Basically a controller action does a DB query to look up an org or a space purely so it can pass the guid of whichever it is through (ultimately) to
VCAP::CloudController::Membership
. The latter then uses the guid to do another DB query to look up the same row to get that thing's id. Silly.The changes in summary:
spaces
table have anorganization_id
column.fetch
methods whose return values previously included an org. For some fetchers the org was only ever retrieved so its guid could passed for a permissions check. Such fetchers now no longer return orgs.Links to any other associated PRs:
n/a
I have reviewed the contributing guide
I have viewed, signed, and submitted the Contributor License Agreement
I have made this pull request to the
main
branchI have run all the unit tests using
bundle exec rake
I have run CF Acceptance Tests