Show More
Commit Description:
fixed new users import bug when passwords contain extra spaces at the end
Commit Description:
fixed new users import bug when passwords contain extra spaces at the end
File last commit:
Show/Diff file:
Action:
db/seeds.rb | 190 lines | 4.9 KiB | text/x-ruby | RubyLexer |
Jittat Fakcharoenphol
moved data migration for config to seeds.rb, shows option description in system config page
r269 CONFIGURATIONS =
[
{
:key => 'system.single_user_mode',
:value_type => 'boolean',
Jittat Fakcharoenphol
fixed seed script
r272 :default_value => 'false',
Jittat Fakcharoenphol
moved data migration for config to seeds.rb, shows option description in system config page
r269 :description => 'Only admins can log in to the system when running under single user mode.'
},
Jittat Fakcharoenphol
moved root/roles creation from migration to seed.rb
r276
Jittat Fakcharoenphol
moved data migration for config to seeds.rb, shows option description in system config page
r269 {
:key => 'ui.front.title',
:value_type => 'string',
Jittat Fakcharoenphol
fixed seed script
r272 :default_value => 'Grader'
Jittat Fakcharoenphol
moved data migration for config to seeds.rb, shows option description in system config page
r269 },
Jittat Fakcharoenphol
moved root/roles creation from migration to seed.rb
r276
Jittat Fakcharoenphol
moved data migration for config to seeds.rb, shows option description in system config page
r269 {
:key => 'ui.front.welcome_message',
:value_type => 'string',
Jittat Fakcharoenphol
fixed seed script
r272 :default_value => 'Welcome!'
Jittat Fakcharoenphol
moved data migration for config to seeds.rb, shows option description in system config page
r269 },
Jittat Fakcharoenphol
moved root/roles creation from migration to seed.rb
r276
Jittat Fakcharoenphol
moved data migration for config to seeds.rb, shows option description in system config page
r269 {
:key => 'ui.show_score',
:value_type => 'boolean',
Jittat Fakcharoenphol
fixed seed script
r272 :default_value => 'true'
Jittat Fakcharoenphol
moved data migration for config to seeds.rb, shows option description in system config page
r269 },
{
:key => 'contest.time_limit',
:value_type => 'string',
Jittat Fakcharoenphol
fixed seed script
r272 :default_value => 'unlimited',
Jittat Fakcharoenphol
logs out users after contests changed
r294 :description => 'Time limit in format hh:mm, or "unlimited" for contests with no time limits. This config is CACHED. Restart the server before the change can take effect.'
Jittat Fakcharoenphol
moved data migration for config to seeds.rb, shows option description in system config page
r269 },
Jittat Fakcharoenphol
moved root/roles creation from migration to seed.rb
r276
Jittat Fakcharoenphol
moved data migration for config to seeds.rb, shows option description in system config page
r269 {
:key => 'system.mode',
:value_type => 'string',
Jittat Fakcharoenphol
fixed seed script
r272 :default_value => 'standard',
Jittat Fakcharoenphol
moved data migration for config to seeds.rb, shows option description in system config page
r269 :description => 'Current modes are "standard", "contest", "indv-contest", and "analysis".'
},
Jittat Fakcharoenphol
moved root/roles creation from migration to seed.rb
r276
Jittat Fakcharoenphol
moved data migration for config to seeds.rb, shows option description in system config page
r269 {
:key => 'contest.name',
:value_type => 'string',
Jittat Fakcharoenphol
fixed seed script
r272 :default_value => 'Grader',
Jittat Fakcharoenphol
moved data migration for config to seeds.rb, shows option description in system config page
r269 :description => 'This name will be shown on the user header bar.'
},
Jittat Fakcharoenphol
moved root/roles creation from migration to seed.rb
r276
Jittat Fakcharoenphol
moved data migration for config to seeds.rb, shows option description in system config page
r269 {
:key => 'contest.multisites',
:value_type => 'boolean',
Jittat Fakcharoenphol
fixed seed script
r272 :default_value => 'false',
Jittat Fakcharoenphol
moved data migration for config to seeds.rb, shows option description in system config page
r269 :description => 'If the server is in contest mode and this option is true, on the log in of the admin a menu for site selections is shown.'
},
Jittat Fakcharoenphol
moved root/roles creation from migration to seed.rb
r276
Jittat Fakcharoenphol
moved data migration for config to seeds.rb, shows option description in system config page
r269 {
:key => 'system.online_registration',
:value_type => 'boolean',
Jittat Fakcharoenphol
fixed seed script
r272 :default_value => 'false',
Jittat Fakcharoenphol
moved data migration for config to seeds.rb, shows option description in system config page
r269 :description => 'This option enables online registration.'
},
Jittat Fakcharoenphol
moved root/roles creation from migration to seed.rb
r276
Jittat Fakcharoenphol
moved data migration for config to seeds.rb, shows option description in system config page
r269 # If Configuration['system.online_registration'] is true, the
# system allows online registration, and will use these
# information for sending confirmation emails.
{
:key => 'system.online_registration.smtp',
:value_type => 'string',
Jittat Fakcharoenphol
fixed seed script
r272 :default_value => 'smtp.somehost.com'
Jittat Fakcharoenphol
moved data migration for config to seeds.rb, shows option description in system config page
r269 },
Jittat Fakcharoenphol
moved root/roles creation from migration to seed.rb
r276
Jittat Fakcharoenphol
moved data migration for config to seeds.rb, shows option description in system config page
r269 {
:key => 'system.online_registration.from',
:value_type => 'string',
Jittat Fakcharoenphol
fixed seed script
r272 :default_value => 'your.email@address'
Jittat Fakcharoenphol
moved data migration for config to seeds.rb, shows option description in system config page
r269 },
Jittat Fakcharoenphol
moved root/roles creation from migration to seed.rb
r276
Jittat Fakcharoenphol
moved data migration for config to seeds.rb, shows option description in system config page
r269 {
:key => 'system.admin_email',
:value_type => 'string',
Jittat Fakcharoenphol
fixed seed script
r272 :default_value => 'admin@admin.email'
Jittat Fakcharoenphol
moved data migration for config to seeds.rb, shows option description in system config page
r269 },
{
:key => 'system.user_setting_enabled',
:value_type => 'boolean',
Jittat Fakcharoenphol
fixed seed script
r272 :default_value => 'true',
Jittat Fakcharoenphol
moved data migration for config to seeds.rb, shows option description in system config page
r269 :description => 'If this option is true, users can change their settings'
},
# If Configuration['contest.test_request.early_timeout'] is true
# the user will not be able to use test request at 30 minutes
# before the contest ends.
{
:key => 'contest.test_request.early_timeout',
:value_type => 'boolean',
Jittat Fakcharoenphol
fixed seed script
r272 :default_value => 'false'
Jittat Fakcharoenphol
manages problems in contests
r279 },
{
:key => 'system.multicontests',
:value_type => 'boolean',
:default_value => 'false'
Jittat Fakcharoenphol
shows contest start confirmation for indv contest
r302 },
{
:key => 'contest.confirm_indv_contest_start',
:value_type => 'boolean',
:default_value => 'false'
Jittat Fakcharoenphol
moved data migration for config to seeds.rb, shows option description in system config page
r269 }
]
Jittat Fakcharoenphol
moved root/roles creation from migration to seed.rb
r276
def create_configuration_key(key,
value_type,
default_value,
description='')
conf = (Configuration.find_by_key(key) ||
Configuration.new(:key => key,
:value_type => value_type,
:value => default_value))
conf.description = description
conf.save
end
def seed_config
CONFIGURATIONS.each do |conf|
if conf.has_key? :description
desc = conf[:description]
else
desc = ''
end
create_configuration_key(conf[:key],
conf[:value_type],
conf[:default_value],
desc)
Jittat Fakcharoenphol
moved data migration for config to seeds.rb, shows option description in system config page
r269 end
Jittat Fakcharoenphol
moved root/roles creation from migration to seed.rb
r276 end
def seed_roles
return if Role.find_by_name('admin')
role = Role.create(:name => 'admin')
user_admin_right = Right.create(:name => 'user_admin',
:controller => 'user_admin',
:action => 'all')
problem_admin_right = Right.create(:name=> 'problem_admin',
:controller => 'problems',
:action => 'all')
graders_right = Right.create(:name => 'graders_admin',
:controller => 'graders',
:action => 'all')
role.rights << user_admin_right;
role.rights << problem_admin_right;
role.rights << graders_right;
role.save
Jittat Fakcharoenphol
moved data migration for config to seeds.rb, shows option description in system config page
r269 end
Jittat Fakcharoenphol
moved root/roles creation from migration to seed.rb
r276
def seed_root
return if User.find_by_login('root')
root = User.new(:login => 'root',
:full_name => 'Administrator',
:alias => 'root')
root.password = 'ioionrails';
class << root
public :encrypt_new_password
def valid?
true
end
end
root.encrypt_new_password
root.roles << Role.find_by_name('admin')
root.activated = true
root.save
end
def seed_users_and_roles
seed_roles
seed_root
end
seed_config
seed_users_and_roles