summaryrefslogtreecommitdiff
path: root/lib/api/helpers.rb
blob: cd2e39bf3a714306ff4d9b43d306ac70677d8624 (plain)
1
2
3
4
5
6
7
8
9
10
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