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