Skip to content
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 Switch model to RBAC #17964

Merged
merged 1 commit into from
Sep 12, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/rbac/filterer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ class Filterer
Service
ServiceTemplate
Storage
Switch
VmOrTemplate
)

Expand Down
18 changes: 18 additions & 0 deletions spec/lib/rbac/filterer_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,24 @@ def combine_filtered_ids(user_filtered_ids, belongsto_filtered_ids, managed_filt
tagged_group.save!
end

context 'searching for instances of Switches' do
let!(:switch) { FactoryGirl.create_list(:switch, 2).first }

before do
switch.tag_with('/managed/environment/prod', :ns => '*')
end

it 'lists only tagged Switches' do
results = described_class.search(:class => Switch, :user => user).first
expect(results).to match_array [switch]
end

it 'lists only all Switches' do
results = described_class.search(:class => Switch, :user => admin_user).first
expect(results).to match_array Switch.all
end
end

context 'searching for instances of ConfigurationScriptSource' do
let!(:configuration_script_source) { FactoryGirl.create_list(:embedded_ansible_configuration_script_source, 2).first }

Expand Down