-
Notifications
You must be signed in to change notification settings - Fork 898
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
Doesn't count with selection of belongsto filter if any object doesn't exist in the filter sentence #18651
Doesn't count with selection of belongsto filter if any object doesn't exist in the filter sentence #18651
Conversation
@miq-bot assign @gtanzillo @miq-bot add_label bug, rbac |
spec/lib/rbac/filterer_spec.rb
Outdated
end | ||
|
||
let(:dc) do | ||
datacenter = FactoryBot.create(:ems_folder, :name => "Datacenter1") |
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.
Shouldn't his be datacenter = FactoryBot.create(:datacenter, :name => "Datacenter1")
?
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.
thanks @gtanzillo
we are using for datacenter it EmsFolder - it is inherited from "belongsto filter sentence":
/belongsto/ExtManagementSystem|vCenter/EmsFolder|Datacenters/EmsFolder|EMEA CloudLab/EmsFolder|host/EmsCluster|Infrastructure
and there is used EmsFolder
for datacenter.
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 looks good (even w/o my question/suggestion)
Is this ready to go?
@@ -58,7 +58,7 @@ def self.belongsto2object_list(tag) | |||
obj.children.grep(tag_part_klass).detect { |c| c.name == name } | |||
end | |||
|
|||
return result unless obj | |||
return [] unless obj |
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.
Not sure about this. tired of returning []
all over the place. Does it make sense to return none
instead?
return [] unless obj | |
return none unless obj |
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.
none
is something in ruby ?
NameError (undefined local variable or method
none' for main:Object)`
@kbrock anyway we need []
because it means - that no object will displayed and other code count with []
in filterer - but I agree []
is confusing - so we need to bigger refactoring here - and I would leave it on other PR.
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.
Thanks. leave it as is. none
is an Active Record thing. e.g.: Vm.none
c61de29
to
628e1e0
Compare
yes. there is UI PR ManageIQ/manageiq-ui-classic#5511 which reflects those changes. thanks |
spec/lib/rbac/filterer_spec.rb
Outdated
end | ||
|
||
let(:hfolder) do | ||
hfolder = FactoryBot.create(:ems_folder, :name => "host") |
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.
ASIDE: have you tried:
FactoryBot.create(:ems_folder, :name => "host", :parent => dc)
or if that doesn't work,
FactoryBot.create(:ems_folder, :name => "host").tap { |hfolder| hfolder.parent = dc }
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.
that's right 👍 I used the tap
version. thanks!
628e1e0
to
dfbcb32
Compare
if not - presence of filter will ensure to displaying nothing and add method for human displaying of belongsto filter in MiqFilter
dfbcb32
to
76767c5
Compare
Checked commit lpichler@76767c5 with ruby 2.3.3, rubocop 0.52.1, haml-lint 0.20.0, and yamllint 1.10.0 |
thanks for merge GT - sorry @lpichler for the delay |
@lpichler |
…y_object_doenst_exists Doesn't count with selection of belongsto filter if any object doesn't exist in the filter sentence (cherry picked from commit fdc1b6d) https://bugzilla.redhat.com/show_bug.cgi?id=1710998
Hammer backport details:
|
let's have this structure
belonsto filter stored in a group of user
it will display just
Cluster1
but when you delete Cluster1
this belongsto filter will be unchanged in the group
and RBAC will display skip last element of belongsto filter (/EmsCluster|Cluster1) and
then RBAC will start behave like filter is just (without cluster:
so it will display everything under host
concretely it will display
Cluster2 (cluster)
and
Cluster3 (cluster)
this fix will display everything under
Cluster1
and it means nothing whenCluster1
doesn't exist.so and there is no way how remove this old filter from UI - so I guess, it is not good
but pretending that there is no filter will display everything what it unintended for user...
https://bugzilla.redhat.com/show_bug.cgi?id=1693183
Links
https://bugzilla.redhat.com/show_bug.cgi?id=1693183
ManageIQ/manageiq-ui-classic#5511 - UI part