diff --git a/awx/api/views/root.py b/awx/api/views/root.py index 66bc11b710..6f0822e0b9 100644 --- a/awx/api/views/root.py +++ b/awx/api/views/root.py @@ -221,7 +221,8 @@ class ApiV1ConfigView(APIView): if request.user.is_superuser \ or request.user.is_system_auditor \ or Organization.accessible_objects(request.user, 'admin_role').exists() \ - or Organization.accessible_objects(request.user, 'auditor_role').exists(): + or Organization.accessible_objects(request.user, 'auditor_role').exists() \ + or Organization.accessible_objects(request.user, 'project_admin_role').exists(): data.update(dict( project_base_dir = settings.PROJECTS_ROOT, project_local_paths = Project.get_local_path_choices(), diff --git a/awx/ui/client/src/projects/edit/projects-edit.controller.js b/awx/ui/client/src/projects/edit/projects-edit.controller.js index 54f6493326..8fdb139a39 100644 --- a/awx/ui/client/src/projects/edit/projects-edit.controller.js +++ b/awx/ui/client/src/projects/edit/projects-edit.controller.js @@ -51,20 +51,7 @@ export default ['$scope', '$rootScope', '$stateParams', 'ProjectsForm', 'Rest', $scope.projectLoadedRemove(); } $scope.projectLoadedRemove = $scope.$on('projectLoaded', function() { - var opts = []; - - if (Authorization.getUserInfo('is_superuser') === true) { - GetProjectPath({ scope: $scope, master: master }); - } else { - opts.push({ - label: $scope.local_path, - value: $scope.local_path - }); - $scope.project_local_paths = opts; - $scope.local_path = $scope.project_local_paths[0]; - $scope.base_dir = i18n._('You do not have access to view this property'); - $scope.$emit('pathsReady'); - } + GetProjectPath({ scope: $scope, master: master }); $scope.pathRequired = ($scope.scm_type.value === 'manual') ? true : false; $scope.scmRequired = ($scope.scm_type.value !== 'manual') ? true : false; diff --git a/awx/ui/client/src/projects/factories/get-project-path.factory.js b/awx/ui/client/src/projects/factories/get-project-path.factory.js index 3778f3c28e..6d8f7adedd 100644 --- a/awx/ui/client/src/projects/factories/get-project-path.factory.js +++ b/awx/ui/client/src/projects/factories/get-project-path.factory.js @@ -1,5 +1,5 @@ export default - function GetProjectPath(Alert, Rest, GetBasePath, ProcessErrors) { + function GetProjectPath(i18n, Rest, GetBasePath, ProcessErrors) { return function(params) { var scope = params.scope, master = params.master; @@ -53,7 +53,7 @@ export default } } } - scope.base_dir = data.project_base_dir; + scope.base_dir = data.project_base_dir || i18n._('You do not have access to view this property'); master.local_path = scope.local_path; master.base_dir = scope.base_dir; // Keep in master object so that it doesn't get // wiped out on form reset. @@ -65,13 +65,13 @@ export default }) .catch(({data, status}) => { ProcessErrors(scope, data, status, null, { hdr: 'Error!', - msg: 'Failed to access API config. GET status: ' + status }); + msg: i18n._('Failed to access API config. GET status: ') + status }); }); }; } GetProjectPath.$inject = - [ 'Alert', + [ 'i18n', 'Rest', 'GetBasePath', 'ProcessErrors'