mirror of
https://github.com/ansible/awx.git
synced 2026-01-13 02:50:02 -03:30
fixed permissions adhoc checkbox stuff
This commit is contained in:
parent
86cb23117f
commit
e8db7d7c77
@ -136,6 +136,7 @@ export function PermissionsAdd($scope, $rootScope, $compile, $location, $log, $r
|
||||
master.category = 'Inventory';
|
||||
master.inventoryrequired = true;
|
||||
master.projectrequired = false;
|
||||
$scope.run_ad_hoc_commands = false;
|
||||
|
||||
LookUpInit({
|
||||
scope: $scope,
|
||||
@ -155,6 +156,22 @@ export function PermissionsAdd($scope, $rootScope, $compile, $location, $log, $r
|
||||
input_type: 'radio'
|
||||
});
|
||||
|
||||
$scope.changeAdhocCommandCheckbox = function () {
|
||||
if ($scope.category === 'Deploy') {
|
||||
$scope.run_ad_hoc_command = false;
|
||||
} else {
|
||||
if ($scope.permission_type === 'admin') {
|
||||
$scope.run_ad_hoc_commands = true;
|
||||
$("#permission_run_ad_hoc_commands_chbox").attr("disabled", true);
|
||||
} else {
|
||||
if (!$scope.run_ad_hoc_commands) {
|
||||
$scope.run_ad_hoc_commands = false;
|
||||
}
|
||||
$("#permission_run_ad_hoc_commands_chbox").attr("disabled", false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Save
|
||||
$scope.formSave = function () {
|
||||
var fld, url, data = {};
|
||||
@ -226,12 +243,25 @@ export function PermissionsEdit($scope, $rootScope, $compile, $location, $log, $
|
||||
defaultUrl = GetBasePath('base') + 'permissions/' + id + '/',
|
||||
master = {};
|
||||
|
||||
$scope.changeAdhocCommandCheckbox = function () {
|
||||
if ($scope.category === 'Deploy') {
|
||||
$scope.run_ad_hoc_command = false;
|
||||
} else {
|
||||
if ($scope.permission_type === 'admin') {
|
||||
$scope.run_ad_hoc_commands = true;
|
||||
$("#permission_run_ad_hoc_commands_chbox").attr("disabled", true);
|
||||
} else {
|
||||
if (!$scope.run_ad_hoc_commands) {
|
||||
$scope.run_ad_hoc_commands = false;
|
||||
}
|
||||
$("#permission_run_ad_hoc_commands_chbox").attr("disabled", false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
generator.inject(form, { mode: 'edit', related: true, scope: $scope });
|
||||
generator.reset();
|
||||
|
||||
|
||||
|
||||
|
||||
$scope.selectCategory = function (resetIn) {
|
||||
var reset = (resetIn === false) ? false : true;
|
||||
PermissionCategoryChange({ scope: $scope, reset: reset });
|
||||
@ -285,6 +315,8 @@ export function PermissionsEdit($scope, $rootScope, $compile, $location, $log, $
|
||||
input_type: 'radio'
|
||||
});
|
||||
|
||||
$scope.changeAdhocCommandCheckbox();
|
||||
|
||||
if (!$scope.PermissionAddAllowed) {
|
||||
// If not a privileged user, disable access
|
||||
$('form[name="permission_form"]').find('select, input, button').each(function () {
|
||||
|
||||
@ -97,6 +97,7 @@ export default
|
||||
labelClass: 'prepend-asterisk',
|
||||
type: 'radio_group',
|
||||
class: 'squeeze',
|
||||
ngChange: 'changeAdhocCommandCheckbox()',
|
||||
options: [{
|
||||
label: 'Read',
|
||||
value: 'read',
|
||||
|
||||
@ -671,10 +671,6 @@ angular.module('FormGenerator', [GeneratorHelpers.name, 'Utilities', listGenerat
|
||||
html += Attr(field, 'type');
|
||||
html += "ng-model=\"" + fld + '" ';
|
||||
html += "name=\"" + fld + '" ';
|
||||
if (form.name === "permission") {
|
||||
html += "ng-disabled='permission_type === \"admin\"'";
|
||||
html += "ng-checked='permission_type === \"admin\"'";
|
||||
}
|
||||
html += (field.ngChange) ? Attr(field, 'ngChange') : "";
|
||||
html += "id=\"" + form.name + "_" + fld + "_chbox\" ";
|
||||
html += (idx !== undefined) ? "_" + idx : "";
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user