Skip to content

Commit

Permalink
Add Lan and Switch model to RBAC in filterer
Browse files Browse the repository at this point in the history
  • Loading branch information
lpichler committed Sep 11, 2018
1 parent 85265cd commit e497360
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
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

0 comments on commit e497360

Please sign in to comment.