2012-06-27 13:32:56 +02:00
|
|
|
module Gitlab
|
|
|
|
module APIHelpers
|
|
|
|
def current_user
|
|
|
|
@current_user ||= User.find_by_authentication_token(params[:private_token])
|
|
|
|
end
|
|
|
|
|
|
|
|
def authenticate!
|
2012-06-29 12:52:20 +02:00
|
|
|
error!({'message' => '401 Unauthorized'}, 401) unless current_user
|
2012-06-27 13:32:56 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|