-
Notifications
You must be signed in to change notification settings - Fork 356
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
Fix logic for service ownership #2725
Fix logic for service ownership #2725
Conversation
@@ -213,7 +213,11 @@ def ownership_handle_reset_button | |||
|
|||
def filter_ownership_items(klass, ownership_ids) | |||
records = find_records_with_rbac(klass.order(:name), ownership_ids) | |||
records.with_ownership if klass.respond_to?(:with_ownership) | |||
if klass.respond_to?(:with_ownership) | |||
records.with_ownership if klass.respond_to?(:with_ownership) |
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.
@mzazrivec I guess it there is condition accidentally duplicated.
maybe together can be
records.try(:with_ownership) || records
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.
@lpichler fixed, thanks.
The broken logic would return nil in case the class in question (Service, Vm, Template ...) doesn't support (respond to) with_ownership class method -> this would seem like the class in question doesn't support ownership change. https://bugzilla.redhat.com/show_bug.cgi?id=1512644
799411e
to
814a12c
Compare
@miq-bot assign @martinpovolny |
Checked commit mzazrivec@814a12c with ruby 2.3.3, rubocop 0.47.1, haml-lint 0.20.0, and yamllint 1.10.0 |
What if In that case Is that ok? |
Good point, but that's probably more a backend question. @lpichler ? |
@mzazrivec yes it is ok origin code before refactoring: |
Fix logic for service ownership (cherry picked from commit ef4d71e) https://bugzilla.redhat.com/show_bug.cgi?id=1517950
Gaprindashvili backport details:
|
The broken logic would return
nil
in case the class in question (Service, Vm, Template ...)doesn't support (respond to)
with_ownership
class method -> this would seemlike the class in question doesn't support ownership change.
https://bugzilla.redhat.com/show_bug.cgi?id=1512644