• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

pulibrary / orangelight / 00dbc10b-d747-4ad7-b211-7b26d753abbb

14 Aug 2025 01:25PM UTC coverage: 0.483% (-94.9%) from 95.343%
00dbc10b-d747-4ad7-b211-7b26d753abbb

push

circleci

web-flow
Merge pull request #5181 from pulibrary/dependabot/bundler/activestorage-7.2.2.2

Bump activestorage from 7.2.2.1 to 7.2.2.2

47 of 9721 relevant lines covered (0.48%)

0.01 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/app/controllers/application_controller.rb
1
# frozen_string_literal: true
2

3
class ApplicationController < ActionController::Base
×
4
  # Adds a few additional behaviors into the application controller
5
  include Blacklight::Controller
×
6

7
  # Please be sure to impelement current_user and user_session. Blacklight depends on
8
  # these methods in order to perform user specific actions.
9

10
  layout 'application'
×
11

12
  # Prevent CSRF attacks by raising an exception.
13
  # For APIs, you may want to use :null_session instead.
14
  protect_from_forgery with: :exception
×
15

16
  def after_sign_in_path_for(resource)
×
17
    stored_location = stored_location_for(resource)
×
18
    if referrer.present? && referrer.exclude?("sign_in") && !origin&.include?("redirect-to-alma")
×
19
      referrer
×
20
    elsif origin.present?
×
21
      request.flash.delete('alert')
×
22
      request.flash.keep('notice')
×
23
      origin.chomp('/email')
×
24
    elsif !request.env['omniauth.origin'].nil? &&
×
25
          /request|borrow-direct|email|bookmarks|search_history|redirect-to-alma/.match(request.env['omniauth.origin'])
×
26
      referrer_from_url(request.env['omniauth.origin'])
×
27
    elsif stored_location.present?
×
28
      stored_location
×
29
    else
×
30
      account_path
×
31
    end
×
32
  end
×
33

34
  def referrer
×
35
    @referrer ||= params[:url] || request.referer
×
36
  end
×
37

38
  def origin
×
39
    @origin ||= begin
×
40
      return params[:origin] if params[:origin].present?
×
41

42
      if referrer.present? && referrer.include?("origin")
×
43
        referrer_params = Rack::Utils.parse_query URI.parse(referrer).query
×
44
        return referrer_params["origin"]
×
45
      end
×
46
    end
×
47
  end
×
48

49
  def after_sign_out_path_for(resource)
×
50
    if resource == 'barcode' || resource == "alma"
×
51
      root_url
×
52
    else
×
53
      Rails.configuration.x.after_sign_out_url
×
54
    end
×
55
  end
×
56

57
  def default_url_options
×
58
    Rails.env.production? || Rails.env.staging? ? { protocol: 'https' } : {}
×
59
  end
×
60

61
  private
×
62

63
    def verify_admin!
×
64
      authenticate_user!
×
65
      head :forbidden unless current_user.admin?
×
66
    end
×
67

68
    def referrer_from_url(url)
×
69
      query = URI.parse(url).query
×
70
      if query
×
71
        CGI.parse(query).try(:[], "referer")&.first
×
72
      else
×
73
        url
×
74
      end
×
75
    end
×
76

77
    before_action do
×
78
      Rack::MiniProfiler.authorize_request if current_user&.admin?
×
79
    end
×
80
end
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc