Disable host filter lookup for users who don't have edit permissions. Hide delete/edit inv list icons for users who don't have proper permissions.

This commit is contained in:
mabashian
2017-08-23 12:11:40 -04:00
parent 0cbe083dcf
commit 29fcf336c1
4 changed files with 6 additions and 7 deletions

View File

@@ -98,8 +98,7 @@ export default ['i18n', function(i18n) {
ngClick: 'editInventory(inventory)', ngClick: 'editInventory(inventory)',
awToolTip: i18n._('Edit inventory'), awToolTip: i18n._('Edit inventory'),
dataPlacement: 'top', dataPlacement: 'top',
ngShow: 'inventory.summary_fields.user_capabilities.edit', ngShow: '!inventory.pending_deletion && inventory.summary_fields.user_capabilities.edit'
ngHide: 'inventory.pending_deletion'
}, },
view: { view: {
label: i18n._('View'), label: i18n._('View'),
@@ -113,8 +112,7 @@ export default ['i18n', function(i18n) {
ngClick: "deleteInventory(inventory.id, inventory.name)", ngClick: "deleteInventory(inventory.id, inventory.name)",
awToolTip: i18n._('Delete inventory'), awToolTip: i18n._('Delete inventory'),
dataPlacement: 'top', dataPlacement: 'top',
ngShow: 'inventory.summary_fields.user_capabilities.delete', ngShow: '!inventory.pending_deletion && inventory.summary_fields.user_capabilities.delete'
ngHide: 'inventory.pending_deletion'
}, },
pending_deletion: { pending_deletion: {

View File

@@ -10,7 +10,8 @@ export default ['templateUrl', '$compile',
function(templateUrl, $compile) { function(templateUrl, $compile) {
return { return {
scope: { scope: {
hostFilter: '=' hostFilter: '=',
fieldIsDisabled: '='
}, },
restrict: 'E', restrict: 'E',
templateUrl: templateUrl('inventories-hosts/inventories/smart-inventory/smart-inventory-host-filter/smart-inventory-host-filter'), templateUrl: templateUrl('inventories-hosts/inventories/smart-inventory/smart-inventory-host-filter/smart-inventory-host-filter'),

View File

@@ -1,6 +1,6 @@
<div class="input-group Form-mixedInputGroup"> <div class="input-group Form-mixedInputGroup">
<span class="input-group-btn Form-variableHeightButtonGroup"> <span class="input-group-btn Form-variableHeightButtonGroup">
<button type="button" class="Form-lookupButton Form-lookupButton--variableHeight btn btn-default" ng-click="openHostFilterModal()"> <button type="button" class="Form-lookupButton Form-lookupButton--variableHeight btn btn-default" ng-click="openHostFilterModal()" ng-disabled="fieldIsDisabled">
<i class="fa fa-search"></i> <i class="fa fa-search"></i>
</button> </button>
</span> </span>

View File

@@ -64,7 +64,7 @@ export default ['i18n', 'InventoryCompletedJobsList', function(i18n, InventoryCo
smart_hosts: { smart_hosts: {
label: i18n._('Smart Host Filter'), label: i18n._('Smart Host Filter'),
type: 'custom', type: 'custom',
control: '<smart-inventory-host-filter host-filter="smart_hosts"></smart-inventory-host-filter>', control: '<smart-inventory-host-filter host-filter="smart_hosts" field-is-disabled="!(inventory_obj.summary_fields.user_capabilities.edit || canAdd)"></smart-inventory-host-filter>',
awPopOver: "<p>" + i18n._("Populate the hosts for this inventory by using a search filter.") + "</p><p>" + i18n._("Example: ansible_facts.ansible_distribution:\"RedHat\"") + "</p><p>" + i18n._("Refer to the Ansible Tower documentation for further syntax and examples.") + "</p>", awPopOver: "<p>" + i18n._("Populate the hosts for this inventory by using a search filter.") + "</p><p>" + i18n._("Example: ansible_facts.ansible_distribution:\"RedHat\"") + "</p><p>" + i18n._("Refer to the Ansible Tower documentation for further syntax and examples.") + "</p>",
dataTitle: i18n._('Smart Host Filter'), dataTitle: i18n._('Smart Host Filter'),
dataPlacement: 'right', dataPlacement: 'right',