Module: PandaPal

Defined in:
lib/panda_pal.rb,
lib/panda_pal/engine.rb,
lib/panda_pal/version.rb,
lib/panda_pal/lti_constants.rb,
app/models/panda_pal/session.rb,
app/models/panda_pal/api_call.rb,
app/models/panda_pal/platform.rb,
app/models/panda_pal/organization.rb,
lib/panda_pal/helpers/misc_helper.rb,
app/lib/panda_pal/lti_jwt_validator.rb,
app/lib/panda_pal/launch_url_helpers.rb,
app/models/panda_pal/platform/canvas.rb,
lib/panda_pal/helpers/secure_headers.rb,
app/models/panda_pal/panda_pal_record.rb,
lib/panda_pal/helpers/console_helpers.rb,
app/lib/panda_pal/deep_linking_helpers.rb,
app/controllers/panda_pal/lti_controller.rb,
app/helpers/panda_pal/application_helper.rb,
app/controllers/panda_pal/api_call_controller.rb,
app/controllers/panda_pal/lti_v1_p0_controller.rb,
app/controllers/panda_pal/lti_v1_p3_controller.rb,
app/controllers/panda_pal/panda_pal_controller.rb,
app/models/panda_pal/organization_concerns/task_scheduling.rb,
app/models/panda_pal/organization_concerns/task_scheduling.rb,
app/models/panda_pal/organization_concerns/tenant_handling.rb,
app/models/panda_pal/organization_concerns/settings_validation.rb,
app/models/panda_pal/organization_concerns/organization_builder.rb,
app/models/panda_pal/organization_concerns/multi_database_sharding.rb

Defined Under Namespace

Modules: ApplicationHelper, Concerns, ConsoleHelpers, DeepLinkingHelpers, Helpers, Jobs, LaunchUrlHelpers, LtiConstants, MiscHelper, OrganizationConcerns, Plugins, SecureHeaders, SkipSymmetricEncAttrEncrypted, SpecHelper Classes: ApiCall, ApiCallController, Engine, LtiController, LtiJwtValidator, LtiNavigationInUse, LtiV1P0Controller, LtiV1P3Controller, NotMounted, Organization, PandaPalController, PandaPalRecord, Platform, Session, SettingsMarshaler

Constant Summary collapse

VERSION =
"5.16.8"
@@lti_navigation =
{}
@@lti_options =
{}
@@lti_properties =
{}
@@lti_environments =
{}
@@lti_custom_params =
{}
@@extensions =
{}
@@lti_private_key =
nil

Class Method Summary collapse

Class Method Details

.extensions_for(type) ⇒ Object



104
105
106
# File 'lib/panda_pal.rb', line 104

def self.extensions_for(type)
  (@@extensions[normalize_ext_type(type)] || []).uniq
end

.lti_custom_paramsObject



50
51
52
# File 'lib/panda_pal.rb', line 50

def self.lti_custom_params
  @@lti_custom_params.deep_dup
end

.lti_custom_params=(custom_params) ⇒ Object



46
47
48
# File 'lib/panda_pal.rb', line 46

def self.lti_custom_params=(custom_params)
  @@lti_custom_params = custom_params.with_indifferent_access
end

.lti_environmentsObject



42
43
44
# File 'lib/panda_pal.rb', line 42

def self.lti_environments
  @@lti_environments.deep_dup
end

.lti_environments=(lti_environments) ⇒ Object



38
39
40
# File 'lib/panda_pal.rb', line 38

def self.lti_environments=(lti_environments)
  @@lti_environments = lti_environments
end

.lti_optionsObject



26
27
28
# File 'lib/panda_pal.rb', line 26

def self.lti_options
  @@lti_options.deep_dup
end

.lti_options=(lti_options) ⇒ Object



22
23
24
# File 'lib/panda_pal.rb', line 22

def self.lti_options= lti_options
  @@lti_options = lti_options
end

.lti_pathsObject



72
73
74
# File 'lib/panda_pal.rb', line 72

def self.lti_paths
  @@lti_navigation.deep_dup
end

.lti_private_keyObject



76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# File 'lib/panda_pal.rb', line 76

def self.lti_private_key
  key = @@lti_private_key.presence
  key ||= ENV['LTI_PRIVATE_KEY'].presence

  if key.blank? && ENV['LTI_PRIVATE_KEY_PATH'].present?
    key_path = File.expand_path(ENV['LTI_PRIVATE_KEY_PATH'], Rails.root)
    key = File.read(key_path) if File.exist?(key_path)
  end

  key ||= File.read(File.join( File.dirname(__FILE__), "../config/dev_lti_key.key")) if Rails.env.development?
  return nil unless key.present?

  return key unless key.is_a?(String)

  password = ENV['LTI_PRIVATE_KEY_PASSWORD']
  OpenSSL::PKey::RSA.new(key, password)
end

.lti_private_key=(v) ⇒ Object



94
95
96
# File 'lib/panda_pal.rb', line 94

def self.lti_private_key=(v)
  @@lti_private_key = v
end

.lti_propertiesObject



34
35
36
# File 'lib/panda_pal.rb', line 34

def self.lti_properties
  @@lti_properties.deep_dup
end

.lti_properties=(lti_properties) ⇒ Object



30
31
32
# File 'lib/panda_pal.rb', line 30

def self.lti_properties= lti_properties
  @@lti_properties = lti_properties
end

.register_extension(type, modul) ⇒ Object



98
99
100
101
102
# File 'lib/panda_pal.rb', line 98

def self.register_extension(type, modul)
  type = normalize_ext_type(type)
  @@extensions[type] ||= []
  @@extensions[type] << modul.to_s
end

.resolved_extensions_for(type) ⇒ Object



108
109
110
111
112
# File 'lib/panda_pal.rb', line 108

def self.resolved_extensions_for(type)
  extensions_for(type).map do |ext|
    ext.safe_constantize
  end.compact
end

.stage_navigation(navigation, options = {}) ⇒ Object



54
55
56
57
# File 'lib/panda_pal.rb', line 54

def self.stage_navigation(navigation, options = {})
  warn "[DEPRECATION] `stage_navigation` is deprecated. Please use `stage_placement` instead."
  stage_placement(navigation, options)
end

.stage_placement(placement, options = {}) ⇒ Object



59
60
61
62
63
64
65
66
67
68
69
70
# File 'lib/panda_pal.rb', line 59

def self.stage_placement(placement, options = {})
  @@lti_navigation[placement] ||= {}

  if options.delete(:deep_linking)
    options = options.merge({
      message_type: LtiConstants::MessageTypes::DEEP_LINKING_REQUEST,
      route_helper_key: :deep_link_request
    })
  end

  @@lti_navigation[placement].merge!(options)
end