disable playbook when permission denied to list

This commit is contained in:
Chris Meyers 2017-01-27 16:31:30 -05:00
parent a467d20341
commit 50970f2c31
2 changed files with 3 additions and 1 deletions

View File

@ -121,7 +121,7 @@ export default
label: i18n._('Playbook'),
type:'select',
ngOptions: 'book for book in playbook_options track by book',
ngDisabled: "(job_type.value === 'scan' && project_name === 'Default') || !(job_template_obj.summary_fields.user_capabilities.edit || canAddJobTemplate)",
ngDisabled: "(job_type.value === 'scan' && project_name === 'Default') || !(job_template_obj.summary_fields.user_capabilities.edit || canAddJobTemplate) || disablePlaybookBecausePermissionDenied",
id: 'playbook-select',
awRequiredWhen: {
reqExpression: "playbookrequired",

View File

@ -98,6 +98,7 @@ export default
Rest.setUrl(url);
Rest.get()
.success(function (data) {
$scope.disablePlaybookBecausePermissionDenied = false;
$scope.playbook_options = [];
var playbookNotFound = true;
for (var i = 0; i < data.length; i++) {
@ -118,6 +119,7 @@ export default
.error(function (ret,status_code) {
if (status_code === 403) {
/* user doesn't have access to see the project, no big deal. */
$scope.disablePlaybookBecausePermissionDenied = true;
} else {
Alert('Missing Playbooks', 'Unable to retrieve the list of playbooks for this project. Choose a different ' +
' project or make the playbooks available on the file system.', 'alert-info');