mirror of
https://github.com/ansible/awx.git
synced 2026-03-27 13:55:04 -02:30
disable playbook when permission denied to list
This commit is contained in:
@@ -121,7 +121,7 @@ export default
|
|||||||
label: i18n._('Playbook'),
|
label: i18n._('Playbook'),
|
||||||
type:'select',
|
type:'select',
|
||||||
ngOptions: 'book for book in playbook_options track by book',
|
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',
|
id: 'playbook-select',
|
||||||
awRequiredWhen: {
|
awRequiredWhen: {
|
||||||
reqExpression: "playbookrequired",
|
reqExpression: "playbookrequired",
|
||||||
|
|||||||
@@ -98,6 +98,7 @@ export default
|
|||||||
Rest.setUrl(url);
|
Rest.setUrl(url);
|
||||||
Rest.get()
|
Rest.get()
|
||||||
.success(function (data) {
|
.success(function (data) {
|
||||||
|
$scope.disablePlaybookBecausePermissionDenied = false;
|
||||||
$scope.playbook_options = [];
|
$scope.playbook_options = [];
|
||||||
var playbookNotFound = true;
|
var playbookNotFound = true;
|
||||||
for (var i = 0; i < data.length; i++) {
|
for (var i = 0; i < data.length; i++) {
|
||||||
@@ -118,6 +119,7 @@ export default
|
|||||||
.error(function (ret,status_code) {
|
.error(function (ret,status_code) {
|
||||||
if (status_code === 403) {
|
if (status_code === 403) {
|
||||||
/* user doesn't have access to see the project, no big deal. */
|
/* user doesn't have access to see the project, no big deal. */
|
||||||
|
$scope.disablePlaybookBecausePermissionDenied = true;
|
||||||
} else {
|
} else {
|
||||||
Alert('Missing Playbooks', 'Unable to retrieve the list of playbooks for this project. Choose a different ' +
|
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');
|
' project or make the playbooks available on the file system.', 'alert-info');
|
||||||
|
|||||||
Reference in New Issue
Block a user