Skip to content

Commit

Permalink
bugfix: fixing a logic issue (was evaluating correctly, but not in th…
Browse files Browse the repository at this point in the history
…e way I thought it would when I wrote it)
  • Loading branch information
Kieran Pilkington committed Aug 26, 2008
1 parent 7d3a571 commit 3e55f46
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion app/controllers/baskets_controller.rb
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/private_files_controller.rb
Expand Up @@ -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

Expand Down
8 changes: 4 additions & 4 deletions app/controllers/search_controller.rb
Expand Up @@ -275,21 +275,21 @@ 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)
@search.pqf_query.within(@current_basket.urlified_name)
else
return access_denied
end

elsif @current_basket != @site_basket
@search.pqf_query.within(@current_basket.urlified_name)
end
Expand Down

0 comments on commit 3e55f46

Please sign in to comment.