summaryrefslogtreecommitdiff
path: root/lib/api/helpers.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/api/helpers.rb')
-rw-r--r--lib/api/helpers.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/api/helpers.rb b/lib/api/helpers.rb
index 1db1f396389..edc662eaaab 100644
--- a/lib/api/helpers.rb
+++ b/lib/api/helpers.rb
@@ -27,6 +27,15 @@ module API
end
end
+ def set_current_user_for_thread
+ Thread.current[:current_user] = current_user
+ begin
+ yield
+ ensure
+ Thread.current[:current_user] = nil
+ end
+ end
+
def user_project
@project ||= find_project(params[:id])
@project || not_found!