From c853bd71ab930427d18f90f2f272fc37ca78d90f Mon Sep 17 00:00:00 2001 From: Francesco Siddi Date: Fri, 7 Nov 2014 15:19:09 +0100 Subject: [PATCH] Committing using the actual user name --- webservice/bam/application/__init__.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/webservice/bam/application/__init__.py b/webservice/bam/application/__init__.py index ddce904..e66ae60 100644 --- a/webservice/bam/application/__init__.py +++ b/webservice/bam/application/__init__.py @@ -54,6 +54,9 @@ from application.modules.projects.model import Project, ProjectSetting @auth.get_password def get_password(username): + # Temporarily override API access + # TODO (fsiddi) check against users table + return '' if username == 'bam': return 'bam' return None @@ -225,6 +228,9 @@ class FileAPI(Resource): svn_password = next((setting.value for setting in project.settings if setting.name == 'svn_password')) svn_default_user = next((setting.value for setting in project.settings if setting.name == 'svn_default_user')) + # We get the actual username from the http headers + svn_user = auth.username() + # If the setting does not exist, stop here and prevent any other operation if not svn_password: return make_response(jsonify( @@ -290,7 +296,7 @@ class FileAPI(Resource): result = local_client.run_command('commit', [local_client.info()['entry_path'], '--message', arguments['message'], - '--username', svn_default_user, + '--username', svn_user, '--password', svn_password], combine=True)