mirror of
https://github.com/ansible/awx.git
synced 2026-03-18 17:37:30 -02:30
Merge pull request #4863 from chrismeyersfsu/fix-4787
hide add permissions when editing super user
This commit is contained in:
@@ -221,9 +221,12 @@ export function UsersEdit($scope, $rootScope, $location,
|
|||||||
init();
|
init();
|
||||||
|
|
||||||
function init() {
|
function init() {
|
||||||
|
$scope.hidePagination = false;
|
||||||
|
$scope.hideSmartSearch = false;
|
||||||
$scope.user_type_options = user_type_options;
|
$scope.user_type_options = user_type_options;
|
||||||
$scope.user_type = user_type_options[0];
|
$scope.user_type = user_type_options[0];
|
||||||
$scope.$watch('user_type', user_type_sync($scope));
|
$scope.$watch('user_type', user_type_sync($scope));
|
||||||
|
$scope.$watch('is_superuser', hidePermissionsTabSmartSearchAndPaginationIfSuperUser($scope));
|
||||||
Rest.setUrl(defaultUrl);
|
Rest.setUrl(defaultUrl);
|
||||||
Wait('start');
|
Wait('start');
|
||||||
Rest.get(defaultUrl).success(function(data) {
|
Rest.get(defaultUrl).success(function(data) {
|
||||||
@@ -271,6 +274,20 @@ export function UsersEdit($scope, $rootScope, $location,
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Organizations and Teams tab pagination is hidden through other mechanism
|
||||||
|
function hidePermissionsTabSmartSearchAndPaginationIfSuperUser(scope) {
|
||||||
|
return function(isSuperuserNewValue) {
|
||||||
|
let shouldHide = isSuperuserNewValue;
|
||||||
|
if (shouldHide === true) {
|
||||||
|
scope.hidePagination = true;
|
||||||
|
scope.hideSmartSearch = true;
|
||||||
|
} else if (shouldHide === false) {
|
||||||
|
scope.hidePagination = false;
|
||||||
|
scope.hideSmartSearch = false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
function setScopeFields(data) {
|
function setScopeFields(data) {
|
||||||
_(data)
|
_(data)
|
||||||
|
|||||||
@@ -210,7 +210,7 @@ export default
|
|||||||
awToolTip: i18n._('Grant Permission'),
|
awToolTip: i18n._('Grant Permission'),
|
||||||
actionClass: 'btn List-buttonSubmit',
|
actionClass: 'btn List-buttonSubmit',
|
||||||
buttonContent: '+ ' + i18n._('ADD PERMISSIONS'),
|
buttonContent: '+ ' + i18n._('ADD PERMISSIONS'),
|
||||||
ngShow: '(user_obj.summary_fields.user_capabilities.edit || canAdd)'
|
ngShow: '(!is_superuser && (user_obj.summary_fields.user_capabilities.edit || canAdd))'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
fieldActions: {
|
fieldActions: {
|
||||||
|
|||||||
@@ -1844,7 +1844,7 @@ angular.module('FormGenerator', [GeneratorHelpers.name, 'Utilities', listGenerat
|
|||||||
// smart-search directive
|
// smart-search directive
|
||||||
html += `
|
html += `
|
||||||
<div
|
<div
|
||||||
ng-hide="${itm}.length === 0 && (searchTags | isEmpty)">
|
ng-hide="(${itm}.length === 0 && (searchTags | isEmpty)) || hideSmartSearch === true">
|
||||||
<smart-search
|
<smart-search
|
||||||
django-model="${itm}"
|
django-model="${itm}"
|
||||||
search-size="${width}"
|
search-size="${width}"
|
||||||
@@ -1983,7 +1983,7 @@ angular.module('FormGenerator', [GeneratorHelpers.name, 'Utilities', listGenerat
|
|||||||
//html += "</div>\n"; // close well
|
//html += "</div>\n"; // close well
|
||||||
html += "</div>\n"; // close list-wrapper div
|
html += "</div>\n"; // close list-wrapper div
|
||||||
|
|
||||||
html += `<paginate base-path="${collection.basePath}" dataset="${collection.iterator}_dataset" iterator="${collection.iterator}">`;
|
html += `<paginate base-path="${collection.basePath}" dataset="${collection.iterator}_dataset" iterator="${collection.iterator}" ng-hide="hidePagination">`;
|
||||||
return html;
|
return html;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user