-
Notifications
You must be signed in to change notification settings - Fork 897
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
Add default of admin to requester in make retire request #18109
Conversation
@miq-bot add_reviewer @bdunne |
Checked commit d-m-u@244a248 with ruby 2.3.3, rubocop 0.52.1, haml-lint 0.20.0, and yamllint 1.10.0 app/models/mixins/retirement_mixin.rb
|
@@ -10,7 +10,7 @@ module RetirementMixin | |||
end | |||
|
|||
module ClassMethods | |||
def make_retire_request(*src_ids, requester) | |||
def make_retire_request(*src_ids, requester = User.find_by(:userid => 'admin')) |
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.
Why 'admin' here and User.current_user.userid
everywhere else?
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.
Because we shouldn't be doing retirement based on current_user, it should be from the evm_owner, and if not one of those, admin. Otherwise the system retirement can run with different users on a retry.
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.
agreed
def make_retire_request(*src_ids, requester = User.current_user)
If you want the userid - please use User.current_userid
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 don't want current_user here at all. The place we use it is from the UI where it makes sense that we want the user who clicked on retirement. It should not be in make_retire_request. We're not using "User.current_user.userid
everywhere else", Brandon, that was the point of the changes yesterday.
Since the merge of #17951, which adds a system_context for retirement, make_retire_request takes a user.
Brandon thinks make_retire_request should have a default user, and Tina thinks if we must have one, it should be admin. So. Boooya.
Bug: https://bugzilla.redhat.com/show_bug.cgi?id=1618530
related:
ManageIQ/manageiq-api#497