1
0
mirror of https://github.com/ansible/awx.git synced 2024-10-29 20:55:32 +03:00

remove use of canEdit in favor of user capabilities

This commit is contained in:
John Mitchell 2016-09-13 13:46:44 -04:00
parent 297be96b80
commit 8cff8e4202
30 changed files with 180 additions and 315 deletions

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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();

View File

@ -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'
}
},

View File

@ -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 <em>All</em> to include all regions. Tower will only be updated with Hosts associated with the selected regions." +
"</p>",
dataContainer: 'body',
ngDisabled: '!canEdit'
ngDisabled: '!group_obj.summary_fields.user_capabilities.edit'
},
instance_filters: {
label: 'Instance Filters',
@ -118,7 +118,7 @@ export default
"<p>View the <a href=\"http://docs.aws.amazon.com/AWSEC2/latest/APIReference/ApiReference-query-DescribeInstances.html\" target=\"_blank\">Describe Instances documentation</a> " +
"for a complete list of supported filters.</p>",
dataContainer: 'body',
ngDisabled: '!canEdit'
ngDisabled: '!group_obj.summary_fields.user_capabilities.edit'
},
group_by: {
label: 'Only Group By',
@ -144,7 +144,7 @@ export default
"<li>Tag None: <strong>tags &raquo; tag_none</strong></li>" +
"</ul><p>If blank, all groups above are created except <em>Instance ID</em>.</p>",
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'
}
},

View File

@ -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'
}
},

View File

@ -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: '&#43; ADD',
ngShow: 'canEdit'
ngShow: 'inventory_obj.summary_fields.user_capabilities.edit'
}
},

View File

@ -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: "<p>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.</p>",
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 <button> 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: '&#43; ADD',
ngShow: 'canEdit'
ngShow: 'job_template_obj.summary_fields.user_capabilities.edit'
}
},

View File

@ -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 <button> 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: '&#43; ADD',
ngShow: 'canEdit'
ngShow: 'organization_obj.summary_fields.user_capabilities.edit'
}
},

View File

@ -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: '&#43; ADD',
ngShow: 'canEdit'
ngShow: 'project_obj.summary_fields.user_capabilities.edit'
}
},

View File

@ -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: '&#43; ADD',
ngShow: 'canEdit'
ngShow: 'team_obj.summary_fields.user_capabilities.edit'
}
},

View File

@ -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'
}
},

View File

@ -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;

View File

@ -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;
}
});

View File

@ -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'){

View File

@ -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';

View File

@ -29,8 +29,6 @@ export default
form = inventoryScriptsFormObject,
url = GetBasePath('inventory_scripts');
$scope.canEdit = true;
generator.inject(form, {
mode: 'add' ,
scope:scope,

View File

@ -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' ,

View File

@ -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: "<p>Drag and drop your custom inventory script file here or create one in the field to import your custom inventory. " +
"<br><br> Script must begin with a hashbang sequence: i.e.... #!/usr/bin/env python</p>",
@ -67,16 +67,16 @@ export default function() {
buttons: { //for now always generates <button> 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'
}
}
};

View File

@ -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;
}
});

View File

@ -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;

View File

@ -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;
}
});

View File

@ -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' ,

View File

@ -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;;
}
});

View File

@ -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 <button> 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
}
}

View File

@ -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);

View File

@ -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;
}
});

View File

