From 4ad91d3c1144c406e50c7b33bae684bd6837faf8 Mon Sep 17 00:00:00 2001 From: Nihad Abbasov Date: Wed, 27 Jun 2012 04:32:56 -0700 Subject: add users API --- lib/api/helpers.rb | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 lib/api/helpers.rb (limited to 'lib/api/helpers.rb') diff --git a/lib/api/helpers.rb b/lib/api/helpers.rb new file mode 100644 index 00000000000..cd2e39bf3a7 --- /dev/null +++ b/lib/api/helpers.rb @@ -0,0 +1,11 @@ +module Gitlab + module APIHelpers + def current_user + @current_user ||= User.find_by_authentication_token(params[:private_token]) + end + + def authenticate! + error!('401 Unauthorized', 401) unless current_user + end + end +end -- cgit v1.2.1