Skip to content

Commit

Permalink
Hide "Add New Network Manager" unless Nuage is enabled
Browse files Browse the repository at this point in the history
Nuage is somewhat special in a way it allows adding NetworkManager
directly, without CloudManager. For all other providers such behavior
is not feasible, therefore "Add New Network Manager" button should be
hidden.

With this commit we make sure that the button is hidden unless
config/permissions.yaml file contains entry allowing user to use
Nuage provider:

```
- ems-type:nuage_network
```

BZ: https://bugzilla.redhat.com/show_bug.cgi?id=1577888

Signed-off-by: Miha Pleško <[email protected]>
  • Loading branch information
miha-plesko committed May 23, 2018
1 parent ada1328 commit ebde790
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions app/helpers/application_helper/button/ems_network.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
class ApplicationHelper::Button::EmsNetwork < ApplicationHelper::Button::Basic
def visible?
# Nuage is only provider that supports adding NetworkProvider manually
# therefore we hide drop-down option completely unless Nuage is enabled.
return ::Settings.product.nuage unless @record # add new
# therefore we hide drop-down option completely unless Nuage is listed
# in config/permissions.yaml.
return Vmdb::PermissionStores.instance.supported_ems_type?('nuage_network') unless @record # allow add new network manager

@record.supports?(:ems_network_new) # edit
@record.supports?(:ems_network_new) # allow edit of existing manager
end
end

0 comments on commit ebde790

Please sign in to comment.