Description:
merge with algo-bm
Commit status:
[Not Reviewed]
References:
Diff options:
Comments:
0 Commit comments
0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
r787:6a311ff47066 - - 13 files changed: 81 inserted, 75 deleted
@@ -7,7 +7,7 | |||||
|
7 |
|
7 | ||
|
8 | SINGLE_USER_MODE_CONF_KEY = 'system.single_user_mode' |
|
8 | SINGLE_USER_MODE_CONF_KEY = 'system.single_user_mode' |
|
9 | MULTIPLE_IP_LOGIN_CONF_KEY = 'right.multiple_ip_login' |
|
9 | MULTIPLE_IP_LOGIN_CONF_KEY = 'right.multiple_ip_login' |
|
10 |
- |
|
10 | + WHITELIST_IGNORE_CONF_KEY = 'right.whitelist_ignore' |
|
11 | WHITELIST_IP_CONF_KEY = 'right.whitelist_ip' |
|
11 | WHITELIST_IP_CONF_KEY = 'right.whitelist_ip' |
|
12 |
|
12 | ||
|
13 | #report and redirect for unauthorized activities |
|
13 | #report and redirect for unauthorized activities |
@@ -81,9 +81,9 | |||||
|
81 | end |
|
81 | end |
|
82 |
|
82 | ||
|
83 | # check if user ip is allowed |
|
83 | # check if user ip is allowed |
|
84 |
- unless @current_user.admin? || |
|
84 | + unless @current_user.admin? || GraderConfiguration[WHITELIST_IGNORE_CONF_KEY] |
|
85 | unless is_request_ip_allowed? |
|
85 | unless is_request_ip_allowed? |
|
86 | - unauthorized_redirect 'Your IP is not allowed' |
|
86 | + unauthorized_redirect 'Your IP is not allowed to login at this time.' |
|
87 | return false |
|
87 | return false |
|
88 | end |
|
88 | end |
|
89 | end |
|
89 | end |
@@ -108,10 +108,8 | |||||
|
108 | #this assume that we have already authenticate normally |
|
108 | #this assume that we have already authenticate normally |
|
109 | unless GraderConfiguration[MULTIPLE_IP_LOGIN_CONF_KEY] |
|
109 | unless GraderConfiguration[MULTIPLE_IP_LOGIN_CONF_KEY] |
|
110 | user = User.find(session[:user_id]) |
|
110 | user = User.find(session[:user_id]) |
|
111 | - puts "User admin #{user.admin?}" |
|
||
|
112 | if (!user.admin? && user.last_ip && user.last_ip != request.remote_ip) |
|
111 | if (!user.admin? && user.last_ip && user.last_ip != request.remote_ip) |
|
113 | flash[:notice] = "You cannot use the system from #{request.remote_ip}. Your last ip is #{user.last_ip}" |
|
112 | flash[:notice] = "You cannot use the system from #{request.remote_ip}. Your last ip is #{user.last_ip}" |
|
114 | - puts "hahaha" |
|
||
|
115 | redirect_to :controller => 'main', :action => 'login' |
|
113 | redirect_to :controller => 'main', :action => 'login' |
|
116 | return false |
|
114 | return false |
|
117 | end |
|
115 | end |
@@ -152,14 +150,16 | |||||
|
152 | end |
|
150 | end |
|
153 |
|
151 | ||
|
154 | def is_request_ip_allowed? |
|
152 | def is_request_ip_allowed? |
|
155 |
- |
|
153 | + unless GraderConfiguration[WHITELIST_IGNORE_CONF_KEY] |
|
156 | user_ip = IPAddr.new(request.remote_ip) |
|
154 | user_ip = IPAddr.new(request.remote_ip) |
|
157 | - GraderConfiguration[WHITELIST_IP_LIST_CONF_KEY].delete(' ').split(',').each do |ips| |
|
155 | + |
|
|
156 | + GraderConfiguration[WHITELIST_IP_CONF_KEY].delete(' ').split(',').each do |ips| | ||
|
158 | allow_ips = IPAddr.new(ips) |
|
157 | allow_ips = IPAddr.new(ips) |
|
159 |
- |
|
158 | + if allow_ips.include?(user_ip) |
|
160 |
- return |
|
159 | + return true |
|
161 | end |
|
160 | end |
|
162 | end |
|
161 | end |
|
|
162 | + return false | ||
|
163 | end |
|
163 | end |
|
164 | return true |
|
164 | return true |
|
165 | end |
|
165 | end |
@@ -21,6 +21,7 | |||||
|
21 | saved_notice = flash[:notice] |
|
21 | saved_notice = flash[:notice] |
|
22 | reset_session |
|
22 | reset_session |
|
23 | flash.now[:notice] = saved_notice |
|
23 | flash.now[:notice] = saved_notice |
|
|
24 | + @remote_ip = request.remote_ip | ||
|
24 |
|
25 | ||
|
25 | # EXPERIMENT: |
|
26 | # EXPERIMENT: |
|
26 | # Hide login if in single user mode and the url does not |
|
27 | # Hide login if in single user mode and the url does not |
@@ -465,6 +465,7 | |||||
|
465 | protected |
|
465 | protected |
|
466 |
|
466 | ||
|
467 | def calculate_max_score(problems, users,since_id,until_id, get_last_score = false) |
|
467 | def calculate_max_score(problems, users,since_id,until_id, get_last_score = false) |
|
|
468 | + #scorearray[i] = user #i's user stat where i is the index (not id) | ||
|
468 | scorearray = Array.new |
|
469 | scorearray = Array.new |
|
469 | users.each do |u| |
|
470 | users.each do |u| |
|
470 | ustat = Array.new |
|
471 | ustat = Array.new |
@@ -75,9 +75,6 | |||||
|
75 | def get_latest_submission_status |
|
75 | def get_latest_submission_status |
|
76 | @problem = Problem.find(params[:pid]) |
|
76 | @problem = Problem.find(params[:pid]) |
|
77 | @submission = Submission.find_last_by_user_and_problem(params[:uid],params[:pid]) |
|
77 | @submission = Submission.find_last_by_user_and_problem(params[:uid],params[:pid]) |
|
78 | - puts User.find(params[:uid]).login |
|
||
|
79 | - puts Problem.find(params[:pid]).name |
|
||
|
80 | - puts 'nil' unless @submission |
|
||
|
81 | respond_to do |format| |
|
78 | respond_to do |format| |
|
82 | format.js |
|
79 | format.js |
|
83 | end |
|
80 | end |
@@ -61,6 +61,7 | |||||
|
61 |
|
61 | ||
|
62 | note = [] |
|
62 | note = [] |
|
63 | error_note = [] |
|
63 | error_note = [] |
|
|
64 | + error_msg = nil | ||
|
64 | ok_user = [] |
|
65 | ok_user = [] |
|
65 |
|
66 | ||
|
66 | lines.split("\n").each do |line| |
|
67 | lines.split("\n").each do |line| |
@@ -76,7 +77,7 | |||||
|
76 | password = items[2].chomp(" ") |
|
77 | password = items[2].chomp(" ") |
|
77 | else |
|
78 | else |
|
78 | password = random_password |
|
79 | password = random_password |
|
79 | - add_random_password=true; |
|
80 | + added_random_password=true; |
|
80 | end |
|
81 | end |
|
81 |
|
82 | ||
|
82 | if items.length>= 4 and items[3].chomp(" ").length > 0; |
|
83 | if items.length>= 4 and items[3].chomp(" ").length > 0; |
@@ -96,11 +97,11 | |||||
|
96 | user.remark = remark |
|
97 | user.remark = remark |
|
97 | else |
|
98 | else |
|
98 | user = User.new({:login => login, |
|
99 | user = User.new({:login => login, |
|
99 |
- |
|
100 | + :full_name => full_name, |
|
100 |
- |
|
101 | + :password => password, |
|
101 |
- |
|
102 | + :password_confirmation => password, |
|
102 |
- |
|
103 | + :alias => user_alias, |
|
103 |
- |
|
104 | + :remark => remark}) |
|
104 | end |
|
105 | end |
|
105 | user.activated = true |
|
106 | user.activated = true |
|
106 |
|
107 | ||
@@ -112,7 +113,8 | |||||
|
112 | end |
|
113 | end |
|
113 | ok_user << user |
|
114 | ok_user << user |
|
114 | else |
|
115 | else |
|
115 | - error_note << "#{login}" |
|
116 | + error_note << "'#{login}'" |
|
|
117 | + error_msg = user.errors.full_messages.to_sentence unless error_msg | ||
|
116 | end |
|
118 | end |
|
117 |
|
119 | ||
|
118 | end |
|
120 | end |
@@ -127,11 +129,13 | |||||
|
127 | end |
|
129 | end |
|
128 |
|
130 | ||
|
129 | # show flash |
|
131 | # show flash |
|
130 | - flash[:success] = 'User(s) ' + note.join(', ') + |
|
132 | + if note.size > 0 |
|
131 | - ' were successfully created. ' + |
|
133 | + flash[:success] = 'User(s) ' + note.join(', ') + |
|
132 | - '( (+) - created with random passwords.)' |
|
134 | + ' were successfully created. ' + |
|
|
135 | + '( (+) - created with random passwords.)' | ||
|
|
136 | + end | ||
|
133 | if error_note.size > 0 |
|
137 | if error_note.size > 0 |
|
134 | - flash[:error] = "Following user(s) failed to be created: " + error_note.join(', ') |
|
138 | + flash[:error] = "Following user(s) failed to be created: " + error_note.join(', ') + ". The error of the first failed one are: " + error_msg; |
|
135 | end |
|
139 | end |
|
136 | redirect_to :action => 'index' |
|
140 | redirect_to :action => 'index' |
|
137 | end |
|
141 | end |
@@ -21,11 +21,13 | |||||
|
21 | %li |
|
21 | %li |
|
22 | If you want to add several users to a group, it may be easier to just re-import those users in |
|
22 | If you want to add several users to a group, it may be easier to just re-import those users in |
|
23 | = link_to 'New list of users', new_list_user_admin_index_path |
|
23 | = link_to 'New list of users', new_list_user_admin_index_path |
|
24 | - page |
|
24 | + page. You can also use |
|
|
25 | + = link_to 'Bulk Manage User', bulk_manage_user_admin_index_path | ||
|
|
26 | + page. | ||
|
25 | =form_tag add_user_group_path(@group), class: 'form-inline' do |
|
27 | =form_tag add_user_group_path(@group), class: 'form-inline' do |
|
26 | .form-group |
|
28 | .form-group |
|
27 | =label_tag :user_id, "User" |
|
29 | =label_tag :user_id, "User" |
|
28 | - =select_tag :user_id, options_from_collection_for_select(User.all,'id','full_name'), class: 'select2' |
|
30 | + =select_tag :user_id, options_from_collection_for_select(User.all,'id','full_name'), class: 'select2', style: 'width: 10em'; |
|
29 | =submit_tag "Add",class: 'btn btn-primary' |
|
31 | =submit_tag "Add",class: 'btn btn-primary' |
|
30 |
|
32 | ||
|
31 |
|
33 | ||
@@ -52,12 +54,12 | |||||
|
52 | %ul |
|
54 | %ul |
|
53 | %li |
|
55 | %li |
|
54 | If you want to add several problem to a group, it may be easier to bulk manage them in the |
|
56 | If you want to add several problem to a group, it may be easier to bulk manage them in the |
|
55 | - = link_to 'Bulk Manage', manage_problems_path |
|
57 | + = link_to 'Bulk Manage Problems', manage_problems_path |
|
56 | page |
|
58 | page |
|
57 | =form_tag add_problem_group_path(@group), class: 'form-inline' do |
|
59 | =form_tag add_problem_group_path(@group), class: 'form-inline' do |
|
58 | .form-group |
|
60 | .form-group |
|
59 | =label_tag :problem_id, "Problem" |
|
61 | =label_tag :problem_id, "Problem" |
|
60 | - =select_tag :problem_id, options_from_collection_for_select(Problem.all,'id','full_name'), class: 'select2' |
|
62 | + =select_tag :problem_id, options_from_collection_for_select(Problem.all,'id','full_name'), class: 'select2', style: 'width: 10em'; |
|
61 | =submit_tag "Add",class: 'btn btn-primary' |
|
63 | =submit_tag "Add",class: 'btn btn-primary' |
|
62 |
|
64 | ||
|
63 |
|
65 |
@@ -9,3 +9,4 | |||||
|
9 | = render :partial => 'announcement', :collection => @announcements |
|
9 | = render :partial => 'announcement', :collection => @announcements |
|
10 | .col-md-4{style: "padding-left: 20px;"} |
|
10 | .col-md-4{style: "padding-left: 20px;"} |
|
11 | = render :partial => 'login_box' |
|
11 | = render :partial => 'login_box' |
|
|
12 | + = "current ip is #{@remote_ip}" |
@@ -12,9 +12,9 | |||||
|
12 | %th.text-right Total |
|
12 | %th.text-right Total |
|
13 | %th.text-right Passed |
|
13 | %th.text-right Passed |
|
14 | %tbody |
|
14 | %tbody |
|
15 |
- - sum = Array.new(@ |
|
15 | + - sum = Array.new(@problems.count+1,0) |
|
16 |
- - nonzero = Array.new(@ |
|
16 | + - nonzero = Array.new(@problems.count+1,0) |
|
17 |
- - full = Array.new(@ |
|
17 | + - full = Array.new(@problems.count+1,0) |
|
18 | - @scorearray.each do |sc| |
|
18 | - @scorearray.each do |sc| |
|
19 | %tr |
|
19 | %tr |
|
20 | - total,num_passed = 0,0 |
|
20 | - total,num_passed = 0,0 |
@@ -2,7 +2,7 | |||||
|
2 | %h1 Current Score |
|
2 | %h1 Current Score |
|
3 | = form_tag current_score_report_path, method: 'get' do |
|
3 | = form_tag current_score_report_path, method: 'get' do |
|
4 | Show only users from this group |
|
4 | Show only users from this group |
|
5 |
- = select_tag "group_id", options_from_collection_for_select( Group.all, 'id','name',params[:group_ |
|
5 | + = select_tag "group_id", options_from_collection_for_select( Group.all, 'id','name',params[:group_id]), id: 'group_name',class: 'select2', style: 'width: 20em'; |
|
6 | = submit_tag 'Apply',class: 'btn btn-default' |
|
6 | = submit_tag 'Apply',class: 'btn btn-default' |
|
7 |
|
7 | ||
|
8 | %br |
|
8 | %br |
@@ -147,7 +147,6 | |||||
|
147 | get 'current_score(/:group_id)', action: 'current_score', as: 'current_score' |
|
147 | get 'current_score(/:group_id)', action: 'current_score', as: 'current_score' |
|
148 | get 'max_score' |
|
148 | get 'max_score' |
|
149 | post 'show_max_score' |
|
149 | post 'show_max_score' |
|
150 | - get 'problem_hof(/:id)', action: 'problem_hof', as: 'problem_hof' |
|
||
|
151 | get 'stuck' |
|
150 | get 'stuck' |
|
152 | get 'cheat_report' |
|
151 | get 'cheat_report' |
|
153 | post 'cheat_report' |
|
152 | post 'cheat_report' |
@@ -12,7 +12,7 | |||||
|
12 |
|
12 | ||
|
13 | ActiveRecord::Schema.define(version: 2018_06_12_102327) do |
|
13 | ActiveRecord::Schema.define(version: 2018_06_12_102327) do |
|
14 |
|
14 | ||
|
15 |
- create_table "announcements", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET= |
|
15 | + create_table "announcements", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t| |
|
16 | t.string "author" |
|
16 | t.string "author" |
|
17 | t.text "body" |
|
17 | t.text "body" |
|
18 | t.boolean "published" |
|
18 | t.boolean "published" |
@@ -24,7 +24,7 | |||||
|
24 | t.string "notes" |
|
24 | t.string "notes" |
|
25 | end |
|
25 | end |
|
26 |
|
26 | ||
|
27 |
- create_table "contests", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET= |
|
27 | + create_table "contests", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t| |
|
28 | t.string "title" |
|
28 | t.string "title" |
|
29 | t.boolean "enabled" |
|
29 | t.boolean "enabled" |
|
30 | t.datetime "created_at" |
|
30 | t.datetime "created_at" |
@@ -32,30 +32,30 | |||||
|
32 | t.string "name" |
|
32 | t.string "name" |
|
33 | end |
|
33 | end |
|
34 |
|
34 | ||
|
35 |
- create_table "contests_problems", id: false, options: "ENGINE=InnoDB DEFAULT CHARSET= |
|
35 | + create_table "contests_problems", id: false, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t| |
|
36 | t.integer "contest_id" |
|
36 | t.integer "contest_id" |
|
37 | t.integer "problem_id" |
|
37 | t.integer "problem_id" |
|
38 | end |
|
38 | end |
|
39 |
|
39 | ||
|
40 |
- create_table "contests_users", id: false, options: "ENGINE=InnoDB DEFAULT CHARSET= |
|
40 | + create_table "contests_users", id: false, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t| |
|
41 | t.integer "contest_id" |
|
41 | t.integer "contest_id" |
|
42 | t.integer "user_id" |
|
42 | t.integer "user_id" |
|
43 | end |
|
43 | end |
|
44 |
|
44 | ||
|
45 |
- create_table "countries", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET= |
|
45 | + create_table "countries", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t| |
|
46 | t.string "name" |
|
46 | t.string "name" |
|
47 | t.datetime "created_at" |
|
47 | t.datetime "created_at" |
|
48 | t.datetime "updated_at" |
|
48 | t.datetime "updated_at" |
|
49 | end |
|
49 | end |
|
50 |
|
50 | ||
|
51 |
- create_table "descriptions", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET= |
|
51 | + create_table "descriptions", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t| |
|
52 | t.text "body" |
|
52 | t.text "body" |
|
53 | t.boolean "markdowned" |
|
53 | t.boolean "markdowned" |
|
54 | t.datetime "created_at" |
|
54 | t.datetime "created_at" |
|
55 | t.datetime "updated_at" |
|
55 | t.datetime "updated_at" |
|
56 | end |
|
56 | end |
|
57 |
|
57 | ||
|
58 |
- create_table "grader_configurations", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET= |
|
58 | + create_table "grader_configurations", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t| |
|
59 | t.string "key" |
|
59 | t.string "key" |
|
60 | t.string "value_type" |
|
60 | t.string "value_type" |
|
61 | t.string "value" |
|
61 | t.string "value" |
@@ -64,7 +64,7 | |||||
|
64 | t.text "description" |
|
64 | t.text "description" |
|
65 | end |
|
65 | end |
|
66 |
|
66 | ||
|
67 |
- create_table "grader_processes", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET= |
|
67 | + create_table "grader_processes", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t| |
|
68 | t.string "host" |
|
68 | t.string "host" |
|
69 | t.integer "pid" |
|
69 | t.integer "pid" |
|
70 | t.string "mode" |
|
70 | t.string "mode" |
@@ -74,21 +74,21 | |||||
|
74 | t.integer "task_id" |
|
74 | t.integer "task_id" |
|
75 | t.string "task_type" |
|
75 | t.string "task_type" |
|
76 | t.boolean "terminated" |
|
76 | t.boolean "terminated" |
|
77 |
- t.index ["host", "pid"], name: "index_grader_processes_on_ |
|
77 | + t.index ["host", "pid"], name: "index_grader_processes_on_host_and_pid" |
|
78 | end |
|
78 | end |
|
79 |
|
79 | ||
|
80 |
- create_table "groups", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET= |
|
80 | + create_table "groups", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t| |
|
81 | t.string "name" |
|
81 | t.string "name" |
|
82 | t.string "description" |
|
82 | t.string "description" |
|
83 | end |
|
83 | end |
|
84 |
|
84 | ||
|
85 |
- create_table "groups_problems", id: false, options: "ENGINE=InnoDB DEFAULT CHARSET= |
|
85 | + create_table "groups_problems", id: false, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t| |
|
86 | t.integer "problem_id", null: false |
|
86 | t.integer "problem_id", null: false |
|
87 | t.integer "group_id", null: false |
|
87 | t.integer "group_id", null: false |
|
88 | t.index ["group_id", "problem_id"], name: "index_groups_problems_on_group_id_and_problem_id" |
|
88 | t.index ["group_id", "problem_id"], name: "index_groups_problems_on_group_id_and_problem_id" |
|
89 | end |
|
89 | end |
|
90 |
|
90 | ||
|
91 |
- create_table "groups_users", id: false, options: "ENGINE=InnoDB DEFAULT CHARSET= |
|
91 | + create_table "groups_users", id: false, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t| |
|
92 | t.integer "group_id", null: false |
|
92 | t.integer "group_id", null: false |
|
93 | t.integer "user_id", null: false |
|
93 | t.integer "user_id", null: false |
|
94 | t.index ["user_id", "group_id"], name: "index_groups_users_on_user_id_and_group_id" |
|
94 | t.index ["user_id", "group_id"], name: "index_groups_users_on_user_id_and_group_id" |
@@ -97,13 +97,13 | |||||
|
97 | create_table "heart_beats", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t| |
|
97 | create_table "heart_beats", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t| |
|
98 | t.integer "user_id" |
|
98 | t.integer "user_id" |
|
99 | t.string "ip_address" |
|
99 | t.string "ip_address" |
|
100 |
- t.datetime "created_at" |
|
100 | + t.datetime "created_at" |
|
101 |
- t.datetime "updated_at" |
|
101 | + t.datetime "updated_at" |
|
102 | t.string "status" |
|
102 | t.string "status" |
|
103 | t.index ["updated_at"], name: "index_heart_beats_on_updated_at" |
|
103 | t.index ["updated_at"], name: "index_heart_beats_on_updated_at" |
|
104 | end |
|
104 | end |
|
105 |
|
105 | ||
|
106 |
- create_table "languages", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET= |
|
106 | + create_table "languages", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t| |
|
107 | t.string "name", limit: 10 |
|
107 | t.string "name", limit: 10 |
|
108 | t.string "pretty_name" |
|
108 | t.string "pretty_name" |
|
109 | t.string "ext", limit: 10 |
|
109 | t.string "ext", limit: 10 |
@@ -113,11 +113,11 | |||||
|
113 | create_table "logins", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t| |
|
113 | create_table "logins", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t| |
|
114 | t.integer "user_id" |
|
114 | t.integer "user_id" |
|
115 | t.string "ip_address" |
|
115 | t.string "ip_address" |
|
116 |
- t.datetime "created_at" |
|
116 | + t.datetime "created_at" |
|
117 |
- t.datetime "updated_at" |
|
117 | + t.datetime "updated_at" |
|
118 | end |
|
118 | end |
|
119 |
|
119 | ||
|
120 |
- create_table "messages", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET= |
|
120 | + create_table "messages", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t| |
|
121 | t.integer "sender_id" |
|
121 | t.integer "sender_id" |
|
122 | t.integer "receiver_id" |
|
122 | t.integer "receiver_id" |
|
123 | t.integer "replying_message_id" |
|
123 | t.integer "replying_message_id" |
@@ -127,7 +127,7 | |||||
|
127 | t.datetime "updated_at" |
|
127 | t.datetime "updated_at" |
|
128 | end |
|
128 | end |
|
129 |
|
129 | ||
|
130 |
- create_table "problems", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET= |
|
130 | + create_table "problems", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t| |
|
131 | t.string "name", limit: 30 |
|
131 | t.string "name", limit: 30 |
|
132 | t.string "full_name" |
|
132 | t.string "full_name" |
|
133 | t.integer "full_score" |
|
133 | t.integer "full_score" |
@@ -141,7 +141,7 | |||||
|
141 | t.boolean "view_testcase" |
|
141 | t.boolean "view_testcase" |
|
142 | end |
|
142 | end |
|
143 |
|
143 | ||
|
144 |
- create_table "problems_tags", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET= |
|
144 | + create_table "problems_tags", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t| |
|
145 | t.integer "problem_id" |
|
145 | t.integer "problem_id" |
|
146 | t.integer "tag_id" |
|
146 | t.integer "tag_id" |
|
147 | t.index ["problem_id", "tag_id"], name: "index_problems_tags_on_problem_id_and_tag_id", unique: true |
|
147 | t.index ["problem_id", "tag_id"], name: "index_problems_tags_on_problem_id_and_tag_id", unique: true |
@@ -149,29 +149,29 | |||||
|
149 | t.index ["tag_id"], name: "index_problems_tags_on_tag_id" |
|
149 | t.index ["tag_id"], name: "index_problems_tags_on_tag_id" |
|
150 | end |
|
150 | end |
|
151 |
|
151 | ||
|
152 |
- create_table "rights", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET= |
|
152 | + create_table "rights", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t| |
|
153 | t.string "name" |
|
153 | t.string "name" |
|
154 | t.string "controller" |
|
154 | t.string "controller" |
|
155 | t.string "action" |
|
155 | t.string "action" |
|
156 | end |
|
156 | end |
|
157 |
|
157 | ||
|
158 |
- create_table "rights_roles", id: false, options: "ENGINE=InnoDB DEFAULT CHARSET= |
|
158 | + create_table "rights_roles", id: false, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t| |
|
159 | t.integer "right_id" |
|
159 | t.integer "right_id" |
|
160 | t.integer "role_id" |
|
160 | t.integer "role_id" |
|
161 | t.index ["role_id"], name: "index_rights_roles_on_role_id" |
|
161 | t.index ["role_id"], name: "index_rights_roles_on_role_id" |
|
162 | end |
|
162 | end |
|
163 |
|
163 | ||
|
164 |
- create_table "roles", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET= |
|
164 | + create_table "roles", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t| |
|
165 | t.string "name" |
|
165 | t.string "name" |
|
166 | end |
|
166 | end |
|
167 |
|
167 | ||
|
168 |
- create_table "roles_users", id: false, options: "ENGINE=InnoDB DEFAULT CHARSET= |
|
168 | + create_table "roles_users", id: false, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t| |
|
169 | t.integer "role_id" |
|
169 | t.integer "role_id" |
|
170 | t.integer "user_id" |
|
170 | t.integer "user_id" |
|
171 | t.index ["user_id"], name: "index_roles_users_on_user_id" |
|
171 | t.index ["user_id"], name: "index_roles_users_on_user_id" |
|
172 | end |
|
172 | end |
|
173 |
|
173 | ||
|
174 |
- create_table "sessions", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET= |
|
174 | + create_table "sessions", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t| |
|
175 | t.string "session_id" |
|
175 | t.string "session_id" |
|
176 | t.text "data" |
|
176 | t.text "data" |
|
177 | t.datetime "updated_at" |
|
177 | t.datetime "updated_at" |
@@ -179,7 +179,7 | |||||
|
179 | t.index ["updated_at"], name: "index_sessions_on_updated_at" |
|
179 | t.index ["updated_at"], name: "index_sessions_on_updated_at" |
|
180 | end |
|
180 | end |
|
181 |
|
181 | ||
|
182 |
- create_table "sites", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET= |
|
182 | + create_table "sites", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t| |
|
183 | t.string "name" |
|
183 | t.string "name" |
|
184 | t.boolean "started" |
|
184 | t.boolean "started" |
|
185 | t.datetime "start_time" |
|
185 | t.datetime "start_time" |
@@ -192,11 +192,11 | |||||
|
192 | create_table "submission_view_logs", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t| |
|
192 | create_table "submission_view_logs", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t| |
|
193 | t.integer "user_id" |
|
193 | t.integer "user_id" |
|
194 | t.integer "submission_id" |
|
194 | t.integer "submission_id" |
|
195 |
- t.datetime "created_at" |
|
195 | + t.datetime "created_at" |
|
196 |
- t.datetime "updated_at" |
|
196 | + t.datetime "updated_at" |
|
197 | end |
|
197 | end |
|
198 |
|
198 | ||
|
199 |
- create_table "submissions", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET= |
|
199 | + create_table "submissions", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t| |
|
200 | t.integer "user_id" |
|
200 | t.integer "user_id" |
|
201 | t.integer "problem_id" |
|
201 | t.integer "problem_id" |
|
202 | t.integer "language_id" |
|
202 | t.integer "language_id" |
@@ -218,7 +218,7 | |||||
|
218 | t.index ["user_id", "problem_id"], name: "index_submissions_on_user_id_and_problem_id" |
|
218 | t.index ["user_id", "problem_id"], name: "index_submissions_on_user_id_and_problem_id" |
|
219 | end |
|
219 | end |
|
220 |
|
220 | ||
|
221 |
- create_table "tags", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET= |
|
221 | + create_table "tags", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t| |
|
222 | t.string "name", null: false |
|
222 | t.string "name", null: false |
|
223 | t.text "description" |
|
223 | t.text "description" |
|
224 | t.boolean "public" |
|
224 | t.boolean "public" |
@@ -226,7 +226,7 | |||||
|
226 | t.datetime "updated_at", null: false |
|
226 | t.datetime "updated_at", null: false |
|
227 | end |
|
227 | end |
|
228 |
|
228 | ||
|
229 |
- create_table "tasks", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET= |
|
229 | + create_table "tasks", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t| |
|
230 | t.integer "submission_id" |
|
230 | t.integer "submission_id" |
|
231 | t.datetime "created_at" |
|
231 | t.datetime "created_at" |
|
232 | t.integer "status" |
|
232 | t.integer "status" |
@@ -234,7 +234,7 | |||||
|
234 | t.index ["submission_id"], name: "index_tasks_on_submission_id" |
|
234 | t.index ["submission_id"], name: "index_tasks_on_submission_id" |
|
235 | end |
|
235 | end |
|
236 |
|
236 | ||
|
237 |
- create_table "test_pairs", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET= |
|
237 | + create_table "test_pairs", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t| |
|
238 | t.integer "problem_id" |
|
238 | t.integer "problem_id" |
|
239 | t.text "input", limit: 16777215 |
|
239 | t.text "input", limit: 16777215 |
|
240 | t.text "solution", limit: 16777215 |
|
240 | t.text "solution", limit: 16777215 |
@@ -242,7 +242,7 | |||||
|
242 | t.datetime "updated_at" |
|
242 | t.datetime "updated_at" |
|
243 | end |
|
243 | end |
|
244 |
|
244 | ||
|
245 |
- create_table "test_requests", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET= |
|
245 | + create_table "test_requests", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t| |
|
246 | t.integer "user_id" |
|
246 | t.integer "user_id" |
|
247 | t.integer "problem_id" |
|
247 | t.integer "problem_id" |
|
248 | t.integer "submission_id" |
|
248 | t.integer "submission_id" |
@@ -263,7 +263,7 | |||||
|
263 | t.index ["user_id", "problem_id"], name: "index_test_requests_on_user_id_and_problem_id" |
|
263 | t.index ["user_id", "problem_id"], name: "index_test_requests_on_user_id_and_problem_id" |
|
264 | end |
|
264 | end |
|
265 |
|
265 | ||
|
266 |
- create_table "testcases", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET= |
|
266 | + create_table "testcases", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t| |
|
267 | t.integer "problem_id" |
|
267 | t.integer "problem_id" |
|
268 | t.integer "num" |
|
268 | t.integer "num" |
|
269 | t.integer "group" |
|
269 | t.integer "group" |
@@ -275,14 +275,15 | |||||
|
275 | t.index ["problem_id"], name: "index_testcases_on_problem_id" |
|
275 | t.index ["problem_id"], name: "index_testcases_on_problem_id" |
|
276 | end |
|
276 | end |
|
277 |
|
277 | ||
|
278 |
- create_table "user_contest_stats", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET= |
|
278 | + create_table "user_contest_stats", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t| |
|
279 | t.integer "user_id" |
|
279 | t.integer "user_id" |
|
280 | t.datetime "started_at" |
|
280 | t.datetime "started_at" |
|
281 | t.datetime "created_at" |
|
281 | t.datetime "created_at" |
|
282 | t.datetime "updated_at" |
|
282 | t.datetime "updated_at" |
|
|
283 | + t.boolean "forced_logout" | ||
|
283 | end |
|
284 | end |
|
284 |
|
285 | ||
|
285 |
- create_table "users", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET= |
|
286 | + create_table "users", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t| |
|
286 | t.string "login", limit: 50 |
|
287 | t.string "login", limit: 50 |
|
287 | t.string "full_name" |
|
288 | t.string "full_name" |
|
288 | t.string "hashed_password" |
|
289 | t.string "hashed_password" |
@@ -100,7 +100,7 | |||||
|
100 | :key => 'right.view_testcase', |
|
100 | :key => 'right.view_testcase', |
|
101 | :value_type => 'boolean', |
|
101 | :value_type => 'boolean', |
|
102 | :default_value => 'false', |
|
102 | :default_value => 'false', |
|
103 |
- :description => ' |
|
103 | + :description => 'If true, any user can view/download test data' |
|
104 | }, |
|
104 | }, |
|
105 |
|
105 | ||
|
106 | { |
|
106 | { |
@@ -182,17 +182,17 | |||||
|
182 |
|
182 | ||
|
183 |
|
183 | ||
|
184 | { |
|
184 | { |
|
185 |
- :key => 'right.whitelist_i |
|
185 | + :key => 'right.whitelist_ignore', |
|
186 | :value_type => 'boolean', |
|
186 | :value_type => 'boolean', |
|
187 |
- :default_value => ' |
|
187 | + :default_value => 'true', |
|
188 | - :description => "If true, non-admin user will be able to use the system only when their ip is in the 'whitelist_ip'." |
|
188 | + :description => "If true, no IP check against whitelist_ip is perform. However, when false, non-admin user must have their ip in 'whitelist_ip' to be able to login." |
|
189 | }, |
|
189 | }, |
|
190 |
|
190 | ||
|
191 | { |
|
191 | { |
|
192 | :key => 'right.whitelist_ip', |
|
192 | :key => 'right.whitelist_ip', |
|
193 | :value_type => 'string', |
|
193 | :value_type => 'string', |
|
194 | :default_value => '0.0.0.0/0', |
|
194 | :default_value => '0.0.0.0/0', |
|
195 |
- :description => "list of whitelist ip, given in comma separated CIDR notation. For example '1 |
|
195 | + :description => "list of whitelist ip, given in comma separated CIDR notation. For example '192.168.90.0/23, 192.168.1.23/32'" |
|
196 | }, |
|
196 | }, |
|
197 |
|
197 | ||
|
198 | ] |
|
198 | ] |
@@ -274,7 +274,7 | |||||
|
274 | end |
|
274 | end |
|
275 |
|
275 | ||
|
276 | def seed_more_languages |
|
276 | def seed_more_languages |
|
277 | - Language.delete_all |
|
277 | + #Language.delete_all |
|
278 | Language.find_or_create_by( name: 'c', pretty_name: 'C', ext: 'c', common_ext: 'c' ) |
|
278 | Language.find_or_create_by( name: 'c', pretty_name: 'C', ext: 'c', common_ext: 'c' ) |
|
279 | Language.find_or_create_by( name: 'cpp', pretty_name: 'C++', ext: 'cpp', common_ext: 'cpp,cc' ) |
|
279 | Language.find_or_create_by( name: 'cpp', pretty_name: 'C++', ext: 'cpp', common_ext: 'cpp,cc' ) |
|
280 | Language.find_or_create_by( name: 'pas', pretty_name: 'Pascal', ext: 'pas', common_ext: 'pas' ) |
|
280 | Language.find_or_create_by( name: 'pas', pretty_name: 'Pascal', ext: 'pas', common_ext: 'pas' ) |
@@ -50,7 +50,7 | |||||
|
50 |
|
50 | ||
|
51 | click_on 'New list of users', match: :first |
|
51 | click_on 'New list of users', match: :first |
|
52 | find(:css, 'textarea').fill_in with:"abc1,Boaty McBoatface,abcdef,alias1,remark1,\nabc2,Boaty2 McSecond,acbdef123,aias2,remark2" |
|
52 | find(:css, 'textarea').fill_in with:"abc1,Boaty McBoatface,abcdef,alias1,remark1,\nabc2,Boaty2 McSecond,acbdef123,aias2,remark2" |
|
53 |
- click_on ' |
|
53 | + click_on 'Create following users' |
|
54 |
|
54 | ||
|
55 | assert_text('remark1') |
|
55 | assert_text('remark1') |
|
56 | assert_text('remark2') |
|
56 | assert_text('remark2') |
You need to be logged in to leave comments.
Login now