diff --git a/app/controllers/baskets_controller.rb b/app/controllers/baskets_controller.rb index 0a6512629..f9a1e3771 100644 --- a/app/controllers/baskets_controller.rb +++ b/app/controllers/baskets_controller.rb @@ -228,7 +228,7 @@ def choose_type # in the future this will present the join policy of the basket, etc # now it only says "login as different user or contact an administrator" def permissioned_denied - session[:has_access_on_baskets] = current_user.get_basket_permissions if logged_in? || Hash.new + session[:has_access_on_baskets] = logged_in? ? current_user.get_basket_permissions : Hash.new end def set_settings diff --git a/app/controllers/private_files_controller.rb b/app/controllers/private_files_controller.rb index 86c1ec145..a0a580777 100644 --- a/app/controllers/private_files_controller.rb +++ b/app/controllers/private_files_controller.rb @@ -33,7 +33,7 @@ def show render :text => "Error 400: Bad Request", :status => 400 rescue PermissionDeniedError logger.warn("#{Time.now} - Permission Denied While Requesting Private Item: #{params.inspect}") - session[:has_access_on_baskets] = current_user.get_basket_permissions if logged_in? || Hash.new + session[:has_access_on_baskets] = logged_in? ? current_user.get_basket_permissions : Hash.new render :text => "Error 401: Unauthorized", :status => 401 end diff --git a/app/controllers/search_controller.rb b/app/controllers/search_controller.rb index 02398c7df..a6d49651d 100644 --- a/app/controllers/search_controller.rb +++ b/app/controllers/search_controller.rb @@ -275,13 +275,13 @@ def populate_result_sets_for(zoom_class) # limit baskets searched within, if appropriate unless searching_for_related_items? if params[:privacy_type] == 'private' - + # get the urlified_name for each basket the user has a role in # from their session - basket_access_hash = current_user.get_basket_permissions if logged_in? || Hash.new + basket_access_hash = logged_in? ? current_user.get_basket_permissions : Hash.new session[:has_access_on_baskets] = basket_access_hash basket_urlified_names = basket_access_hash.keys.collect { |key| key.to_s } - + if @current_basket == @site_basket @search.pqf_query.within(basket_urlified_names) unless basket_urlified_names.blank? elsif (@current_basket != @site_basket) and basket_urlified_names.member?(@current_basket.urlified_name) @@ -289,7 +289,7 @@ def populate_result_sets_for(zoom_class) else return access_denied end - + elsif @current_basket != @site_basket @search.pqf_query.within(@current_basket.urlified_name) end