From 0f604e62fb453f2359ebc0438fe7dfaff8e55d10 Mon Sep 17 00:00:00 2001 From: Nihad Abbasov Date: Fri, 6 Jul 2012 06:08:17 -0700 Subject: refactor projects API --- lib/api/helpers.rb | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'lib/api/helpers.rb') diff --git a/lib/api/helpers.rb b/lib/api/helpers.rb index 424a17b283c..e7b9a417b08 100644 --- a/lib/api/helpers.rb +++ b/lib/api/helpers.rb @@ -4,6 +4,10 @@ module Gitlab @current_user ||= User.find_by_authentication_token(params[:private_token]) end + def user_project + @project ||= current_user.projects.find_by_code(params[:id]) + end + def authenticate! error!({'message' => '401 Unauthorized'}, 401) unless current_user end -- cgit v1.2.1