-
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
Tenant admin should not be able to create groups in other tenants. #13483
Conversation
aa65922
to
f60f606
Compare
Checked commit martinpovolny@f60f606 with ruby 2.2.5, rubocop 0.37.2, and haml-lint 0.16.1 app/models/tenant.rb
spec/models/tenant_spec.rb
|
The test failure is unrelated. Ping @kbrock |
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 nice martin.
Just a few minor changes.
Do we test where you have access to the child but not the parent (I don't think this will ever be the case, but the double query in tenant_and_project_names
suggests it may be so)
all_tenants_and_projects = Tenant.in_my_region.select(:id, :ancestry, :divisible, :use_config_for_attributes, :name) | ||
tenants_by_id = all_tenants_and_projects.index_by(&:id) | ||
|
||
tenants_and_projects = Rbac.filtered(Tenant.in_my_region.select(:id, :ancestry, :divisible, :use_config_for_attributes, :name)) |
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 it is better to pass the local variable into rbac (could you verify it is not worse?):
tenants_and_projects = Rbac.filtered(all_tenants_and_projects)
bummed about the double query here, but looks necessary
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's not clear to me why all_tenants_and_projects
can't be passed into Rbac.filtered
. @martinpovolny, @kbrock?
@@ -854,16 +859,22 @@ | |||
stub_settings(:server => {:company => "root"}) | |||
end | |||
|
|||
#before(:all) 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 would prefer create_guid_miq_server_zone
over
allow(user).to receive(:get_timezone).and_return("UTC")
if that fixes things
f60f606
to
092d6b5
Compare
I am using the parent to construct the name path to the child. To keep the functionality I need to access the names of the parents that the user does not have access to. Therefor I test the RBAC in one branch and not the other one. And for the same reason I need the two queries. |
I changed the spec. |
092d6b5
to
c1df336
Compare
ManageIQ/manageiq-ui-classic#134 This is only a part of the fix. The 2nd part needs fixing on the manageiq-ui-classic side.
c1df336
to
48d0fd6
Compare
@kbrock : I reverted the changed spec, because the method that you suggested seeds some tenants and breaks many of the tests. |
👍 LGTM |
@Fryguy, @dclarizio : merge, please? |
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
@martinpovolny Can you please create a BZ if it doesn't already exist? |
Tenant admin should not be able to create groups in other tenants. (cherry picked from commit be680ff) https://bugzilla.redhat.com/show_bug.cgi?id=1415217
Euwe backport details:
|
ManageIQ/manageiq-ui-classic#134
This is only a part of the fix. The 2nd part needs fixing on the
manageiq-ui-classic side.
Issue: ManageIQ/manageiq-ui-classic#134
ManageIQ/manageiq-ui-classic#151