Skip to content

Commit

Permalink
Merge pull request #1 from brospars/enabled-settings
Browse files Browse the repository at this point in the history
Fix mit-teaching-systems-lab#33 add enabled settings
  • Loading branch information
brospars authored Nov 29, 2021
2 parents e96d9c9 + 88c1933 commit 189c29d
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 2 deletions.
1 change: 1 addition & 0 deletions config/locales/server.en.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
en:
site_settings:
lti_consumer_enabled: "Enable LTI authentication"
lti_consumer_key: "LTI consumer key"
lti_consumer_secret: "LTI consumer secret"
lti_consumer_authenticate_url: 'EdX authentication URL (eg., course page with link to forums)'
2 changes: 2 additions & 0 deletions config/settings.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
plugins:
lti_consumer_enabled:
default: true
lti_consumer_key:
default: 'foo'
client: false
Expand Down
4 changes: 4 additions & 0 deletions lti_authenticator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ def name
'lti'
end

def enabled?
SiteSetting.lti_consumer_enabled
end

# override hook
def register_middleware(omniauth)
log :info, 'register_middleware'
Expand Down
3 changes: 1 addition & 2 deletions plugin.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

# Enable site settings in admin UI.
# See descriptions in files in the `config` folder.
enabled_site_setting :lti_consumer_enabled
enabled_site_setting :lti_consumer_key
enabled_site_setting :lti_consumer_secret
enabled_site_setting :lti_consumer_authenticate_url
Expand All @@ -25,9 +26,7 @@
require_relative 'lti_authenticator.rb'
auth_provider({
title: 'Click to login with EdX',
message: 'Click to login with EdX',
authenticator: LTIAuthenticator.new,
full_screen_login: true,
custom_url: '/lti/redirect_to_consumer'
})

Expand Down

0 comments on commit 189c29d

Please sign in to comment.