Description:
re-added registration config
Commit status:
[Not Reviewed]
References:
Comments:
0 Commit comments 0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
Add another comment

r774:0f0c4f139f2b - - 1 file changed: 8 inserted, 0 deleted

@@ -1,267 +1,275
1 1 CONFIGURATIONS =
2 2 [
3 3 {
4 4 :key => 'system.single_user_mode',
5 5 :value_type => 'boolean',
6 6 :default_value => 'false',
7 7 :description => 'Only admins can log in to the system when running under single user mode.'
8 8 },
9 9
10 10 {
11 11 :key => 'ui.front.title',
12 12 :value_type => 'string',
13 13 :default_value => 'Grader'
14 14 },
15 15
16 16 {
17 17 :key => 'ui.front.welcome_message',
18 18 :value_type => 'string',
19 19 :default_value => 'Welcome!'
20 20 },
21 21
22 22 {
23 23 :key => 'ui.show_score',
24 24 :value_type => 'boolean',
25 25 :default_value => 'true'
26 26 },
27 27
28 28 {
29 29 :key => 'contest.time_limit',
30 30 :value_type => 'string',
31 31 :default_value => 'unlimited',
32 32 :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.'
33 33 },
34 34
35 35 {
36 36 :key => 'system.mode',
37 37 :value_type => 'string',
38 38 :default_value => 'standard',
39 39 :description => 'Current modes are "standard", "contest", "indv-contest", and "analysis".'
40 40 },
41 41
42 42 {
43 43 :key => 'contest.name',
44 44 :value_type => 'string',
45 45 :default_value => 'Grader',
46 46 :description => 'This name will be shown on the user header bar.'
47 47 },
48 48
49 49 {
50 50 :key => 'contest.multisites',
51 51 :value_type => 'boolean',
52 52 :default_value => 'false',
53 53 :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.'
54 54 },
55 55
56 56 #---------------------------- right --------------------------------
57 57 {
58 58 :key => 'right.user_hall_of_fame',
59 59 :value_type => 'boolean',
60 60 :default_value => 'false',
61 61 :description => 'If true, any user can access hall of fame page.'
62 62 },
63 63
64 64 {
65 65 :key => 'right.multiple_ip_login',
66 66 :value_type => 'boolean',
67 67 :default_value => 'true',
68 68 :description => 'When change from true to false, a user can login from the first IP they logged into afterward.'
69 69 },
70 70
71 71 {
72 72 :key => 'right.user_view_submission',
73 73 :value_type => 'boolean',
74 74 :default_value => 'false',
75 75 :description => 'If true, any user can view submissions of every one.'
76 76 },
77 77
78 78 {
79 79 :key => 'right.bypass_agreement',
80 80 :value_type => 'boolean',
81 81 :default_value => 'true',
82 82 :description => 'When false, a user must accept usage agreement before login'
83 83 },
84 84
85 85 {
86 86 :key => 'right.heartbeat_response',
87 87 :value_type => 'string',
88 88 :default_value => 'OK',
89 89 :description => 'Heart beat response text'
90 90 },
91 91
92 92 {
93 93 :key => 'right.heartbeat_response_full',
94 94 :value_type => 'string',
95 95 :default_value => 'OK',
96 96 :description => 'Heart beat response text when user got full score (set this value to the empty string to disable this feature)'
97 97 },
98 98
99 99 {
100 100 :key => 'right.view_testcase',
101 101 :value_type => 'boolean',
102 102 :default_value => 'false',
103 103 :description => 'When true, any user can view/download test data'
104 104 },
105 +
106 + {
107 + :key => 'system.online_registration',
108 + :value_type => 'boolean',
109 + :default_value => 'false',
110 + :description => 'This option enables online registration.'
111 + },
112 +
105 113 # If Configuration['system.online_registration'] is true, the
106 114 # system allows online registration, and will use these
107 115 # information for sending confirmation emails.
108 116 {
109 117 :key => 'system.online_registration.smtp',
110 118 :value_type => 'string',
111 119 :default_value => 'smtp.somehost.com'
112 120 },
113 121
114 122 {
115 123 :key => 'system.online_registration.from',
116 124 :value_type => 'string',
117 125 :default_value => 'your.email@address'
118 126 },
119 127
120 128 {
121 129 :key => 'system.admin_email',
122 130 :value_type => 'string',
123 131 :default_value => 'admin@admin.email'
124 132 },
125 133
126 134 {
127 135 :key => 'system.user_setting_enabled',
128 136 :value_type => 'boolean',
129 137 :default_value => 'true',
130 138 :description => 'If this option is true, users can change their settings'
131 139 },
132 140
133 141 {
134 142 :key => 'system.user_setting_enabled',
135 143 :value_type => 'boolean',
136 144 :default_value => 'true',
137 145 :description => 'If this option is true, users can change their settings'
138 146 },
139 147
140 148 # If Configuration['contest.test_request.early_timeout'] is true
141 149 # the user will not be able to use test request at 30 minutes
142 150 # before the contest ends.
143 151 {
144 152 :key => 'contest.test_request.early_timeout',
145 153 :value_type => 'boolean',
146 154 :default_value => 'false'
147 155 },
148 156
149 157 {
150 158 :key => 'system.multicontests',
151 159 :value_type => 'boolean',
152 160 :default_value => 'false'
153 161 },
154 162
155 163 {
156 164 :key => 'contest.confirm_indv_contest_start',
157 165 :value_type => 'boolean',
158 166 :default_value => 'false'
159 167 },
160 168
161 169 {
162 170 :key => 'contest.default_contest_name',
163 171 :value_type => 'string',
164 172 :default_value => 'none',
165 173 :description => "New user will be assigned to this contest automatically, if it exists. Set to 'none' if there is no default contest."
166 174 },
167 175
168 176 {
169 177 :key => 'system.use_problem_group',
170 178 :value_type => 'boolean',
171 179 :default_value => 'false',
172 180 :description => "If true, available problem to the user will be only ones associated with the group of the user."
173 181 },
174 182
175 183
176 184
177 185 ]
178 186
179 187
180 188 def create_configuration_key(key,
181 189 value_type,
182 190 default_value,
183 191 description='')
184 192 conf = (GraderConfiguration.find_by_key(key) ||
185 193 GraderConfiguration.new(:key => key,
186 194 :value_type => value_type,
187 195 :value => default_value))
188 196 conf.description = description
189 197 conf.save
190 198 end
191 199
192 200 def seed_config
193 201 CONFIGURATIONS.each do |conf|
194 202 if conf.has_key? :description
195 203 desc = conf[:description]
196 204 else
197 205 desc = ''
198 206 end
199 207 create_configuration_key(conf[:key],
200 208 conf[:value_type],
201 209 conf[:default_value],
202 210 desc)
203 211 end
204 212 end
205 213
206 214 def seed_roles
207 215 return if Role.find_by_name('admin')
208 216
209 217 role = Role.create(:name => 'admin')
210 218 user_admin_right = Right.create(:name => 'user_admin',
211 219 :controller => 'user_admin',
212 220 :action => 'all')
213 221 problem_admin_right = Right.create(:name=> 'problem_admin',
214 222 :controller => 'problems',
215 223 :action => 'all')
216 224
217 225 graders_right = Right.create(:name => 'graders_admin',
218 226 :controller => 'graders',
219 227 :action => 'all')
220 228
221 229 role.rights << user_admin_right;
222 230 role.rights << problem_admin_right;
223 231 role.rights << graders_right;
224 232 role.save
225 233 end
226 234
227 235 def seed_root
228 236 return if User.find_by_login('root')
229 237
230 238 root = User.new(:login => 'root',
231 239 :full_name => 'Administrator',
232 240 :alias => 'root')
233 241 root.password = 'ioionrails';
234 242
235 243 class << root
236 244 public :encrypt_new_password
237 245 def valid?(context=nil)
238 246 true
239 247 end
240 248 end
241 249
242 250 root.encrypt_new_password
243 251
244 252 root.roles << Role.find_by_name('admin')
245 253
246 254 root.activated = true
247 255 root.save
248 256 end
249 257
250 258 def seed_users_and_roles
251 259 seed_roles
252 260 seed_root
253 261 end
254 262
255 263 def seed_more_languages
256 264 Language.delete_all
257 265 Language.create( name: 'c', pretty_name: 'C', ext: 'c', common_ext: 'c' )
258 266 Language.create( name: 'cpp', pretty_name: 'C++', ext: 'cpp', common_ext: 'cpp,cc' )
259 267 Language.create( name: 'pas', pretty_name: 'Pascal', ext: 'pas', common_ext: 'pas' )
260 268 Language.create( name: 'ruby', pretty_name: 'Ruby', ext: 'rb', common_ext: 'rb' )
261 269 Language.create( name: 'python', pretty_name: 'Python', ext: 'py', common_ext: 'py' )
262 270 Language.create( name: 'java', pretty_name: 'Java', ext: 'java', common_ext: 'java' )
263 271 end
264 272
265 273 seed_config
266 274 seed_users_and_roles
267 275 seed_more_languages
You need to be logged in to leave comments. Login now