@ -32,13 +32,13 @@
</div>
</div>
<div class="SurveyMaker-content">
<div class="SurveyMaker-questionPanel" ng-show="canEdit">
<div class="SurveyMaker-questionPanel" ng-show="job_template_obj.summary_fields.user_capabilities.edit">
<div id="survey_maker_question_form"></div>
</div>
<div class="SurveyMaker-separatorPanel" ng-show="canEdit">
<div class="SurveyMaker-separatorPanel" ng-show="job_template_obj.summary_fields.user_capabilities.edit">
<div class="SurveyMaker-contentSeparator"></div>
</div>
<div class="SurveyMaker-previewPanel" ng-class="{'SurveyMaker-previewPanel--viewOnly': !canEdit}">
<div class="SurveyMaker-previewPanel" ng-class="{'SurveyMaker-previewPanel--viewOnly': !job_template_obj.summary_fields.user_capabilities.edit}">
<div style="display: flex; flex-direction: column; width: 100%;">
<div class="SurveyMaker-panelHeader">PREVIEW</div>
<div class="SurveyMaker-panelBody">
@ -56,13 +56,13 @@
<i>{{question.question_description}}</i>
</div>
<div class="SurveyMaker-previewInputRow">
<span dnd-handle class="SurveyMaker-reorderButton" data-placement="top" aw-tool-tip="Drag to reorder question" data-original-title="" title="" ng-show="canEdit">
<span dnd-handle class="SurveyMaker-reorderButton" data-placement="top" aw-tool-tip="Drag to reorder question" data-original-title="" title="" ng-show="job_template_obj.summary_fields.user_capabilities.edit">
<i class="fa fa-ellipsis-v"></i>
<span>&nbsp;</span>
<i class="fa fa-ellipsis-v"></i>
</span>
<survey-question class="SurveyMaker-previewInput" preview="true" question="question" ng-required="question.required" ng-disabled=true></survey-question>
<div class="SurveyMaker-previewActions" ng-show="canEdit">
<div class="SurveyMaker-previewActions" ng-show="job_template_obj.summary_fields.user_capabilities.edit">
<button class="List-actionButton" data-placement="top" ng-class="{'SurveyMaker-previewActions--selected' : editQuestionIndex == $index}" ng-click="editQuestion($index)" aw-tool-tip="Edit question" data-original-title="" title="">
<i class="fa fa-pencil"></i>
</button>
@ -80,10 +80,10 @@
</div>
<div class="SurveyMaker-panelFooter">
<div class="Form-buttons">
<button id="survey-delete-button" class="btn btn-sm SurveyMaker-deleteButton" ng-show="survey_exists && canEdit" ng-click="showDeleteOverlay('survey')">DELETE SURVEY</button>
<button id="survey-close-button" class="btn btn-sm Form-buttonDefault" ng-click="closeSurvey('survey-modal-dialog')" ng-show="canEdit">CANCEL</button>
<button id="survey-close-button" class="btn btn-sm Form-buttonDefault" ng-click="closeSurvey('survey-modal-dialog')" ng-show="!canEdit">CLOSE</button>
<button id="survey-save-button" class="btn btn-sm Form-saveButton" ng-click="saveSurvey()" ng-disabled="survey_questions.length < 1 || !can_edit || editQuestionIndex !== null" ng-show="canEdit">SAVE</button>
<button id="survey-delete-button" class="btn btn-sm SurveyMaker-deleteButton" ng-show="survey_exists && job_template_obj.summary_fields.user_capabilities.edit" ng-click="showDeleteOverlay('survey')">DELETE SURVEY</button>
<button id="survey-close-button" class="btn btn-sm Form-buttonDefault" ng-click="closeSurvey('survey-modal-dialog')" ng-show="job_template_obj.summary_fields.user_capabilities.edit">CANCEL</button>
<button id="survey-close-button" class="btn btn-sm Form-buttonDefault" ng-click="closeSurvey('survey-modal-dialog')" ng-show="!job_template_obj.summary_fields.user_capabilities.edit">CLOSE</button>
<button id="survey-save-button" class="btn btn-sm Form-saveButton" ng-click="saveSurvey()" ng-disabled="survey_questions.length < 1 || !can_edit || editQuestionIndex !== null" ng-show="job_template_obj.summary_fields.user_capabilities.edit">SAVE</button>
</div>
</div>
</div>

View File

@ -50,14 +50,12 @@ export default [
url += "schedules/";
$scope.canAdd = false;
$scope.canEdit = false;
Rest.setUrl(url);
Rest.options()
.success(function(data) {
if (data.actions.POST) {
$scope.canAdd = true;
$scope.canEdit = true;
}
});