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

pulibrary / orangelight / 4c391e0e-519a-40cb-8ad3-354445f4ce03

12 Aug 2025 08:47PM UTC coverage: 85.348% (-10.0%) from 95.335%
4c391e0e-519a-40cb-8ad3-354445f4ce03

push

circleci

web-flow
[#5143] Use access restriction note as Aeon ItemInfo1 if available (#5173)

With this commit, if a user visits a record with an access
restrictions note and presses the Reading Room Request
button, they will get to an Aeon form with the 'Restrictions'
field pre-filled with the restriction note.

If the record does not have an access restrictions note,
the field will be pre-filled with 'Reading Room Access Only',
as it has been previously.

Closes #5143

5493 of 6436 relevant lines covered (85.35%)

251.82 hits per line

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

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

3
class ApplicationController < ActionController::Base
1✔
4
  # Adds a few additional behaviors into the application controller
5
  include Blacklight::Controller
1✔
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'
1✔
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
1✔
15

16
  def after_sign_in_path_for(resource)
1✔
17
    stored_location = stored_location_for(resource)
4✔
18
    if referrer.present? && referrer.exclude?("sign_in") && !origin&.include?("redirect-to-alma")
4✔
19
      referrer
×
20
    elsif origin.present?
4✔
21
      request.flash.delete('alert')
×
22
      request.flash.keep('notice')
×
23
      origin.chomp('/email')
×
24
    elsif !request.env['omniauth.origin'].nil? &&
4✔
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?
4✔
28
      stored_location
×
29
    else
30
      account_path
4✔
31
    end
32
  end
33

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

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

42
      if referrer.present? && referrer.include?("origin")
4✔
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)
1✔
50
    if resource == 'barcode' || resource == "alma"
2✔
51
      root_url
1✔
52
    else
53
      Rails.configuration.x.after_sign_out_url
1✔
54
    end
55
  end
56

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

61
  private
1✔
62

63
    def verify_admin!
1✔
64
      authenticate_user!
3✔
65
      head :forbidden unless current_user.admin?
2✔
66
    end
67

68
    def referrer_from_url(url)
1✔
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
1✔
78
      Rack::MiniProfiler.authorize_request if current_user&.admin?
300✔
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