From 7f4b555e29dd8f16f5bc98852618dab4585b916e Mon Sep 17 00:00:00 2001 From: AntonioTerceiro Date: Tue, 1 Apr 2008 20:47:38 +0000 Subject: [PATCH] ActionItem155: adding security restriction --- app/controllers/public/search_controller.rb | 4 +++- test/functional/search_controller_test.rb | 5 +++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/app/controllers/public/search_controller.rb b/app/controllers/public/search_controller.rb index ece56ba..eef613a 100644 --- a/app/controllers/public/search_controller.rb +++ b/app/controllers/public/search_controller.rb @@ -84,7 +84,9 @@ class SearchController < ApplicationController @results = { asset => @finder.send(asset).recent(LIST_LIMIT) } - @names = { asset => gettext(SEARCH_IN.find { |entry| entry.first == asset }[1]) } + + @asset_name = gettext(SEARCH_IN.find { |entry| entry.first == asset }[1]) + @names = { asset => @asset_name } end def tags diff --git a/test/functional/search_controller_test.rb b/test/functional/search_controller_test.rb index 6a75817..0ffd2d0 100644 --- a/test/functional/search_controller_test.rb +++ b/test/functional/search_controller_test.rb @@ -431,4 +431,9 @@ class SearchControllerTest < Test::Unit::TestCase assert_response 403 end + should 'expose asset name in instance variable' do + get :assets, :asset => 'products' + assert_equal 'Products', assigns(:asset_name) + end + end -- libgit2 0.21.2