Module: Goldberg::Filters

Defined in:
lib/six-updater-web/vendor/plugins/goldberg/lib/goldberg/filters.rb

Constant Summary collapse

ERROR_SELF_REG_CONFIRMATION_REQUIRED =
[1, "Your registration has not yet been confirmed."]
ERROR_SESSION_EXPIRED =
[2, "Your session has expired.  Please log in again."]
ERROR_NOT_FOUND =
[3, "The page or resource you requested was not found."]
ERROR_PERMISSION_DENIED =
[4, "You do not have permission to access that page or resource."]

Instance Method Summary collapse

Instance Method Details

#goldberg_security_upObject



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/six-updater-web/vendor/plugins/goldberg/lib/goldberg/filters.rb', line 20

def goldberg_security_up
  if Goldberg.settings
    session[:goldberg] ||= Hash.new
    session[:goldberg][:path] = request.path

    logger.debug "Setting user..."
    set_user or return false
    
    # Perform some preliminary checks for logged-in users.
    if Goldberg.user
      # Check that the user is not pending registration confirmation.
      logger.debug "Check user not pending registration confirmation..."
      check_not_pending or return false
      # If the user's session has expired, kick out the user.
      logger.debug "Check session not expired..."
      check_not_expired or return false
    end
    
    # The default is false.  check_page_exists() will set this to true if the current request is for a ContentPage.
    @is_page_request = false

    # If this is a page request check that it exists, and if not
    # redirect to the "unknown" page.
    logger.debug "Checking that page exists..."
    check_page_exists or return false
    

    # The default is false. check_permissions() will set this to true if the user is authorised for the current action.
    @authorised = false
    
    # Check whether the user is authorised for this page or action.
    logger.debug "Checking permissions..."
    check_permissions or return false
    
  end  # if Goldberg.settings
  
  session[:last_time] = Time.now
  
  return true
end