Class: ApplicationController

Inherits:
ActionController::Base
  • Object
show all
Includes:
HandleFaceting, JsonHelper, ManipulateNode, Searchable
Defined in:
frontend/app/controllers/application_controller.rb,
public/app/controllers/application_controller.rb

Constant Summary

Constants included from Searchable

Searchable::ABSTRACT

Class Method Summary collapse

Instance Method Summary collapse

Methods included from JsonHelper

#merge_notes, #process_json_notes

Methods included from Searchable

#default_search_opts, #get_filter_years, #handle_results, #html_notes, #process_results, #process_search_results, #repo_context, #search_terms, #set_up_advanced_search, #set_up_and_run_search, #set_up_search, #strip_facet_fields

Methods included from HandleFaceting

#fetch_only_facets, #get_pretty_facet_value, #strip_facets

Methods included from ManipulateNode

#inheritance, #process_mixed_content, #strip_mixed_content

Class Method Details

.can_access?(context, method) ⇒ Boolean

Returns:

  • (Boolean)


40
41
42
43
44
45
46
47
48
# File 'frontend/app/controllers/application_controller.rb', line 40

def self.can_access?(context, method)
  permission_mappings.each do |permission, actions|
    if actions.include?(method) && !session_can?(context, permission)
      return false
    end
  end

  return true
end

.permission_mappingsObject



36
37
38
# File 'frontend/app/controllers/application_controller.rb', line 36

def self.permission_mappings
  Array(@permission_mappings)
end

.set_access_control(permission_mappings) ⇒ Object



51
52
53
54
55
56
57
58
59
60
61
# File 'frontend/app/controllers/application_controller.rb', line 51

def self.set_access_control(permission_mappings)
  @permission_mappings = permission_mappings

  skip_before_action :unauthorised_access, :only => Array(permission_mappings.values).flatten.uniq

  permission_mappings.each do |permission, actions|
    next if permission === :public

    before_action(:only => Array(actions)) {|c| user_must_have(permission)}
  end
end

Instance Method Details

#archivesspaceObject



39
40
41
# File 'public/app/controllers/application_controller.rb', line 39

def archivesspace
  ArchivesSpaceClient.instance
end