1
0
mirror of https://github.com/ansible/awx.git synced 2024-11-01 08:21:15 +03:00

Disabling fields for auditors in CTinT

This commit is contained in:
Ken Hoes 2016-12-09 09:37:16 -05:00
parent 823debe242
commit 44e83dbcd7
5 changed files with 23 additions and 18 deletions

View File

@ -6,6 +6,7 @@
export default [
'$scope',
'$rootScope',
'$state',
'$stateParams',
'$timeout',
@ -25,6 +26,7 @@ export default [
'ParseTypeChange',
function(
$scope,
$rootScope,
$state,
$stateParams,
$timeout,
@ -167,6 +169,7 @@ export default [
placeholder: ConfigurationUtils.formatPlaceholder($scope.$parent.configDataResolve[key].placeholder, key) || null,
dataTitle: $scope.$parent.configDataResolve[key].label,
required: $scope.$parent.configDataResolve[key].required,
ngDisabled: $rootScope.user_is_system_auditor
});
}

View File

@ -362,6 +362,12 @@ export default [
$scope.toggleForm = function(key) {
if($rootScope.user_is_system_auditor) {
// Block system auditors from making changes
event.preventDefault();
return;
}
$scope[key] = !$scope[key];
Wait('start');
var payload = {};

View File

@ -6,6 +6,7 @@
export default [
'$scope',
'$rootScope',
'$state',
'$timeout',
'ConfigurationJobsForm',
@ -15,6 +16,7 @@ export default [
'GenerateForm',
function(
$scope,
$rootScope,
$state,
$timeout,
ConfigurationJobsForm,
@ -34,7 +36,7 @@ export default [
value: command
});
});
// Disable the save button for non-superusers
form.buttons.save.disabled = 'vm.updateProhibited';
@ -51,7 +53,8 @@ export default [
toggleSource: key,
dataPlacement: 'top',
dataTitle: $scope.$parent.configDataResolve[key].label,
required: $scope.$parent.configDataResolve[key].required
required: $scope.$parent.configDataResolve[key].required,
ngDisabled: $rootScope.user_is_system_auditor
});
}

View File

@ -5,9 +5,10 @@
*************************************************/
export default [
'$scope', '$state', 'AngularCodeMirror', 'ConfigurationSystemForm', 'ConfigurationService', 'ConfigurationUtils', 'GenerateForm',
'$rootScope', '$scope', '$state', 'AngularCodeMirror', 'Authorization', 'ConfigurationSystemForm', 'ConfigurationService',
'ConfigurationUtils', 'GenerateForm',
function(
$scope, $state, AngularCodeMirror, ConfigurationSystemForm, ConfigurationService, ConfigurationUtils, GenerateForm
$rootScope, $scope, $state, AngularCodeMirror, Authorization, ConfigurationSystemForm, ConfigurationService, ConfigurationUtils, GenerateForm
) {
var systemVm = this;
var generator = GenerateForm;
@ -29,7 +30,8 @@ export default [
toggleSource: key,
dataPlacement: 'top',
dataTitle: $scope.$parent.configDataResolve[key].label,
required: $scope.$parent.configDataResolve[key].required
required: $scope.$parent.configDataResolve[key].required,
ngDisabled: $rootScope.user_is_system_auditor
});
}
@ -40,18 +42,6 @@ export default [
related: true
});
$scope.$on('populated', function() {
// $scope.$parent.parseType = 'json';
// ParseTypeChange({
// scope: $scope.$parent,
// variable: 'LICENSE',
// parse_variable: 'parseType',
// field_id: 'configuration_system_template_LICENSE',
// readOnly: true
// });
});
angular.extend(systemVm, {
});

View File

@ -6,6 +6,7 @@
export default [
'$scope',
'$rootScope',
'$state',
'$timeout',
'ConfigurationUiForm',
@ -14,6 +15,7 @@
'GenerateForm',
function(
$scope,
$rootScope,
$state,
$timeout,
ConfigurationUiForm,
@ -54,7 +56,8 @@
toggleSource: key,
dataPlacement: 'top',
dataTitle: $scope.$parent.configDataResolve[key].label,
required: $scope.$parent.configDataResolve[key].required
required: $scope.$parent.configDataResolve[key].required,
ngDisabled: $rootScope.user_is_system_auditor
});
}