# HG changeset patch # User Marcin Kuzminski # Date 2018-06-12 16:29:54 # Node ID e5ba79e32b1fbd3b2ed46aa872ed2dfaff321850 # Parent a1e25dcf1a6487ab4940d0d3dac9dcc00e3ad078 audit-logs: use auth_user in few places to track action IP. diff --git a/rhodecode/api/views/pull_request_api.py b/rhodecode/api/views/pull_request_api.py --- a/rhodecode/api/views/pull_request_api.py +++ b/rhodecode/api/views/pull_request_api.py @@ -677,7 +677,8 @@ def create_pull_request( [commit.raw_id for commit in reversed(commit_ranges)]), reviewers=reviewers, title=title, - description=Optional.extract(description) + description=Optional.extract(description), + auth_user=apiuser ) Session().commit() diff --git a/rhodecode/apps/repository/views/repo_pull_requests.py b/rhodecode/apps/repository/views/repo_pull_requests.py --- a/rhodecode/apps/repository/views/repo_pull_requests.py +++ b/rhodecode/apps/repository/views/repo_pull_requests.py @@ -894,7 +894,8 @@ class RepoPullRequestsView(RepoAppView, pull_request = PullRequestModel().create( self._rhodecode_user.user_id, source_repo, source_ref, target_repo, target_ref, commit_ids, reviewers, - pullrequest_title, description, reviewer_rules + pullrequest_title, description, reviewer_rules, + auth_user=self._rhodecode_user ) Session().commit() @@ -1203,7 +1204,8 @@ class RepoPullRequestsView(RepoAppView, status_change_type=(status if status and allowed_to_change_status else None), comment_type=comment_type, - resolves_comment_id=resolves_comment_id + resolves_comment_id=resolves_comment_id, + auth_user=self._rhodecode_user ) if allowed_to_change_status: diff --git a/rhodecode/model/pull_request.py b/rhodecode/model/pull_request.py --- a/rhodecode/model/pull_request.py +++ b/rhodecode/model/pull_request.py @@ -444,10 +444,11 @@ class PullRequestModel(BaseModel): def create(self, created_by, source_repo, source_ref, target_repo, target_ref, revisions, reviewers, title, description=None, - reviewer_data=None, translator=None): + reviewer_data=None, translator=None, auth_user=None): translator = translator or get_current_request().translate created_by_user = self._get_user(created_by) + auth_user = auth_user or created_by_user source_repo = self._get_repo(source_repo) target_repo = self._get_repo(target_repo) @@ -537,7 +538,7 @@ class PullRequestModel(BaseModel): creation_data = pull_request.get_api_data(with_merge_state=False) self._log_audit_action( 'repo.pull_request.create', {'data': creation_data}, - created_by_user, pull_request) + auth_user, pull_request) return pull_request