gitlabhq/lib/api/helpers.rb

12 lines
244 B
Ruby
Raw Normal View History

2012-06-27 04:32:56 -07:00
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