mirror of
https://github.com/ansible/awx.git
synced 2026-05-19 23:07:42 -02:30
Fixes bug where save changes modal was shown to user with execute permissions
This commit is contained in:
@@ -498,7 +498,7 @@ angular.module('templates', [surveyMaker.name, jobTemplates.name, labels.name, p
|
|||||||
},
|
},
|
||||||
views: {
|
views: {
|
||||||
'modal': {
|
'modal': {
|
||||||
template: `<workflow-maker ng-if="includeWorkflowMaker" workflow-job-template-obj="workflow_job_template_obj" can-add-workflow-job-template="canAddWorkflowJobTemplate"></workflow-maker>`
|
template: `<workflow-maker ng-if="includeWorkflowMaker" workflow-job-template-obj="workflow_job_template_obj" can-add-or-edit="canAddOrEdit"></workflow-maker>`
|
||||||
},
|
},
|
||||||
'jobTemplateList@templates.editWorkflowJobTemplate.workflowMaker': {
|
'jobTemplateList@templates.editWorkflowJobTemplate.workflowMaker': {
|
||||||
templateProvider: function(WorkflowMakerJobTemplateList, generateList) {
|
templateProvider: function(WorkflowMakerJobTemplateList, generateList) {
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ export default [
|
|||||||
|
|
||||||
const workflowTemplate = resolvedModels[1];
|
const workflowTemplate = resolvedModels[1];
|
||||||
|
|
||||||
$scope.canAddWorkflowJobTemplate = workflowTemplate.options('actions.POST');
|
$scope.canAddOrEdit = workflowTemplate.options('actions.POST');
|
||||||
|
|
||||||
$scope.canEditOrg = true;
|
$scope.canEditOrg = true;
|
||||||
$scope.canEditInventory = true;
|
$scope.canEditInventory = true;
|
||||||
|
|||||||
@@ -26,12 +26,6 @@ export default [
|
|||||||
$scope.sufficientRoleForNotif = isNotificationAdmin || $scope.user_is_system_auditor;
|
$scope.sufficientRoleForNotif = isNotificationAdmin || $scope.user_is_system_auditor;
|
||||||
$scope.missingTemplates = _.has(workflowLaunch, 'node_templates_missing') && workflowLaunch.node_templates_missing.length > 0 ? true : false;
|
$scope.missingTemplates = _.has(workflowLaunch, 'node_templates_missing') && workflowLaunch.node_templates_missing.length > 0 ? true : false;
|
||||||
|
|
||||||
$scope.$watch('workflow_job_template_obj.summary_fields.user_capabilities.edit', function(val) {
|
|
||||||
if (val === false) {
|
|
||||||
$scope.canAddWorkflowJobTemplate = false;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
const criteriaObj = {
|
const criteriaObj = {
|
||||||
from: (state) => state.name === 'templates.editWorkflowJobTemplate.workflowMaker',
|
from: (state) => state.name === 'templates.editWorkflowJobTemplate.workflowMaker',
|
||||||
to: (state) => state.name === 'templates.editWorkflowJobTemplate'
|
to: (state) => state.name === 'templates.editWorkflowJobTemplate'
|
||||||
@@ -289,7 +283,7 @@ export default [
|
|||||||
|
|
||||||
$scope.workflow_job_template_obj = workflowJobTemplateData;
|
$scope.workflow_job_template_obj = workflowJobTemplateData;
|
||||||
$scope.name = workflowJobTemplateData.name;
|
$scope.name = workflowJobTemplateData.name;
|
||||||
$scope.can_edit = workflowJobTemplateData.summary_fields.user_capabilities.edit;
|
$scope.can_edit = $scope.canAddOrEdit = workflowJobTemplateData.summary_fields.user_capabilities.edit;
|
||||||
$scope.breadcrumb.workflow_job_template_name = $scope.name;
|
$scope.breadcrumb.workflow_job_template_name = $scope.name;
|
||||||
let fld, i;
|
let fld, i;
|
||||||
for (fld in form.fields) {
|
for (fld in form.fields) {
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ export default ['templateUrl', 'CreateDialog', 'Wait', '$state', '$window',
|
|||||||
return {
|
return {
|
||||||
scope: {
|
scope: {
|
||||||
workflowJobTemplateObj: '=',
|
workflowJobTemplateObj: '=',
|
||||||
canAddWorkflowJobTemplate: '='
|
canAddOrEdit: '='
|
||||||
},
|
},
|
||||||
restrict: 'E',
|
restrict: 'E',
|
||||||
templateUrl: templateUrl('templates/workflows/workflow-maker/workflow-maker'),
|
templateUrl: templateUrl('templates/workflows/workflow-maker/workflow-maker'),
|
||||||
@@ -63,7 +63,11 @@ export default ['templateUrl', 'CreateDialog', 'Wait', '$state', '$window',
|
|||||||
});
|
});
|
||||||
|
|
||||||
scope.closeDialog = function(exitWithUnsavedChanges) {
|
scope.closeDialog = function(exitWithUnsavedChanges) {
|
||||||
if (exitWithUnsavedChanges || !(scope.workflowChangesUnsaved || scope.workflowChangesStarted)) {
|
if (
|
||||||
|
!scope.canAddOrEdit
|
||||||
|
|| exitWithUnsavedChanges
|
||||||
|
|| !(scope.workflowChangesUnsaved || scope.workflowChangesStarted)
|
||||||
|
) {
|
||||||
scope.unsavedChangesVisible = false;
|
scope.unsavedChangesVisible = false;
|
||||||
$('#workflow-modal-dialog').dialog('destroy');
|
$('#workflow-modal-dialog').dialog('destroy');
|
||||||
$('body').removeClass('WorkflowMaker-preventBodyScrolling');
|
$('body').removeClass('WorkflowMaker-preventBodyScrolling');
|
||||||
|
|||||||
Reference in New Issue
Block a user