-
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 belongsto filter for other network models #16151
Add belongsto filter for other network models #16151
Conversation
when we will filter these network models by RBAC we will need apply filter entered in belongsto filter (H & C tab in group setting) - this array will help to handle this situation.
@lpichler Cannot apply the following labels because they are not recognized: fine, euwe |
spec/lib/rbac/filterer_spec.rb
Outdated
end | ||
|
||
it 'lists no cloud networks' do | ||
it 'doesn\'t list cloud networks' do |
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 most specs use "
to avoid these issues.
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.
👍 changed to ", in the separated commit, thanks
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.
It looks like this is another one. The last commit fixes a different escaped single quote.
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.
yes I missed one context
6df1b54
to
daf00cd
Compare
@jrafanie I added parentheses https://github.com/ManageIQ/manageiq/pull/16151/files#diff-8d948055de14ced0e63abf9637a9a788R590, |
if [ExtManagementSystem, Host].any? { |x| vcmeta.kind_of?(x) } && klass <= VmOrTemplate || | ||
vcmeta.kind_of?(ManageIQ::Providers::NetworkManager) && klass <= CloudNetwork | ||
if ([ExtManagementSystem, Host].any? { |x| vcmeta.kind_of?(x) } && klass <= VmOrTemplate) || | ||
(vcmeta.kind_of?(ManageIQ::Providers::NetworkManager) && NETWORK_MODELS_FOR_BELONGSTO_FILTER.any? { |association_class| klass <= association_class.safe_constantize }) |
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.
As discussed, as a followup for master, we'll give this conditional a method name that hopefully makes more sense.
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.
👍 🗒
lib/rbac/filterer.rb
Outdated
SecurityGroup | ||
FloatingIp | ||
NetworkPort | ||
LoadBalancer |
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.
For the future, we should find a way to not hardcode this list because we'll need to update this list the moment we add something new.
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.
Can this be sorted alphabetically?
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.
spec/lib/rbac/filterer_spec.rb
Outdated
NetworkRouter | ||
SecurityGroup | ||
ManageIQ::Providers::NetworkManager | ||
).freeze |
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.
Can you use the rbac filterer's constant instead of having another hardcoded list?
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.
👍
spec/lib/rbac/filterer_spec.rb
Outdated
FactoryGirl.create(network_model.underscore, :ext_management_system => network_manager_1) | ||
end | ||
|
||
context "when records match belognsto filter" do |
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 know you moved this but it's typo'd: belongsto
spec/lib/rbac/filterer_spec.rb
Outdated
end | ||
end | ||
|
||
context "when records don't match belognsto filter" do |
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.
same typo
daf00cd
to
d1205f2
Compare
and put it on the same level as context 'when records match belognsto filter' context 'when records don\'t match belognsto filter'
exception is network manager - it is already created in upper block
we need to add together cases with are using cloud_network and cloud_network_1 models
d1205f2
to
881f347
Compare
spec/lib/rbac/filterer_spec.rb
Outdated
NetworkRouter, | ||
SecurityGroup, | ||
ManageIQ::Providers::NetworkManager | ||
].freeze |
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.
Sorry @lpichler, I wasn't clear. Can you do described_class::NETWORK_MODELS_FOR_BELONGSTO_FILTER
+ ManageIQ::Providers::NetworkManager
so we're not duplicating the hardcoded list here and the code?
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.
👍 oh yes sure, I read it badly
881f347
to
3fd9feb
Compare
Checked commits lpichler/manageiq@f9fc44f~...3fd9feb with ruby 2.3.3, rubocop 0.47.1, and haml-lint 0.20.0 |
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.
LGTM once green
…work_model Add belongsto filter for other network models (cherry picked from commit cf2f4e7) https://bugzilla.redhat.com/show_bug.cgi?id=1465093
Euwe backport details:
|
…work_model Add belongsto filter for other network models (cherry picked from commit cf2f4e7) https://bugzilla.redhat.com/show_bug.cgi?id=1463422
Fine backport details:
|
…for_newtwork_model Add belongsto filter for other network models (cherry picked from commit cf2f4e7) https://bugzilla.redhat.com/show_bug.cgi?id=1463422
same thing as was done in #16063
but for other models in Network menu
belongsto filter is H & C tab in the group setting as is shown on the picture:
Description of bug:
We have selected network manager but for some models this filter is not applied:
and we have 2 network manager one is openstack and second azure
before:
example for CloudSubnet, you can see also CloudSubnet for openstack network manager
we need to see only Azure's CloudSubnets
so I added this rule other models as we did in #16063
after:
Links
EUWE BZ:https://bugzilla.redhat.com/show_bug.cgi?id=1465093
FINE BZ:https://bugzilla.redhat.com/show_bug.cgi?id=1463422
@miq-bot add_label blocker, rbac, bug, fine, euwe
@miq-bot assign @gtanzillo