1
0
mirror of https://github.com/ansible/awx.git synced 2024-11-01 16:51:11 +03:00

Merge pull request #3460 from vismay-golwala/project_admin_issue

Project admin manual SCM Type creation bug fix

Reviewed-by: https://github.com/softwarefactory-project-zuul[bot]
This commit is contained in:
softwarefactory-project-zuul[bot] 2019-04-05 15:43:49 +00:00 committed by GitHub
commit 161fd9cde0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 19 deletions

View File

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

View File

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

View File

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