From ff5aa09c30124891f41e3553dfcf3fd0997cdd01 Mon Sep 17 00:00:00 2001 From: George Vinogradov Date: Mon, 17 Oct 2011 18:16:21 +0400 Subject: [PATCH] Added method to determine current acter (group or user) --- app/controllers/application_controller.rb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 51b260773..8b5af54af 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -11,6 +11,12 @@ class ApplicationController < ActionController::Base end end + def get_acter + return User.find params[:user_id] if params[:user_id] + return Group.find params[:group_id] if params[:group_id] + return current_user + end + def authenticate_build_service! if request.remote_ip != APP_CONFIG['build_service_ip'] render :nothing => true, :status => 403