grandfather in accounts with old not-secure-by-default settings

refs #5833

Change-Id: Ic283bc7665e76ff0a19635faef3d5751f2d06e6b
Reviewed-on: https://gerrit.instructure.com/6581
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Jacob Fugal <jacob@instructure.com>
This commit is contained in:
Cody Cutrer 2011-10-31 09:05:14 -06:00
parent 736ddf007b
commit c4c79f5d23
2 changed files with 18 additions and 1 deletions

View File

@ -77,7 +77,7 @@ $(document).ready(function() {
</div>
<% else %>
<% form_for :pseudonym_session, :url => login_path, :html => {:id => "login_form"} do |f| %>
<%= link_to "Click to register", Setting.get_cached("registration_link", "/register_from_website"), :id => 'register_link', :class => 'not_external' if @domain_root_account && @domain_root_account.open_registration? && @domain_root_account.no_enrollments_can_create_courses? %>
<%= link_to "Click to register", Setting.get_cached("registration_link", "/register_from_website"), :id => 'register_link', :class => 'not_external' if @domain_root_account == Account.default && @domain_root_account.open_registration? && @domain_root_account.no_enrollments_can_create_courses? %>
<h2 class="ui-helper-hidden-accessible"><%= t('login', 'Login') %></h2>
<% login_inner_dialog = yield :login_inner_dialog %>
<%= login_inner_dialog if login_inner_dialog && !login_inner_dialog.strip.empty? %>

View File

@ -0,0 +1,17 @@
class GrandfatherOpenRegistration < ActiveRecord::Migration
def self.up
Account.root_accounts.find_each do |account|
# Grandfather all old accounts to open_registration
account.settings = { :open_registration => true }
# These settings were previously exposed, but defaulted to true. They now default to false.
# So grandfather in the previous setting, accounting for the old default
[:teachers_can_create_courses, :students_can_create_courses, :no_enrollments_can_create_courses].each do |setting|
account.settings = { setting => true } if account.settings[setting] != false
end
account.save!
end
end
def self.down
end
end