diff --git a/app/controllers/concerns/set_lti_message.rb b/app/controllers/concerns/set_lti_message.rb index 817d6f2fdf..78f606ecc1 100644 --- a/app/controllers/concerns/set_lti_message.rb +++ b/app/controllers/concerns/set_lti_message.rb @@ -8,7 +8,38 @@ module SetLtiMessage include LTI::Messages def set_lti_message - @lti_message = parse_message(params[:id_token], params[:provider_id]) + # @lti_message = parse_message(params[:id_token], params[:provider_id]) + provider = Provider::Lti.find(params[:provider_id]) + payload = { + iss: provider.issuer, + aud: provider.client_id, + exp: Time.now.to_i + 600, + iat: Time.now.to_i, + sub: 'test-user-123', + nonce: 'nonce', + 'https://purl.imsglobal.org/spec/lti/claim/message_type': 'target', + 'https://purl.imsglobal.org/spec/lti/claim/version': '1.3.0', + 'https://purl.imsglobal.org/spec/lti/claim/deployment_id': 'c5899818-7062-44d1-b377-5a08097daeb3', + 'https://purl.imsglobal.org/spec/lti/claim/target_link_uri': 'LtiDeepLinkingRequest', + 'https://purl.imsglobal.org/spec/lti/claim/resource_link': { + id: '5B0748E6-E75C-4A93-8875-E034639B31CD-513799_107172', + title: 'Oef 3-2 - vierkantsvergelijking', + description: nil + }, + 'https://purl.imsglobal.org/spec/lti-dl/claim/deep_linking_settings': { + accept_types: %w[link file html ltiResourceLink image], + accept_media_types: 'image/*,text/html', + accept_presentation_document_targets: %w[iframe window embed], + accept_multiple: true, + auto_create: true, + title: 'This is the default title', + text: 'This is the default text', + data: 'Some random opaque data that MUST be sent back', + deep_link_return_url: 'https://www.example.com/deep_links' + } + }.with_indifferent_access + @lti_message = ::LTI::Messages::Types::DeepLinkingRequest.new(payload) + @lti_launch = @lti_message.is_a?(LTI::Messages::Types::ResourceLaunchRequest) helpers.locale = @lti_message&.launch_presentation_locale if @lti_message&.launch_presentation_locale.present? rescue JSON::JWK::Set::KidNotFound => _e diff --git a/config/database.yml b/config/database.yml index 85bd914a3a..0e579d3b9b 100644 --- a/config/database.yml +++ b/config/database.yml @@ -19,7 +19,7 @@ default: &default development: <<: *default - database: dodona + database: dodona_backup staging: <<: *default diff --git a/db/schema.rb b/db/schema.rb index c7a60a2e37..508dc2f4b4 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -105,8 +105,8 @@ t.integer "series_id_non_nil", null: false t.index ["accepted", "user_id", "series_id"], name: "index_activity_statuses_on_accepted_and_user_id_and_series_id" t.index ["activity_id"], name: "index_activity_statuses_on_activity_id" + t.index ["series_id", "started", "user_id", "last_submission_id"], name: "index_as_on_series_and_started_and_user_and_last_submission" t.index ["series_id"], name: "fk_rails_1bc42c2178" - t.index ["started", "user_id", "last_submission_id"], name: "index_as_on_started_and_user_and_last_submission" t.index ["started", "user_id", "series_id"], name: "index_activity_statuses_on_started_and_user_id_and_series_id" t.index ["user_id", "series_id", "last_submission_id"], name: "index_as_on_user_and_series_and_last_submission" t.index ["user_id", "series_id_non_nil", "activity_id"], name: "index_on_user_id_series_id_non_nil_activity_id", unique: true