From 8cff8e4202ade56cb729b79fb00f37e4f1100c4b Mon Sep 17 00:00:00 2001
From: John Mitchell
Date: Tue, 13 Sep 2016 13:46:44 -0400
Subject: [PATCH] remove use of canEdit in favor of user capabilities
---
awx/ui/client/src/controllers/Credentials.js | 12 ----
awx/ui/client/src/controllers/Projects.js | 12 ----
awx/ui/client/src/controllers/Teams.js | 12 ----
awx/ui/client/src/controllers/Users.js | 12 ----
awx/ui/client/src/forms/Credentials.js | 62 ++++++++--------
awx/ui/client/src/forms/Groups.js | 28 ++++----
awx/ui/client/src/forms/Hosts.js | 10 +--
awx/ui/client/src/forms/Inventories.js | 16 ++---
awx/ui/client/src/forms/JobTemplates.js | 54 +++++++-------
awx/ui/client/src/forms/Organizations.js | 12 ++--
awx/ui/client/src/forms/Projects.js | 34 ++++-----
awx/ui/client/src/forms/Teams.js | 14 ++--
awx/ui/client/src/forms/Users.js | 22 +++---
.../edit/inventory-edit.controller.js | 10 ---
.../list/inventory-list.controller.js | 2 -
.../manage/groups/groups-edit.controller.js | 16 +----
.../manage/hosts/hosts-edit.controller.js | 10 ---
.../inventory-scripts/add/add.controller.js | 2 -
.../inventory-scripts/edit/edit.controller.js | 13 ----
.../inventory-scripts.form.js | 14 ++--
.../inventory-scripts/list/list.controller.js | 2 -
.../edit/job-templates-edit.controller.js | 10 ---
.../list/job-templates-list.controller.js | 2 -
.../src/notifications/edit/edit.controller.js | 10 ---
.../list.controller.js | 2 -
.../notificationTemplates.form.js | 70 +++++++++----------
.../edit/organizations-edit.controller.js | 10 ---
.../list/organizations-list.controller.js | 2 -
.../src/partials/survey-maker-modal.html | 18 ++---
.../src/scheduler/scheduler.controller.js | 2 -
30 files changed, 180 insertions(+), 315 deletions(-)
diff --git a/awx/ui/client/src/controllers/Credentials.js b/awx/ui/client/src/controllers/Credentials.js
index 53c4c001b4..1696756ed3 100644
--- a/awx/ui/client/src/controllers/Credentials.js
+++ b/awx/ui/client/src/controllers/Credentials.js
@@ -18,14 +18,12 @@ export function CredentialsList($scope, $rootScope, $location, $log,
ClearScope();
$scope.canAdd = false;
- $scope.canEdit = false;
Rest.setUrl(GetBasePath('credentials'));
Rest.options()
.success(function(data) {
if (data.actions.POST) {
$scope.canAdd = true;
- $scope.canEdit = true;
}
});
@@ -367,16 +365,6 @@ export function CredentialsEdit($scope, $rootScope, $compile, $location, $log,
id = $stateParams.credential_id,
relatedSets = {};
- $scope.canEdit = false;
-
- Rest.setUrl(GetBasePath('credentials') + id);
- Rest.options()
- .success(function(data) {
- if (data.actions.PUT) {
- $scope.canEdit = true;
- }
- });
-
generator.inject(form, { mode: 'edit', related: true, scope: $scope });
generator.reset();
$scope.id = id;
diff --git a/awx/ui/client/src/controllers/Projects.js b/awx/ui/client/src/controllers/Projects.js
index 5c0803c3ce..2aa6d1ab9a 100644
--- a/awx/ui/client/src/controllers/Projects.js
+++ b/awx/ui/client/src/controllers/Projects.js
@@ -19,14 +19,12 @@ export function ProjectsList ($scope, $rootScope, $location, $log, $stateParams,
ClearScope();
$scope.canAdd = false;
- $scope.canEdit = false;
Rest.setUrl(GetBasePath('projects'));
Rest.options()
.success(function(data) {
if (data.actions.POST) {
$scope.canAdd = true;
- $scope.canEdit = true;
}
});
@@ -588,16 +586,6 @@ export function ProjectsEdit($scope, $rootScope, $compile, $location, $log,
id = $stateParams.id,
relatedSets = {};
- $scope.canEdit = false;
-
- Rest.setUrl(GetBasePath('projects') + id);
- Rest.options()
- .success(function(data) {
- if (data.actions.PUT) {
- $scope.canEdit = true;
- }
- });
-
// remove "type" field from search options
CredentialList = _.cloneDeep(CredentialList);
CredentialList.fields.kind.noSearch = true;
diff --git a/awx/ui/client/src/controllers/Teams.js b/awx/ui/client/src/controllers/Teams.js
index f78a5f13c9..08ed3c5f8f 100644
--- a/awx/ui/client/src/controllers/Teams.js
+++ b/awx/ui/client/src/controllers/Teams.js
@@ -18,14 +18,12 @@ export function TeamsList($scope, $rootScope, $location, $log, $stateParams,
ClearScope();
$scope.canAdd = false;
- $scope.canEdit = false;
Rest.setUrl(GetBasePath('teams'));
Rest.options()
.success(function(data) {
if (data.actions.POST) {
$scope.canAdd = true;
- $scope.canEdit = true;
}
});
@@ -226,16 +224,6 @@ export function TeamsEdit($scope, $rootScope, $location,
relatedSets = {},
set;
- $scope.canEdit = false;
-
- Rest.setUrl(GetBasePath('teams') + id);
- Rest.options()
- .success(function(data) {
- if (data.actions.PUT) {
- $scope.canEdit = true;
- }
- });
-
$scope.team_id = id;
diff --git a/awx/ui/client/src/controllers/Users.js b/awx/ui/client/src/controllers/Users.js
index 5e76269983..7033e6333d 100644
--- a/awx/ui/client/src/controllers/Users.js
+++ b/awx/ui/client/src/controllers/Users.js
@@ -38,14 +38,12 @@ export function UsersList($scope, $rootScope, $location, $log, $stateParams,
ClearScope();
$scope.canAdd = false;
- $scope.canEdit = false;
Rest.setUrl(GetBasePath('users'));
Rest.options()
.success(function(data) {
if (data.actions.POST) {
$scope.canAdd = true;
- $scope.canEdit = true;
}
});
@@ -292,16 +290,6 @@ export function UsersEdit($scope, $rootScope, $location,
relatedSets = {},
set;
- $scope.canEdit = false;
-
- Rest.setUrl(GetBasePath('users') + id);
- Rest.options()
- .success(function(data) {
- if (data.actions.PUT) {
- $scope.canEdit = true;
- }
- });
-
generator.inject(form, { mode: 'edit', related: true, scope: $scope });
generator.reset();
diff --git a/awx/ui/client/src/forms/Credentials.js b/awx/ui/client/src/forms/Credentials.js
index 4f2b262359..c75f30c8be 100644
--- a/awx/ui/client/src/forms/Credentials.js
+++ b/awx/ui/client/src/forms/Credentials.js
@@ -33,14 +33,14 @@ export default
addRequired: true,
editRequired: true,
autocomplete: false,
- ngDisabled: '!canEdit'
+ ngDisabled: '!credential_obj.summary_fields.user_capabilities.edit'
},
description: {
label: 'Description',
type: 'text',
addRequired: false,
editRequired: false,
- ngDisabled: '!canEdit'
+ ngDisabled: '!credential_obj.summary_fields.user_capabilities.edit'
},
organization: {
addRequired: false,
@@ -55,7 +55,7 @@ export default
dataTitle: 'Organization ',
dataPlacement: 'bottom',
dataContainer: "body",
- ngDisabled: '!canEdit'
+ ngDisabled: '!credential_obj.summary_fields.user_capabilities.edit'
},
kind: {
label: 'Type',
@@ -87,7 +87,7 @@ export default
dataPlacement: 'right',
dataContainer: "body",
hasSubForm: true,
- ngDisabled: '!canEdit'
+ ngDisabled: '!credential_obj.summary_fields.user_capabilities.edit'
},
access_key: {
label: 'Access Key',
@@ -100,13 +100,13 @@ export default
autocomplete: false,
apiField: 'username',
subForm: 'credentialSubForm',
- ngDisabled: '!canEdit'
+ ngDisabled: '!credential_obj.summary_fields.user_capabilities.edit'
},
secret_key: {
label: 'Secret Key',
type: 'sensitive',
ngShow: "kind.value == 'aws'",
- ngDisabled: "secret_key_ask || !canEdit",
+ ngDisabled: "secret_key_ask || !credential_obj.summary_fields.user_capabilities.edit",
awRequiredWhen: {
reqExpression: "aws_required",
init: false
@@ -129,7 +129,7 @@ export default
dataPlacement: 'right',
dataContainer: "body",
subForm: 'credentialSubForm',
- ngDisabled: '!canEdit'
+ ngDisabled: '!credential_obj.summary_fields.user_capabilities.edit'
},
"host": {
labelBind: 'hostLabel',
@@ -146,7 +146,7 @@ export default
init: false
},
subForm: 'credentialSubForm',
- ngDisabled: '!canEdit'
+ ngDisabled: '!credential_obj.summary_fields.user_capabilities.edit'
},
"subscription": {
label: "Subscription ID",
@@ -164,7 +164,7 @@ export default
dataPlacement: 'right',
dataContainer: "body",
subForm: 'credentialSubForm',
- ngDisabled: '!canEdit'
+ ngDisabled: '!credential_obj.summary_fields.user_capabilities.edit'
},
"username": {
labelBind: 'usernameLabel',
@@ -177,7 +177,7 @@ export default
},
autocomplete: false,
subForm: "credentialSubForm",
- ngDisabled: '!canEdit'
+ ngDisabled: '!credential_obj.summary_fields.user_capabilities.edit'
},
"email_address": {
labelBind: 'usernameLabel',
@@ -193,7 +193,7 @@ export default
dataPlacement: 'right',
dataContainer: "body",
subForm: 'credentialSubForm',
- ngDisabled: '!canEdit'
+ ngDisabled: '!credential_obj.summary_fields.user_capabilities.edit'
},
"api_key": {
label: 'API Key',
@@ -207,7 +207,7 @@ export default
hasShowInputButton: true,
clear: false,
subForm: 'credentialSubForm',
- ngDisabled: '!canEdit'
+ ngDisabled: '!credential_obj.summary_fields.user_capabilities.edit'
},
"password": {
labelBind: 'passwordLabel',
@@ -221,13 +221,13 @@ export default
init: false
},
subForm: "credentialSubForm",
- ngDisabled: '!canEdit'
+ ngDisabled: '!credential_obj.summary_fields.user_capabilities.edit'
},
"ssh_password": {
label: 'Password',
type: 'sensitive',
ngShow: "kind.value == 'ssh'",
- ngDisabled: "ssh_password_ask || !canEdit",
+ ngDisabled: "ssh_password_ask || !credential_obj.summary_fields.user_capabilities.edit",
addRequired: false,
editRequired: false,
subCheckbox: {
@@ -260,7 +260,7 @@ export default
dataPlacement: 'right',
dataContainer: "body",
subForm: "credentialSubForm",
- ngDisabled: '!canEdit'
+ ngDisabled: '!credential_obj.summary_fields.user_capabilities.edit'
},
"ssh_key_unlock": {
label: 'Private Key Passphrase',
@@ -268,7 +268,7 @@ export default
ngShow: "kind.value == 'ssh' || kind.value == 'scm'",
addRequired: false,
editRequired: false,
- ngDisabled: "keyEntered === false || ssh_key_unlock_ask || !canEdit",
+ ngDisabled: "keyEntered === false || ssh_key_unlock_ask || !credential_obj.summary_fields.user_capabilities.edit",
subCheckbox: {
variable: 'ssh_key_unlock_ask',
ngShow: "kind.value == 'ssh'",
@@ -292,7 +292,7 @@ export default
dataPlacement: 'right',
dataContainer: "body",
subForm: 'credentialSubForm',
- ngDisabled: '!canEdit'
+ ngDisabled: '!credential_obj.summary_fields.user_capabilities.edit'
},
"become_username": {
labelBind: 'becomeUsernameLabel',
@@ -302,13 +302,13 @@ export default
editRequired: false,
autocomplete: false,
subForm: 'credentialSubForm',
- ngDisabled: '!canEdit'
+ ngDisabled: '!credential_obj.summary_fields.user_capabilities.edit'
},
"become_password": {
labelBind: 'becomePasswordLabel',
type: 'sensitive',
ngShow: "(kind.value == 'ssh' && (become_method && become_method.value)) ",
- ngDisabled: "become_password_ask || !canEdit",
+ ngDisabled: "become_password_ask || !credential_obj.summary_fields.user_capabilities.edit",
addRequired: false,
editRequired: false,
subCheckbox: {
@@ -325,7 +325,7 @@ export default
label: 'Client ID',
subForm: 'credentialSubForm',
ngShow: "kind.value === 'azure_rm'",
- ngDisabled: '!canEdit'
+ ngDisabled: '!credential_obj.summary_fields.user_capabilities.edit'
},
secret:{
type: 'sensitive',
@@ -334,14 +334,14 @@ export default
label: 'Client Secret',
subForm: 'credentialSubForm',
ngShow: "kind.value === 'azure_rm'",
- ngDisabled: '!canEdit'
+ ngDisabled: '!credential_obj.summary_fields.user_capabilities.edit'
},
tenant: {
type: 'text',
label: 'Tenant ID',
subForm: 'credentialSubForm',
ngShow: "kind.value === 'azure_rm'",
- ngDisabled: '!canEdit'
+ ngDisabled: '!credential_obj.summary_fields.user_capabilities.edit'
},
authorize: {
label: 'Authorize',
@@ -349,7 +349,7 @@ export default
ngChange: "toggleCallback('host_config_key')",
subForm: 'credentialSubForm',
ngShow: "kind.value === 'net'",
- ngDisabled: '!canEdit'
+ ngDisabled: '!credential_obj.summary_fields.user_capabilities.edit'
},
authorize_password: {
label: 'Authorize Password',
@@ -358,7 +358,7 @@ export default
autocomplete: false,
subForm: 'credentialSubForm',
ngShow: "authorize && authorize !== 'false'",
- ngDisabled: '!canEdit'
+ ngDisabled: '!credential_obj.summary_fields.user_capabilities.edit'
},
"project": {
labelBind: 'projectLabel',
@@ -376,7 +376,7 @@ export default
init: false
},
subForm: 'credentialSubForm',
- ngDisabled: '!canEdit'
+ ngDisabled: '!credential_obj.summary_fields.user_capabilities.edit'
},
"domain": {
labelBind: 'domainLabel',
@@ -393,13 +393,13 @@ export default
addRequired: false,
editRequired: false,
subForm: 'credentialSubForm',
- ngDisabled: '!canEdit'
+ ngDisabled: '!credential_obj.summary_fields.user_capabilities.edit'
},
"vault_password": {
label: "Vault Password",
type: 'sensitive',
ngShow: "kind.value == 'ssh'",
- ngDisabled: "vault_password_ask || !canEdit",
+ ngDisabled: "vault_password_ask || !credential_obj.summary_fields.user_capabilities.edit",
addRequired: false,
editRequired: false,
subCheckbox: {
@@ -416,17 +416,17 @@ export default
buttons: {
cancel: {
ngClick: 'formCancel()',
- ngShow: 'canEdit'
+ ngShow: 'credential_obj.summary_fields.user_capabilities.edit'
},
close: {
ngClick: 'formCancel()',
- ngShow: '!canEdit'
+ ngShow: '!credential_obj.summary_fields.user_capabilities.edit'
},
save: {
label: 'Save',
ngClick: 'formSave()', //$scope.function to call on click, optional
ngDisabled: true,
- ngShow: 'canEdit' //Disable when $pristine or $invalid, optional
+ ngShow: 'credential_obj.summary_fields.user_capabilities.edit' //Disable when $pristine or $invalid, optional
}
},
@@ -450,7 +450,7 @@ export default
awToolTip: 'Add a permission',
actionClass: 'btn List-buttonSubmit',
buttonContent: '+ ADD',
- ngShow: 'canEdit'
+ ngShow: 'credential_obj.summary_fields.user_capabilities.edit'
}
},
diff --git a/awx/ui/client/src/forms/Groups.js b/awx/ui/client/src/forms/Groups.js
index ece74417a4..40a5cd3301 100644
--- a/awx/ui/client/src/forms/Groups.js
+++ b/awx/ui/client/src/forms/Groups.js
@@ -27,7 +27,7 @@ export default
addRequired: true,
editRequired: true,
tab: 'properties',
- ngDisabled: '!canEdit'
+ ngDisabled: '!group_obj.summary_fields.user_capabilities.edit'
},
description: {
label: 'Description',
@@ -35,7 +35,7 @@ export default
addRequired: false,
editRequired: false,
tab: 'properties',
- ngDisabled: '!canEdit'
+ ngDisabled: '!group_obj.summary_fields.user_capabilities.edit'
},
variables: {
label: 'Variables',
@@ -68,7 +68,7 @@ export default
addRequired: false,
editRequired: false,
ngModel: 'source',
- ngDisabled: '!canEdit'
+ ngDisabled: '!group_obj.summary_fields.user_capabilities.edit'
},
credential: {
label: 'Cloud Credential',
@@ -81,7 +81,7 @@ export default
reqExpression: "cloudCredentialRequired",
init: "false"
},
- ngDisabled: '!canEdit'
+ ngDisabled: '!group_obj.summary_fields.user_capabilities.edit'
},
source_regions: {
label: 'Regions',
@@ -97,7 +97,7 @@ export default
"or choose All to include all regions. Tower will only be updated with Hosts associated with the selected regions." +
"
",
dataContainer: 'body',
- ngDisabled: '!canEdit'
+ ngDisabled: '!group_obj.summary_fields.user_capabilities.edit'
},
instance_filters: {
label: 'Instance Filters',
@@ -118,7 +118,7 @@ export default
"View the Describe Instances documentation " +
"for a complete list of supported filters.
",
dataContainer: 'body',
- ngDisabled: '!canEdit'
+ ngDisabled: '!group_obj.summary_fields.user_capabilities.edit'
},
group_by: {
label: 'Only Group By',
@@ -144,7 +144,7 @@ export default
"Tag None: tags » tag_none " +
"If blank, all groups above are created except Instance ID .
",
dataContainer: 'body',
- ngDisabled: '!canEdit'
+ ngDisabled: '!group_obj.summary_fields.user_capabilities.edit'
},
inventory_script: {
label : "Custom Inventory Script",
@@ -156,7 +156,7 @@ export default
addRequired: true,
editRequired: true,
ngRequired: "source && source.value === 'custom'",
- ngDisabled: '!canEdit',
+ ngDisabled: '!group_obj.summary_fields.user_capabilities.edit',
},
custom_variables: {
id: 'custom_variables',
@@ -278,7 +278,7 @@ export default
dataContainer: 'body',
dataPlacement: 'right',
labelClass: 'checkbox-options',
- ngDisabled: '!canEdit'
+ ngDisabled: '!group_obj.summary_fields.user_capabilities.edit'
}, {
name: 'overwrite_vars',
label: 'Overwrite Variables',
@@ -293,7 +293,7 @@ export default
dataContainer: 'body',
dataPlacement: 'right',
labelClass: 'checkbox-options',
- ngDisabled: '!canEdit'
+ ngDisabled: '!group_obj.summary_fields.user_capabilities.edit'
}, {
name: 'update_on_launch',
label: 'Update on Launch',
@@ -307,7 +307,7 @@ export default
dataContainer: 'body',
dataPlacement: 'right',
labelClass: 'checkbox-options',
- ngDisabled: '!canEdit'
+ ngDisabled: '!group_obj.summary_fields.user_capabilities.edit'
}]
},
update_cache_timeout: {
@@ -333,16 +333,16 @@ export default
buttons: {
cancel: {
ngClick: 'formCancel()',
- ngShow: 'canEdit'
+ ngShow: 'group_obj.summary_fields.user_capabilities.edit'
},
close: {
ngClick: 'formCancel()',
- ngShow: '!canEdit'
+ ngShow: '!group_obj.summary_fields.user_capabilities.edit'
},
save: {
ngClick: 'formSave()',
ngDisabled: true,
- ngShow: 'canEdit'
+ ngShow: 'group_obj.summary_fields.user_capabilities.edit'
}
},
diff --git a/awx/ui/client/src/forms/Hosts.js b/awx/ui/client/src/forms/Hosts.js
index 99caaa2b6b..3f01a6cf5c 100644
--- a/awx/ui/client/src/forms/Hosts.js
+++ b/awx/ui/client/src/forms/Hosts.js
@@ -47,14 +47,14 @@ export default
dataTitle: 'Host Name',
dataPlacement: 'right',
dataContainer: 'body',
- ngDisabled: '!canEdit'
+ ngDisabled: '!host.summary_fields.user_capabilities.edit'
},
description: {
label: 'Description',
type: 'text',
addRequired: false,
editRequired: false,
- ngDisabled: '!canEdit'
+ ngDisabled: '!host.summary_fields.user_capabilities.edit'
},
variables: {
label: 'Variables',
@@ -85,16 +85,16 @@ export default
buttons: {
cancel: {
ngClick: 'formCancel()',
- ngShow: 'canEdit'
+ ngShow: 'host.summary_fields.user_capabilities.edit'
},
close: {
ngClick: 'formCancel()',
- ngShow: '!canEdit'
+ ngShow: '!host.summary_fields.user_capabilities.edit'
},
save: {
ngClick: 'formSave()',
ngDisabled: true,
- ngShow: 'canEdit'
+ ngShow: 'host.summary_fields.user_capabilities.edit'
}
},
diff --git a/awx/ui/client/src/forms/Inventories.js b/awx/ui/client/src/forms/Inventories.js
index c1d3c172d0..425c4d342d 100644
--- a/awx/ui/client/src/forms/Inventories.js
+++ b/awx/ui/client/src/forms/Inventories.js
@@ -27,7 +27,7 @@ export default
addRequired: true,
editRequired: true,
capitalize: false,
- ngDisabled: '!canEdit'
+ ngDisabled: '!inventory_obj.summary_fields.user_capabilities.edit'
},
inventory_description: {
realName: 'description',
@@ -35,7 +35,7 @@ export default
type: 'text',
addRequired: false,
editRequired: false,
- ngDisabled: '!canEdit'
+ ngDisabled: '!inventory_obj.summary_fields.user_capabilities.edit'
},
organization: {
label: 'Organization',
@@ -47,7 +47,7 @@ export default
reqExpression: "organizationrequired",
init: "true"
},
- ngDisabled: '!canEdit'
+ ngDisabled: '!inventory_obj.summary_fields.user_capabilities.edit'
},
variables: {
label: 'Variables',
@@ -67,23 +67,23 @@ export default
dataTitle: 'Inventory Variables',
dataPlacement: 'right',
dataContainer: 'body',
- ngDisabled: '!canEdit' // TODO: get working
+ ngDisabled: '!inventory_obj.summary_fields.user_capabilities.edit' // TODO: get working
}
},
buttons: {
cancel: {
ngClick: 'formCancel()',
- ngShow: 'canEdit'
+ ngShow: 'inventory_obj.summary_fields.user_capabilities.edit'
},
close: {
ngClick: 'formCancel()',
- ngHide: 'canEdit'
+ ngHide: 'inventory_obj.summary_fields.user_capabilities.edit'
},
save: {
ngClick: 'formSave()',
ngDisabled: true,
- ngShow: 'canEdit'
+ ngShow: 'inventory_obj.summary_fields.user_capabilities.edit'
}
},
@@ -105,7 +105,7 @@ export default
awToolTip: 'Add a permission',
actionClass: 'btn List-buttonSubmit',
buttonContent: '+ ADD',
- ngShow: 'canEdit'
+ ngShow: 'inventory_obj.summary_fields.user_capabilities.edit'
}
},
diff --git a/awx/ui/client/src/forms/JobTemplates.js b/awx/ui/client/src/forms/JobTemplates.js
index d7a6c81bfa..13e826492d 100644
--- a/awx/ui/client/src/forms/JobTemplates.js
+++ b/awx/ui/client/src/forms/JobTemplates.js
@@ -28,7 +28,7 @@ export default
addRequired: true,
editRequired: true,
column: 1,
- ngDisabled: '!canEdit'
+ ngDisabled: '!job_template_obj.summary_fields.user_capabilities.edit'
},
description: {
label: 'Description',
@@ -36,7 +36,7 @@ export default
addRequired: false,
editRequired: false,
column: 1,
- ngDisabled: '!canEdit'
+ ngDisabled: '!job_template_obj.summary_fields.user_capabilities.edit'
},
job_type: {
label: 'Job Type',
@@ -59,7 +59,7 @@ export default
ngShow: "!job_type.value || job_type.value !== 'scan'",
text: 'Prompt on launch'
},
- ngDisabled: '!canEdit'
+ ngDisabled: '!job_template_obj.summary_fields.user_capabilities.edit'
},
inventory: {
label: 'Inventory',
@@ -82,7 +82,7 @@ export default
ngShow: "!job_type.value || job_type.value !== 'scan'",
text: 'Prompt on launch'
},
- ngDisabled: '!canEdit'
+ ngDisabled: '!job_template_obj.summary_fields.user_capabilities.edit'
},
project: {
label: 'Project',
@@ -104,13 +104,13 @@ export default
dataTitle: 'Project',
dataPlacement: 'right',
dataContainer: "body",
- ngDisabled: '!canEdit'
+ ngDisabled: '!job_template_obj.summary_fields.user_capabilities.edit'
},
playbook: {
label: 'Playbook',
type:'select',
ngOptions: 'book for book in playbook_options track by book',
- ngDisabled: "(job_type.value === 'scan' && project_name === 'Default') || !canEdit",
+ ngDisabled: "(job_type.value === 'scan' && project_name === 'Default') || !job_template_obj.summary_fields.user_capabilities.edit",
id: 'playbook-select',
awRequiredWhen: {
reqExpression: "playbookrequired",
@@ -144,7 +144,7 @@ export default
variable: 'ask_credential_on_launch',
text: 'Prompt on launch'
},
- ngDisabled: '!canEdit'
+ ngDisabled: '!job_template_obj.summary_fields.user_capabilities.edit'
},
cloud_credential: {
label: 'Cloud Credential',
@@ -160,7 +160,7 @@ export default
dataTitle: 'Cloud Credential',
dataPlacement: 'right',
dataContainer: "body",
- ngDisabled: '!canEdit'
+ ngDisabled: '!job_template_obj.summary_fields.user_capabilities.edit'
},
network_credential: {
label: 'Network Credential',
@@ -175,7 +175,7 @@ export default
dataTitle: 'Network Credential',
dataPlacement: 'right',
dataContainer: "body",
- ngDisabled: '!canEdit'
+ ngDisabled: '!job_template_obj.summary_fields.user_capabilities.edit'
},
forks: {
label: 'Forks',
@@ -195,7 +195,7 @@ export default
dataTitle: 'Forks',
dataPlacement: 'right',
dataContainer: "body",
- ngDisabled: '!canEdit' // TODO: get working
+ ngDisabled: '!job_template_obj.summary_fields.user_capabilities.edit' // TODO: get working
},
limit: {
label: 'Limit',
@@ -213,7 +213,7 @@ export default
variable: 'ask_limit_on_launch',
text: 'Prompt on launch'
},
- ngDisabled: '!canEdit'
+ ngDisabled: '!job_template_obj.summary_fields.user_capabilities.edit'
},
verbosity: {
label: 'Verbosity',
@@ -227,7 +227,7 @@ export default
dataTitle: 'Verbosity',
dataPlacement: 'right',
dataContainer: "body",
- ngDisabled: '!canEdit'
+ ngDisabled: '!job_template_obj.summary_fields.user_capabilities.edit'
},
job_tags: {
label: 'Job Tags',
@@ -247,7 +247,7 @@ export default
variable: 'ask_tags_on_launch',
text: 'Prompt on launch'
},
- ngDisabled: '!canEdit'
+ ngDisabled: '!job_template_obj.summary_fields.user_capabilities.edit'
},
skip_tags: {
label: 'Skip Tags',
@@ -267,7 +267,7 @@ export default
variable: 'ask_skip_tags_on_launch',
text: 'Prompt on launch'
},
- ngDisabled: '!canEdit'
+ ngDisabled: '!job_template_obj.summary_fields.user_capabilities.edit'
},
checkbox_group: {
label: 'Options',
@@ -284,7 +284,7 @@ export default
dataTitle: 'Become Privilege Escalation',
dataContainer: "body",
labelClass: 'stack-inline',
- ngDisabled: '!canEdit'
+ ngDisabled: '!job_template_obj.summary_fields.user_capabilities.edit'
}, {
name: 'allow_callbacks',
label: 'Allow Provisioning Callbacks',
@@ -299,7 +299,7 @@ export default
dataTitle: 'Allow Provisioning Callbacks',
dataContainer: "body",
labelClass: 'stack-inline',
- ngDisabled: '!canEdit'
+ ngDisabled: '!job_template_obj.summary_fields.user_capabilities.edit'
}]
},
callback_url: {
@@ -315,7 +315,7 @@ export default
dataPlacement: 'top',
dataTitle: 'Provisioning Callback URL',
dataContainer: "body",
- ngDisabled: '!canEdit'
+ ngDisabled: '!job_template_obj.summary_fields.user_capabilities.edit'
},
host_config_key: {
label: 'Host Config Key',
@@ -329,7 +329,7 @@ export default
dataPlacement: 'right',
dataTitle: "Host Config Key",
dataContainer: "body",
- ngDisabled: '!canEdit'
+ ngDisabled: '!job_template_obj.summary_fields.user_capabilities.edit'
},
labels: {
label: 'Labels',
@@ -343,7 +343,7 @@ export default
dataPlacement: 'right',
awPopOver: "Optional labels that describe this job template, such as 'dev' or 'test'. Labels can be used to group and filter job templates and completed jobs in the Tower display.
",
dataContainer: 'body',
- ngDisabled: '!canEdit'
+ ngDisabled: '!job_template_obj.summary_fields.user_capabilities.edit'
},
variables: {
label: 'Extra Variables',
@@ -367,14 +367,14 @@ export default
variable: 'ask_variables_on_launch',
text: 'Prompt on launch'
},
- ngDisabled: '!canEdit' // TODO: get working
+ ngDisabled: '!job_template_obj.summary_fields.user_capabilities.edit' // TODO: get working
}
},
buttons: { //for now always generates tags
add_survey: {
ngClick: 'addSurvey()',
- ngShow: 'job_type.value !== "scan" && !survey_exists && canEdit',
+ ngShow: 'job_type.value !== "scan" && !survey_exists && job_template_obj.summary_fields.user_capabilities.edit',
awFeature: 'surveys',
awToolTip: 'Surveys allow users to be prompted at job launch with a series of questions related to the job. This allows for variables to be defined that affect the playbook run at time of launch.',
dataPlacement: 'top'
@@ -382,25 +382,25 @@ export default
edit_survey: {
ngClick: 'editSurvey()',
awFeature: 'surveys',
- ngShow: 'job_type.value !== "scan" && survey_exists && canEdit'
+ ngShow: 'job_type.value !== "scan" && survey_exists && job_template_obj.summary_fields.user_capabilities.edit'
},
view_survey: {
ngClick: 'editSurvey()',
awFeature: 'surveys',
- ngShow: 'job_type.value !== "scan" && survey_exists && !canEdit'
+ ngShow: 'job_type.value !== "scan" && survey_exists && !job_template_obj.summary_fields.user_capabilities.edit'
},
cancel: {
ngClick: 'formCancel()',
- ngShow: 'canEdit'
+ ngShow: 'job_template_obj.summary_fields.user_capabilities.edit'
},
close: {
ngClick: 'formCancel()',
- ngShow: '!canEdit'
+ ngShow: '!job_template_obj.summary_fields.user_capabilities.edit'
},
save: {
ngClick: 'formSave()', //$scope.function to call on click, optional
ngDisabled: "job_templates_form.$invalid || can_edit!==true",//true //Disable when $pristine or $invalid, optional and when can_edit = false, for permission reasons
- ngShow: 'canEdit'
+ ngShow: 'job_template_obj.summary_fields.user_capabilities.edit'
}
},
@@ -425,7 +425,7 @@ export default
awToolTip: 'Add a permission',
actionClass: 'btn List-buttonSubmit',
buttonContent: '+ ADD',
- ngShow: 'canEdit'
+ ngShow: 'job_template_obj.summary_fields.user_capabilities.edit'
}
},
diff --git a/awx/ui/client/src/forms/Organizations.js b/awx/ui/client/src/forms/Organizations.js
index d5ff303f03..daf3e7d5f0 100644
--- a/awx/ui/client/src/forms/Organizations.js
+++ b/awx/ui/client/src/forms/Organizations.js
@@ -26,30 +26,30 @@ export default
addRequired: true,
editRequired: true,
capitalize: false,
- ngDisabled: '!canEdit'
+ ngDisabled: '!organization_obj.summary_fields.user_capabilities.edit'
},
description: {
label: 'Description',
type: 'text',
addRequired: false,
editRequired: false,
- ngDisabled: '!canEdit'
+ ngDisabled: '!organization_obj.summary_fields.user_capabilities.edit'
}
},
buttons: { //for now always generates tags
cancel: {
ngClick: 'formCancel()',
- ngShow: 'canEdit'
+ ngShow: 'organization_obj.summary_fields.user_capabilities.edit'
},
close: {
ngClick: 'formCancel()',
- ngShow: '!canEdit'
+ ngShow: '!organization_obj.summary_fields.user_capabilities.edit'
},
save: {
ngClick: 'formSave()', //$scope.function to call on click, optional
ngDisabled: true,
- ngShow: 'canEdit'
+ ngShow: 'organization_obj.summary_fields.user_capabilities.edit'
}
},
@@ -71,7 +71,7 @@ export default
awToolTip: 'Add a permission',
actionClass: 'btn List-buttonSubmit',
buttonContent: '+ ADD',
- ngShow: 'canEdit'
+ ngShow: 'organization_obj.summary_fields.user_capabilities.edit'
}
},
diff --git a/awx/ui/client/src/forms/Projects.js b/awx/ui/client/src/forms/Projects.js
index b9027d8a55..b77f234f06 100644
--- a/awx/ui/client/src/forms/Projects.js
+++ b/awx/ui/client/src/forms/Projects.js
@@ -31,14 +31,14 @@ angular.module('ProjectFormDefinition', ['SchedulesListDefinition'])
addRequired: true,
editRequired: true,
capitalize: false,
- ngDisabled: '!canEdit'
+ ngDisabled: '!project_obj.summary_fields.user_capabilities.edit'
},
description: {
label: 'Description',
type: 'text',
addRequired: false,
editRequired: false,
- ngDisabled: '!canEdit'
+ ngDisabled: '!project_obj.summary_fields.user_capabilities.edit'
},
organization: {
label: 'Organization',
@@ -53,7 +53,7 @@ angular.module('ProjectFormDefinition', ['SchedulesListDefinition'])
dataTitle: 'Organization',
dataContainer: 'body',
dataPlacement: 'right',
- ngDisabled: '!canEdit'
+ ngDisabled: '!project_obj.summary_fields.user_capabilities.edit'
},
scm_type: {
label: 'SCM Type',
@@ -64,7 +64,7 @@ angular.module('ProjectFormDefinition', ['SchedulesListDefinition'])
addRequired: true,
editRequired: true,
hasSubForm: true,
- ngDisabled: '!canEdit'
+ ngDisabled: '!project_obj.summary_fields.user_capabilities.edit'
},
missing_path_alert: {
type: 'alertblock',
@@ -87,7 +87,7 @@ angular.module('ProjectFormDefinition', ['SchedulesListDefinition'])
dataTitle: 'Project Base Path',
dataContainer: 'body',
dataPlacement: 'right',
- ngDisabled: '!canEdit'
+ ngDisabled: '!project_obj.summary_fields.user_capabilities.edit'
},
local_path: {
label: 'Playbook Directory',
@@ -105,7 +105,7 @@ angular.module('ProjectFormDefinition', ['SchedulesListDefinition'])
dataTitle: 'Project Path',
dataContainer: 'body',
dataPlacement: 'right',
- ngDisabled: '!canEdit'
+ ngDisabled: '!project_obj.summary_fields.user_capabilities.edit'
},
scm_url: {
label: 'SCM URL',
@@ -122,7 +122,7 @@ angular.module('ProjectFormDefinition', ['SchedulesListDefinition'])
dataTitle: 'SCM URL',
dataContainer: 'body',
dataPlacement: 'right',
- ngDisabled: '!canEdit'
+ ngDisabled: '!project_obj.summary_fields.user_capabilities.edit'
},
scm_branch: {
labelBind: "scmBranchLabel",
@@ -131,7 +131,7 @@ angular.module('ProjectFormDefinition', ['SchedulesListDefinition'])
addRequired: false,
editRequired: false,
subForm: 'sourceSubForm',
- ngDisabled: '!canEdit'
+ ngDisabled: '!project_obj.summary_fields.user_capabilities.edit'
},
credential: {
label: 'SCM Credential',
@@ -143,7 +143,7 @@ angular.module('ProjectFormDefinition', ['SchedulesListDefinition'])
addRequired: false,
editRequired: false,
subForm: 'sourceSubForm',
- ngDisabled: '!canEdit'
+ ngDisabled: '!project_obj.summary_fields.user_capabilities.edit'
},
checkbox_group: {
label: 'SCM Update Options',
@@ -161,7 +161,7 @@ angular.module('ProjectFormDefinition', ['SchedulesListDefinition'])
dataContainer: 'body',
dataPlacement: 'right',
labelClass: 'checkbox-options stack-inline',
- ngDisabled: '!canEdit'
+ ngDisabled: '!project_obj.summary_fields.user_capabilities.edit'
}, {
name: 'scm_delete_on_update',
label: 'Delete on Update',
@@ -174,7 +174,7 @@ angular.module('ProjectFormDefinition', ['SchedulesListDefinition'])
dataContainer: 'body',
dataPlacement: 'right',
labelClass: 'checkbox-options stack-inline',
- ngDisabled: '!canEdit'
+ ngDisabled: '!project_obj.summary_fields.user_capabilities.edit'
}, {
name: 'scm_update_on_launch',
label: 'Update on Launch',
@@ -186,7 +186,7 @@ angular.module('ProjectFormDefinition', ['SchedulesListDefinition'])
dataContainer: 'body',
dataPlacement: 'right',
labelClass: 'checkbox-options stack-inline',
- ngDisabled: '!canEdit'
+ ngDisabled: '!project_obj.summary_fields.user_capabilities.edit'
}]
},
scm_update_cache_timeout: {
@@ -206,23 +206,23 @@ angular.module('ProjectFormDefinition', ['SchedulesListDefinition'])
dataTitle: 'Cache Timeout',
dataPlacement: 'right',
dataContainer: "body",
- ngDisabled: '!canEdit' // TODO: get working
+ ngDisabled: '!project_obj.summary_fields.user_capabilities.edit' // TODO: get working
}
},
buttons: {
cancel: {
ngClick: 'formCancel()',
- ngShow: 'canEdit'
+ ngShow: 'project_obj.summary_fields.user_capabilities.edit'
},
close: {
ngClick: 'formCancel()',
- ngShow: '!canEdit'
+ ngShow: '!project_obj.summary_fields.user_capabilities.edit'
},
save: {
ngClick: 'formSave()',
ngDisabled: true,
- ngShow: 'canEdit'
+ ngShow: 'project_obj.summary_fields.user_capabilities.edit'
}
},
@@ -244,7 +244,7 @@ angular.module('ProjectFormDefinition', ['SchedulesListDefinition'])
awToolTip: 'Add a permission',
actionClass: 'btn List-buttonSubmit',
buttonContent: '+ ADD',
- ngShow: 'canEdit'
+ ngShow: 'project_obj.summary_fields.user_capabilities.edit'
}
},
diff --git a/awx/ui/client/src/forms/Teams.js b/awx/ui/client/src/forms/Teams.js
index 86e0315a71..07eb88a630 100644
--- a/awx/ui/client/src/forms/Teams.js
+++ b/awx/ui/client/src/forms/Teams.js
@@ -26,14 +26,14 @@ export default
addRequired: true,
editRequired: true,
capitalize: false,
- ngDisabled: '!canEdit'
+ ngDisabled: '!team_obj.summary_fields.user_capabilities.edit'
},
description: {
label: 'Description',
type: 'text',
addRequired: false,
editRequired: false,
- ngDisabled: '!canEdit'
+ ngDisabled: '!team_obj.summary_fields.user_capabilities.edit'
},
organization: {
label: 'Organization',
@@ -47,23 +47,23 @@ export default
reqExpression: "orgrequired",
init: true
},
- ngDisabled: '!canEdit'
+ ngDisabled: '!team_obj.summary_fields.user_capabilities.edit'
}
},
buttons: {
cancel: {
ngClick: 'formCancel()',
- ngShow: 'canEdit'
+ ngShow: 'team_obj.summary_fields.user_capabilities.edit'
},
close: {
ngClick: 'formCancel()',
- ngShow: '!canEdit'
+ ngShow: '!team_obj.summary_fields.user_capabilities.edit'
},
save: {
ngClick: 'formSave()',
ngDisabled: true,
- ngShow: 'canEdit'
+ ngShow: 'team_obj.summary_fields.user_capabilities.edit'
}
},
@@ -85,7 +85,7 @@ export default
awToolTip: 'Add user to team',
actionClass: 'btn List-buttonSubmit',
buttonContent: '+ ADD',
- ngShow: 'canEdit'
+ ngShow: 'team_obj.summary_fields.user_capabilities.edit'
}
},
diff --git a/awx/ui/client/src/forms/Users.js b/awx/ui/client/src/forms/Users.js
index aeae66e873..769eebe76e 100644
--- a/awx/ui/client/src/forms/Users.js
+++ b/awx/ui/client/src/forms/Users.js
@@ -27,7 +27,7 @@ export default
addRequired: true,
editRequired: true,
capitalize: true,
- ngDisabled: '!canEdit'
+ ngDisabled: '!user_obj.summary_fields.user_capabilities.edit'
},
last_name: {
label: 'Last Name',
@@ -35,7 +35,7 @@ export default
addRequired: true,
editRequired: true,
capitalize: true,
- ngDisabled: '!canEdit'
+ ngDisabled: '!user_obj.summary_fields.user_capabilities.edit'
},
email: {
label: 'Email',
@@ -43,7 +43,7 @@ export default
addRequired: true,
editRequired: true,
autocomplete: false,
- ngDisabled: '!canEdit'
+ ngDisabled: '!user_obj.summary_fields.user_capabilities.edit'
},
username: {
label: 'Username',
@@ -53,7 +53,7 @@ export default
init: true
},
autocomplete: false,
- ngDisabled: '!canEdit'
+ ngDisabled: '!user_obj.summary_fields.user_capabilities.edit'
},
organization: {
label: 'Organization',
@@ -68,7 +68,7 @@ export default
reqExpression: "orgrequired",
init: true
},
- ngDisabled: '!canEdit'
+ ngDisabled: '!user_obj.summary_fields.user_capabilities.edit'
},
password: {
label: 'Password',
@@ -80,7 +80,7 @@ export default
ngChange: "clearPWConfirm('password_confirm')",
autocomplete: false,
chkPass: true,
- ngDisabled: '!canEdit'
+ ngDisabled: '!user_obj.summary_fields.user_capabilities.edit'
},
password_confirm: {
label: 'Confirm Password',
@@ -92,7 +92,7 @@ export default
awPassMatch: true,
associated: 'password',
autocomplete: false,
- ngDisabled: '!canEdit'
+ ngDisabled: '!user_obj.summary_fields.user_capabilities.edit'
},
user_type: {
label: 'User Type',
@@ -101,23 +101,23 @@ export default
disableChooseOption: true,
ngModel: 'user_type',
ngShow: 'current_user["is_superuser"]',
- ngDisabled: '!canEdit'
+ ngDisabled: '!user_obj.summary_fields.user_capabilities.edit'
},
},
buttons: {
cancel: {
ngClick: 'formCancel()',
- ngShow: 'canEdit'
+ ngShow: 'user_obj.summary_fields.user_capabilities.edit'
},
close: {
ngClick: 'formCancel()',
- ngShow: '!canEdit'
+ ngShow: '!user_obj.summary_fields.user_capabilities.edit'
},
save: {
ngClick: 'formSave()',
ngDisabled: true,
- ngShow: 'canEdit'
+ ngShow: 'user_obj.summary_fields.user_capabilities.edit'
}
},
diff --git a/awx/ui/client/src/inventories/edit/inventory-edit.controller.js b/awx/ui/client/src/inventories/edit/inventory-edit.controller.js
index 8da9a87139..8b01b8be3e 100644
--- a/awx/ui/client/src/inventories/edit/inventory-edit.controller.js
+++ b/awx/ui/client/src/inventories/edit/inventory-edit.controller.js
@@ -28,16 +28,6 @@ function InventoriesEdit($scope, $rootScope, $compile, $location,
fld, json_data, data,
relatedSets = {};
- $scope.canEdit = false;
-
- Rest.setUrl(GetBasePath('inventory') + inventory_id);
- Rest.options()
- .success(function(data) {
- if (data.actions.PUT) {
- $scope.canEdit = true;
- }
- });
-
form.formLabelSize = null;
form.formFieldSize = null;
$scope.inventory_id = inventory_id;
diff --git a/awx/ui/client/src/inventories/list/inventory-list.controller.js b/awx/ui/client/src/inventories/list/inventory-list.controller.js
index 854e44e663..d70217e6c5 100644
--- a/awx/ui/client/src/inventories/list/inventory-list.controller.js
+++ b/awx/ui/client/src/inventories/list/inventory-list.controller.js
@@ -17,14 +17,12 @@ function InventoriesList($scope, $rootScope, $location, $log,
Find, Empty, $state) {
$scope.canAdd = false;
- $scope.canEdit = false;
Rest.setUrl(GetBasePath('inventory'));
Rest.options()
.success(function(data) {
if (data.actions.POST) {
$scope.canAdd = true;
- $scope.canEdit = true;
}
});
diff --git a/awx/ui/client/src/inventories/manage/groups/groups-edit.controller.js b/awx/ui/client/src/inventories/manage/groups/groups-edit.controller.js
index fbcd4a00c1..c6ec30bd06 100644
--- a/awx/ui/client/src/inventories/manage/groups/groups-edit.controller.js
+++ b/awx/ui/client/src/inventories/manage/groups/groups-edit.controller.js
@@ -7,21 +7,10 @@
export default
['$state', '$stateParams', '$scope', 'GroupForm', 'CredentialList', 'inventoryScriptsListObject', 'ToggleNotification', 'ParseVariableString',
'ParseTypeChange', 'GenerateForm', 'LookUpInit', 'RelatedSearchInit', 'RelatedPaginateInit', 'NotificationsListInit',
- 'GroupManageService','GetChoices', 'GetBasePath', 'CreateSelect2', 'GetSourceTypeOptions', 'groupData', 'inventorySourceData', 'Rest',
+ 'GroupManageService','GetChoices', 'GetBasePath', 'CreateSelect2', 'GetSourceTypeOptions', 'groupData', 'inventorySourceData',
function($state, $stateParams, $scope, GroupForm, CredentialList, InventoryScriptsList, ToggleNotification, ParseVariableString,
ParseTypeChange, GenerateForm, LookUpInit, RelatedSearchInit, RelatedPaginateInit, NotificationsListInit,
- GroupManageService, GetChoices, GetBasePath, CreateSelect2, GetSourceTypeOptions, groupData, inventorySourceData, Rest){
-
- $scope.canEdit = false;
-
- Rest.setUrl(GetBasePath('groups') + $stateParams.group_id);
- Rest.options()
- .success(function(data) {
- if (data.actions.PUT) {
- $scope.canEdit = true;
- }
- });
-
+ GroupManageService, GetChoices, GetBasePath, CreateSelect2, GetSourceTypeOptions, groupData, inventorySourceData){
var generator = GenerateForm,
form = GroupForm();
@@ -267,6 +256,7 @@
$scope.credential_name = inventorySourceData.summary_fields.credential.name;
}
$scope = angular.extend($scope, groupData);
+ $scope.group_obj = groupData;
// instantiate lookup fields
if (inventorySourceData.source !== 'custom'){
diff --git a/awx/ui/client/src/inventories/manage/hosts/hosts-edit.controller.js b/awx/ui/client/src/inventories/manage/hosts/hosts-edit.controller.js
index 435968ccce..86ad43d791 100644
--- a/awx/ui/client/src/inventories/manage/hosts/hosts-edit.controller.js
+++ b/awx/ui/client/src/inventories/manage/hosts/hosts-edit.controller.js
@@ -7,16 +7,6 @@
export default
['$state', '$stateParams', '$scope', 'HostForm', 'ParseTypeChange', 'GenerateForm', 'HostManageService', 'host', 'GetBasePath', 'Rest',
function($state, $stateParams, $scope, HostForm, ParseTypeChange, GenerateForm, HostManageService, host, GetBasePath, Rest){
- $scope.canEdit = false;
-
- Rest.setUrl(GetBasePath('hosts') + $stateParams.host_id);
- Rest.options()
- .success(function(data) {
- if (data.actions.PUT) {
- $scope.canEdit = true;
- }
- });
-
var generator = GenerateForm,
form = HostForm;
$scope.parseType = 'yaml';
diff --git a/awx/ui/client/src/inventory-scripts/add/add.controller.js b/awx/ui/client/src/inventory-scripts/add/add.controller.js
index a0e5f37031..317d6d5c0a 100644
--- a/awx/ui/client/src/inventory-scripts/add/add.controller.js
+++ b/awx/ui/client/src/inventory-scripts/add/add.controller.js
@@ -29,8 +29,6 @@ export default
form = inventoryScriptsFormObject,
url = GetBasePath('inventory_scripts');
- $scope.canEdit = true;
-
generator.inject(form, {
mode: 'add' ,
scope:scope,
diff --git a/awx/ui/client/src/inventory-scripts/edit/edit.controller.js b/awx/ui/client/src/inventory-scripts/edit/edit.controller.js
index 40a6eda216..33cc50ca2e 100644
--- a/awx/ui/client/src/inventory-scripts/edit/edit.controller.js
+++ b/awx/ui/client/src/inventory-scripts/edit/edit.controller.js
@@ -24,19 +24,6 @@ export default
master = {},
url = GetBasePath('inventory_scripts');
-
- $scope.canEditInvScripts = false;
-
- Rest.setUrl(GetBasePath('inventory_scripts') + id);
- Rest.options()
- .success(function(data) {
- if (data.actions.PUT) {
- $scope.canEditInvScripts = true;
- } else {
- $scope.canEditInvScripts = false;
- }
- });
-
$scope.inventory_script = inventory_script;
generator.inject(form, {
mode: 'edit' ,
diff --git a/awx/ui/client/src/inventory-scripts/inventory-scripts.form.js b/awx/ui/client/src/inventory-scripts/inventory-scripts.form.js
index 6a2f538421..fd8ecd9023 100644
--- a/awx/ui/client/src/inventory-scripts/inventory-scripts.form.js
+++ b/awx/ui/client/src/inventory-scripts/inventory-scripts.form.js
@@ -25,14 +25,14 @@ export default function() {
addRequired: true,
editRequired: true,
capitalize: false,
- ngDisabled: '!canEditInvScripts'
+ ngDisabled: '!inventory_script_obj.summary_fields.user_capabilities.edit'
},
description: {
label: 'Description',
type: 'text',
addRequired: false,
editRequired: false,
- ngDisabled: '!canEditInvScripts'
+ ngDisabled: '!inventory_script_obj.summary_fields.user_capabilities.edit'
},
organization: {
label: 'Organization',
@@ -44,7 +44,7 @@ export default function() {
sourceModel: 'organization',
sourceField: 'name',
ngClick: 'lookUpOrganization()',
- ngDisabled: '!canEditInvScripts'
+ ngDisabled: '!inventory_script_obj.summary_fields.user_capabilities.edit'
},
script: {
label: 'Custom Script',
@@ -54,7 +54,7 @@ export default function() {
addRequired: true,
editRequired: true,
awDropFile: true,
- ngDisabled: '!canEditInvScripts',
+ ngDisabled: '!inventory_script_obj.summary_fields.user_capabilities.edit',
rows: 10,
awPopOver: "Drag and drop your custom inventory script file here or create one in the field to import your custom inventory. " +
" Script must begin with a hashbang sequence: i.e.... #!/usr/bin/env python
",
@@ -67,16 +67,16 @@ export default function() {
buttons: { //for now always generates tags
cancel: {
ngClick: 'formCancel()',
- ngShow: 'canEditInvScripts'
+ ngShow: 'inventory_script_obj.summary_fields.user_capabilities.edit'
},
close: {
ngClick: 'formCancel()',
- ngShow: '!canEditInvScripts'
+ ngShow: '!inventory_script_obj.summary_fields.user_capabilities.edit'
},
save: {
ngClick: 'formSave()', //$scope.function to call on click, optional
ngDisabled: 'custom_inventory_form.$pristine || custom_inventory_form.$invalid || !canEdit', //Disable when $pristine or $invalid, optional
- ngShow: 'canEditInvScripts'
+ ngShow: 'inventory_script_obj.summary_fields.user_capabilities.edit'
}
}
};
diff --git a/awx/ui/client/src/inventory-scripts/list/list.controller.js b/awx/ui/client/src/inventory-scripts/list/list.controller.js
index a6e0ea54d1..f8ad33e7db 100644
--- a/awx/ui/client/src/inventory-scripts/list/list.controller.js
+++ b/awx/ui/client/src/inventory-scripts/list/list.controller.js
@@ -19,14 +19,12 @@ export default
view = GenerateList;
scope.canAdd = false;
- scope.canEdit = false;
Rest.setUrl(GetBasePath('inventory_scripts'));
Rest.options()
.success(function(data) {
if (data.actions.POST) {
scope.canAdd = true;
- scope.canEdit = true;
}
});
diff --git a/awx/ui/client/src/job-templates/edit/job-templates-edit.controller.js b/awx/ui/client/src/job-templates/edit/job-templates-edit.controller.js
index 3082b3047e..c30412504a 100644
--- a/awx/ui/client/src/job-templates/edit/job-templates-edit.controller.js
+++ b/awx/ui/client/src/job-templates/edit/job-templates-edit.controller.js
@@ -46,16 +46,6 @@ export default
checkSCMStatus, getPlaybooks, callback,
choicesCount = 0;
- $scope.canEdit = false;
-
- Rest.setUrl(GetBasePath('job_templates') + id);
- Rest.options()
- .success(function(data) {
- if (data.actions.PUT) {
- $scope.canEdit = true;
- }
- });
-
// remove "type" field from search options
CredentialList = _.cloneDeep(CredentialList);
CredentialList.fields.kind.noSearch = true;
diff --git a/awx/ui/client/src/job-templates/list/job-templates-list.controller.js b/awx/ui/client/src/job-templates/list/job-templates-list.controller.js
index 5d71d01f5d..a2d4eedf4e 100644
--- a/awx/ui/client/src/job-templates/list/job-templates-list.controller.js
+++ b/awx/ui/client/src/job-templates/list/job-templates-list.controller.js
@@ -22,14 +22,12 @@ export default
ClearScope();
$scope.canAdd = false;
- $scope.canEdit = false;
Rest.setUrl(GetBasePath('job_templates'));
Rest.options()
.success(function(data) {
if (data.actions.POST) {
$scope.canAdd = true;
- $scope.canEdit = true;
}
});
diff --git a/awx/ui/client/src/notifications/edit/edit.controller.js b/awx/ui/client/src/notifications/edit/edit.controller.js
index 0f9250ed29..44c50a71ce 100644
--- a/awx/ui/client/src/notifications/edit/edit.controller.js
+++ b/awx/ui/client/src/notifications/edit/edit.controller.js
@@ -25,16 +25,6 @@ export default
master = {},
url = GetBasePath('notification_templates');
- $scope.canEdit = false;
-
- Rest.setUrl(GetBasePath('notification_templates') + id);
- Rest.options()
- .success(function(data) {
- if (data.actions.PUT) {
- $scope.canEdit = true;
- }
- });
-
$scope.notification_template = notification_template;
generator.inject(form, {
mode: 'edit' ,
diff --git a/awx/ui/client/src/notifications/notification-templates-list/list.controller.js b/awx/ui/client/src/notifications/notification-templates-list/list.controller.js
index 40570e7aa8..09bf1393a8 100644
--- a/awx/ui/client/src/notifications/notification-templates-list/list.controller.js
+++ b/awx/ui/client/src/notifications/notification-templates-list/list.controller.js
@@ -25,14 +25,12 @@ export default
});
scope.canAdd = false;
- scope.canEdit = false;
Rest.setUrl(GetBasePath('notification_templates'));
Rest.options()
.success(function(data) {
if (data.actions.POST) {
scope.canAdd = true;
- scope.canEdit = true;;
}
});
diff --git a/awx/ui/client/src/notifications/notificationTemplates.form.js b/awx/ui/client/src/notifications/notificationTemplates.form.js
index e4003e52b8..69128bbb18 100644
--- a/awx/ui/client/src/notifications/notificationTemplates.form.js
+++ b/awx/ui/client/src/notifications/notificationTemplates.form.js
@@ -28,14 +28,14 @@ export default function() {
addRequired: true,
editRequired: true,
capitalize: false,
- ngDisabled: '!canEdit'
+ ngDisabled: '!notification_template.summary_fields.user_capabilities.edit'
},
description: {
label: 'Description',
type: 'text',
addRequired: false,
editRequired: false,
- ngDisabled: '!canEdit'
+ ngDisabled: '!notification_template.summary_fields.user_capabilities.edit'
},
organization: {
label: 'Organization',
@@ -47,7 +47,7 @@ export default function() {
reqExpression: "organizationrequired",
init: "true"
},
- ngDisabled: '!canEdit'
+ ngDisabled: '!notification_template.summary_fields.user_capabilities.edit'
},
notification_type: {
label: 'Type',
@@ -58,14 +58,14 @@ export default function() {
ngOptions: 'type.label for type in notification_type_options track by type.value',
ngChange: 'typeChange()',
hasSubForm: true,
- ngDisabled: '!canEdit'
+ ngDisabled: '!notification_template.summary_fields.user_capabilities.edit'
},
username: {
label: 'Username',
type: 'text',
ngShow: "notification_type.value == 'email' ",
subForm: 'typeSubForm',
- ngDisabled: '!canEdit'
+ ngDisabled: '!notification_template.summary_fields.user_capabilities.edit'
},
host: {
@@ -77,7 +77,7 @@ export default function() {
},
ngShow: "notification_type.value == 'email' ",
subForm: 'typeSubForm',
- ngDisabled: '!canEdit'
+ ngDisabled: '!notification_template.summary_fields.user_capabilities.edit'
},
sender: {
label: 'Sender Email',
@@ -88,7 +88,7 @@ export default function() {
},
ngShow: "notification_type.value == 'email' ",
subForm: 'typeSubForm',
- ngDisabled: '!canEdit'
+ ngDisabled: '!notification_template.summary_fields.user_capabilities.edit'
},
recipients: {
label: 'Recipient List',
@@ -105,7 +105,7 @@ export default function() {
},
ngShow: "notification_type.value == 'email' ",
subForm: 'typeSubForm',
- ngDisabled: '!canEdit'
+ ngDisabled: '!notification_template.summary_fields.user_capabilities.edit'
},
password: {
labelBind: 'passwordLabel',
@@ -117,7 +117,7 @@ export default function() {
},
ngShow: "notification_type.value == 'email' || notification_type.value == 'irc' ",
subForm: 'typeSubForm',
- ngDisabled: '!canEdit'
+ ngDisabled: '!notification_template.summary_fields.user_capabilities.edit'
},
port: {
labelBind: 'portLabel',
@@ -132,7 +132,7 @@ export default function() {
},
ngShow: "notification_type.value == 'email' || notification_type.value == 'irc'",
subForm: 'typeSubForm',
- ngDisabled: '!canEdit'
+ ngDisabled: '!notification_template.summary_fields.user_capabilities.edit'
},
channels: {
label: 'Destination Channels',
@@ -149,7 +149,7 @@ export default function() {
},
ngShow: "notification_type.value == 'slack'",
subForm: 'typeSubForm',
- ngDisabled: '!canEdit'
+ ngDisabled: '!notification_template.summary_fields.user_capabilities.edit'
},
rooms: {
label: 'Destination Channels',
@@ -166,7 +166,7 @@ export default function() {
},
ngShow: "notification_type.value == 'hipchat'",
subForm: 'typeSubForm',
- ngDisabled: '!canEdit'
+ ngDisabled: '!notification_template.summary_fields.user_capabilities.edit'
},
token: {
labelBind: 'tokenLabel',
@@ -178,7 +178,7 @@ export default function() {
},
ngShow: "notification_type.value == 'slack' || notification_type.value == 'pagerduty' || notification_type.value == 'hipchat'",
subForm: 'typeSubForm',
- ngDisabled: '!canEdit'
+ ngDisabled: '!notification_template.summary_fields.user_capabilities.edit'
},
account_token: {
label: 'Account Token',
@@ -190,7 +190,7 @@ export default function() {
},
ngShow: "notification_type.value == 'twilio' ",
subForm: 'typeSubForm',
- ngDisabled: '!canEdit'
+ ngDisabled: '!notification_template.summary_fields.user_capabilities.edit'
},
from_number: {
label: 'Source Phone Number',
@@ -203,7 +203,7 @@ export default function() {
},
ngShow: "notification_type.value == 'twilio' ",
subForm: 'typeSubForm',
- ngDisabled: '!canEdit'
+ ngDisabled: '!notification_template.summary_fields.user_capabilities.edit'
},
to_numbers: {
label: 'Destination SMS Number',
@@ -220,7 +220,7 @@ export default function() {
},
ngShow: "notification_type.value == 'twilio' ",
subForm: 'typeSubForm',
- ngDisabled: '!canEdit'
+ ngDisabled: '!notification_template.summary_fields.user_capabilities.edit'
},
account_sid: {
label: 'Account SID',
@@ -231,7 +231,7 @@ export default function() {
},
ngShow: "notification_type.value == 'twilio' ",
subForm: 'typeSubForm',
- ngDisabled: '!canEdit'
+ ngDisabled: '!notification_template.summary_fields.user_capabilities.edit'
},
subdomain: {
label: 'Pagerduty subdomain',
@@ -242,7 +242,7 @@ export default function() {
},
ngShow: "notification_type.value == 'pagerduty' ",
subForm: 'typeSubForm',
- ngDisabled: '!canEdit'
+ ngDisabled: '!notification_template.summary_fields.user_capabilities.edit'
},
service_key: {
label: 'API Service/Integration Key',
@@ -253,7 +253,7 @@ export default function() {
},
ngShow: "notification_type.value == 'pagerduty' ",
subForm: 'typeSubForm',
- ngDisabled: '!canEdit'
+ ngDisabled: '!notification_template.summary_fields.user_capabilities.edit'
},
client_name: {
label: 'Client Identifier',
@@ -264,7 +264,7 @@ export default function() {
},
ngShow: "notification_type.value == 'pagerduty' ",
subForm: 'typeSubForm',
- ngDisabled: '!canEdit'
+ ngDisabled: '!notification_template.summary_fields.user_capabilities.edit'
},
message_from: {
label: 'Label to be shown with notification',
@@ -275,7 +275,7 @@ export default function() {
},
ngShow: "notification_type.value == 'hipchat' ",
subForm: 'typeSubForm',
- ngDisabled: '!canEdit'
+ ngDisabled: '!notification_template.summary_fields.user_capabilities.edit'
},
api_url: {
label: 'API URL',
@@ -287,7 +287,7 @@ export default function() {
},
ngShow: "notification_type.value == 'hipchat' ",
subForm: 'typeSubForm',
- ngDisabled: '!canEdit'
+ ngDisabled: '!notification_template.summary_fields.user_capabilities.edit'
},
color: {
label: 'Notification Color',
@@ -300,14 +300,14 @@ export default function() {
},
ngShow: "notification_type.value == 'hipchat' ",
subForm: 'typeSubForm',
- ngDisabled: '!canEdit'
+ ngDisabled: '!notification_template.summary_fields.user_capabilities.edit'
},
notify: {
label: 'Notify Channel',
type: 'checkbox',
ngShow: "notification_type.value == 'hipchat' ",
subForm: 'typeSubForm',
- ngDisabled: '!canEdit'
+ ngDisabled: '!notification_template.summary_fields.user_capabilities.edit'
},
url: {
label: 'Target URL',
@@ -318,7 +318,7 @@ export default function() {
},
ngShow: "notification_type.value == 'webhook' ",
subForm: 'typeSubForm',
- ngDisabled: '!canEdit'
+ ngDisabled: '!notification_template.summary_fields.user_capabilities.edit'
},
headers: {
label: 'HTTP Headers',
@@ -339,7 +339,7 @@ export default function() {
dataPlacement: 'right',
ngShow: "notification_type.value == 'webhook' ",
subForm: 'typeSubForm',
- ngDisabled: '!canEdit'
+ ngDisabled: '!notification_template.summary_fields.user_capabilities.edit'
},
server: {
label: 'IRC Server Address',
@@ -350,7 +350,7 @@ export default function() {
},
ngShow: "notification_type.value == 'irc' ",
subForm: 'typeSubForm',
- ngDisabled: '!canEdit'
+ ngDisabled: '!notification_template.summary_fields.user_capabilities.edit'
},
nickname: {
label: 'IRC Nick',
@@ -361,7 +361,7 @@ export default function() {
},
ngShow: "notification_type.value == 'irc' ",
subForm: 'typeSubForm',
- ngDisabled: '!canEdit'
+ ngDisabled: '!notification_template.summary_fields.user_capabilities.edit'
},
targets: {
label: 'Destination Channels or Users',
@@ -378,14 +378,14 @@ export default function() {
},
ngShow: "notification_type.value == 'irc' ",
subForm: 'typeSubForm',
- ngDisabled: '!canEdit'
+ ngDisabled: '!notification_template.summary_fields.user_capabilities.edit'
},
use_ssl: {
label: 'SSL Connection',
type: 'checkbox',
ngShow: "notification_type.value == 'irc'",
subForm: 'typeSubForm',
- ngDisabled: '!canEdit'
+ ngDisabled: '!notification_template.summary_fields.user_capabilities.edit'
},
checkbox_group: {
label: 'Options',
@@ -398,14 +398,14 @@ export default function() {
type: 'checkbox',
ngShow: "notification_type.value == 'email' ",
labelClass: 'checkbox-options stack-inline',
- ngDisabled: '!canEdit'
+ ngDisabled: '!notification_template.summary_fields.user_capabilities.edit'
}, {
name: 'use_ssl',
label: 'Use SSL',
type: 'checkbox',
ngShow: "notification_type.value == 'email'",
labelClass: 'checkbox-options stack-inline',
- ngDisabled: '!canEdit'
+ ngDisabled: '!notification_template.summary_fields.user_capabilities.edit'
}]
}
},
@@ -413,15 +413,15 @@ export default function() {
buttons: { //for now always generates tags
cancel: {
ngClick: 'formCancel()',
- ngShow: 'canEdit'
+ ngShow: 'notification_template.summary_fields.user_capabilities.edit'
},
close: {
ngClick: 'formCancel()',
- ngShow: '!canEdit'
+ ngShow: '!notification_template.summary_fields.user_capabilities.edit'
},
save: {
ngClick: 'formSave()',
- ngShow: 'canEdit', //$scope.function to call on click, optional
+ ngShow: 'notification_template.summary_fields.user_capabilities.edit', //$scope.function to call on click, optional
ngDisabled: true //Disable when $pristine or $invalid, optional
}
}
diff --git a/awx/ui/client/src/organizations/edit/organizations-edit.controller.js b/awx/ui/client/src/organizations/edit/organizations-edit.controller.js
index d7abaa462a..8b63401a31 100644
--- a/awx/ui/client/src/organizations/edit/organizations-edit.controller.js
+++ b/awx/ui/client/src/organizations/edit/organizations-edit.controller.js
@@ -25,16 +25,6 @@ export default ['$scope', '$rootScope', '$compile', '$location',
id = $stateParams.organization_id,
relatedSets = {};
- $scope.canEdit = false;
-
- Rest.setUrl(GetBasePath('organizations') + id);
- Rest.options()
- .success(function(data) {
- if (data.actions.PUT) {
- $scope.canEdit = true;
- }
- });
-
$scope.$parent.activeMode = 'edit';
$scope.$parent.activeCard = parseInt(id);
diff --git a/awx/ui/client/src/organizations/list/organizations-list.controller.js b/awx/ui/client/src/organizations/list/organizations-list.controller.js
index 37fa661452..00a5bb9569 100644
--- a/awx/ui/client/src/organizations/list/organizations-list.controller.js
+++ b/awx/ui/client/src/organizations/list/organizations-list.controller.js
@@ -18,14 +18,12 @@ export default ['$stateParams', '$scope', '$rootScope', '$location',
ClearScope();
$scope.canAdd = false;
- $scope.canEdit = false;
Rest.setUrl(GetBasePath('organizations'));
Rest.options()
.success(function(data) {
if (data.actions.POST) {
$scope.canAdd = true;
- $scope.canEdit = true;
}
});
diff --git a/awx/ui/client/src/partials/survey-maker-modal.html b/awx/ui/client/src/partials/survey-maker-modal.html
index 1f75c15c70..1ebb795bb8 100644
--- a/awx/ui/client/src/partials/survey-maker-modal.html
+++ b/awx/ui/client/src/partials/survey-maker-modal.html
@@ -32,13 +32,13 @@
-
+
-
+
-
+
@@ -56,13 +56,13 @@
{{question.question_description}}