-
Notifications
You must be signed in to change notification settings - Fork 141
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
User/Role/Feature lookup improvements #888
base: master
Are you sure you want to change the base?
User/Role/Feature lookup improvements #888
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is simple and really nice
one question on the if else, but just a nit
We've made changes exactly like this in the past, so they follow a common pattern.
But I am surprised how much of an impact it made.
very nice find
890fe16
to
f28b015
Compare
Looks like I have a lot of broken tests to fix... I will look into that today. Edit: Actually, this needs a cross repo test for this to function, so will work on that at some point. |
validate_userid(userid) | ||
def generate_token(user_or_id, requester_type, token_ttl: nil) | ||
if user_or_id.kind_of?(User) | ||
userid = user_or_id.userid.downcase |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we still need to do the validation? (at least the "in my region" aspect of what the validate method does)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I may have screwed up the if
here, and the end
should be a line earlier... let me look into this...
(sorry I took so long to respond to this...)
f28b015
to
47a8ae2
Compare
47a8ae2
to
cd3e8d1
Compare
Use the new `:lookup_scope` argument for `.authenticate` and `.lookup_by_identity` to reduce the number of user based queries on every request.
While `virtual_delegates` can be used to improve performance via a single attribute in a query, we already bring back the `miq_user_role` (via the lookup_scope), so it is better to just use that. And currently virtual_delegates don't support already loaded relationships.
cd3e8d1
to
633d396
Compare
There are a few places in the API where we re-fetch the User when it is already available. These fixes allow for making use of the existing user that already exists instead of calling another lookup. The two places involved are: - When authenticating using .basic_authentication - When generating a token for the user (on login)
633d396
to
db287af
Compare
This pull request has been automatically marked as stale because it has not been updated for at least 3 months. If these changes are still valid, please remove the Thank you for all your contributions! More information about the ManageIQ triage process can be found in the triage process documentation. |
This pull request has been automatically closed because it has not been updated for at least 3 months. Feel free to reopen this pull request if these changes are still valid. Thank you for all your contributions! More information about the ManageIQ triage process can be found in the triage process documentation. |
cc @kbrock |
Checked commits NickLaMuro/manageiq-api@d1c9e09~...db287af with ruby 2.6.10, rubocop 1.28.2, haml-lint 0.35.0, and yamllint app/controllers/api/base_controller/authentication.rb
|
This pull request has been automatically marked as stale because it has not been updated for at least 3 months. If these changes are still valid, please remove the Thank you for all your contributions! More information about the ManageIQ triage process can be found in the triage process documentation. |
This pull request has been automatically marked as stale because it has not been updated for at least 3 months. If these changes are still valid, please remove the |
This pull request has been automatically marked as stale because it has not been updated for at least 3 months. If these changes are still valid, please remove the |
2 similar comments
This pull request has been automatically marked as stale because it has not been updated for at least 3 months. If these changes are still valid, please remove the |
This pull request has been automatically marked as stale because it has not been updated for at least 3 months. If these changes are still valid, please remove the |
Requires ManageIQ/manageiq#20506
Makes use of new scopes to improve the number of queries required for login and even regular requests (though, the latter is less significant).
Also avoids some duplicate
User
lookups on login.Benchmarks
Note: Improvements are in number of queries.
Before
After
Links