Description:
more heart beat feature
add reset last login ip
(grafted from 6efa41a1cfdc5e910b85eec6d8b874ed651776bd)
Commit status:
[Not Reviewed]
References:
Diff options:
Comments:
0 Commit comments
0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
r541:11c20f65a6b8 - - 7 files changed: 77 inserted, 18 deleted
@@ -0,0 +1,30 | |||||
|
|
1 | + - content_for :header do | ||
|
|
2 | + = javascript_include_tag 'local_jquery' | ||
|
|
3 | + = stylesheet_link_tag 'tablesorter-theme.cafe' | ||
|
|
4 | + | ||
|
|
5 | + %script{:type=>"text/javascript"} | ||
|
|
6 | + $(function () { | ||
|
|
7 | + $('#since_datetime').datetimepicker({ showButtonPanel: true, dateFormat: "yy-mm-dd", controlType: "slider"} ); | ||
|
|
8 | + $('#until_datetime').datetimepicker({ showButtonPanel: true, dateFormat: "yy-mm-dd", controlType: "slider"} ); | ||
|
|
9 | + $('#my_table').tablesorter({widgets: ['zebra']}); | ||
|
|
10 | + }); | ||
|
|
11 | + | ||
|
|
12 | + %h1 Heart Beat Count | ||
|
|
13 | + = "Last 5 minutes distinct user count = #{@num}" | ||
|
|
14 | + | ||
|
|
15 | + %h1 Heart Beat List | ||
|
|
16 | + | ||
|
|
17 | + %table.tablesorter-cafe#my_table | ||
|
|
18 | + %thead | ||
|
|
19 | + %tr | ||
|
|
20 | + %th Login | ||
|
|
21 | + %th Full name | ||
|
|
22 | + %th IP | ||
|
|
23 | + %th Last Update | ||
|
|
24 | + %tbody | ||
|
|
25 | + - @hb.each do |hb| | ||
|
|
26 | + %tr{class: cycle('info-even','info-odd')} | ||
|
|
27 | + %td= link_to hb.user.login, controller: :users, :action => 'profile', :id => hb.user.id | ||
|
|
28 | + %td= hb.user.full_name | ||
|
|
29 | + %td= hb.ip_address | ||
|
|
30 | + %td= "#{time_ago_in_words(hb.updated_at)} ago" |
@@ -0,0 +1,5 | |||||
|
|
1 | + class AddStatusToHeartBeat < ActiveRecord::Migration | ||
|
|
2 | + def change | ||
|
|
3 | + add_column :heart_beats, :status, :string | ||
|
|
4 | + end | ||
|
|
5 | + end |
@@ -1,14 +1,29 | |||||
|
1 | class HeartbeatController < ApplicationController |
|
1 | class HeartbeatController < ApplicationController |
|
|
2 | + before_filter :admin_authorization, :only => ['index'] | ||
|
|
3 | + | ||
|
2 | def edit |
|
4 | def edit |
|
3 | - render layout: 'empty' |
|
||
|
4 | @user = User.find_by_login(params[:id]) |
|
5 | @user = User.find_by_login(params[:id]) |
|
5 |
- |
|
6 | + unless @user |
|
|
7 | + render text: "LOGIN_NOT_FOUND" | ||
|
|
8 | + return | ||
|
|
9 | + end | ||
|
6 |
|
10 | ||
|
7 | hb = HeartBeat.where(user_id: @user.id, ip_address: request.remote_ip).first |
|
11 | hb = HeartBeat.where(user_id: @user.id, ip_address: request.remote_ip).first |
|
|
12 | + puts "status = #{params[:status]}" | ||
|
8 | if hb |
|
13 | if hb |
|
|
14 | + if params[:status] | ||
|
|
15 | + hb.status = params[:status] | ||
|
|
16 | + hb.save | ||
|
|
17 | + end | ||
|
9 | hb.touch |
|
18 | hb.touch |
|
10 | else |
|
19 | else |
|
11 |
- HeartBeat.crea |
|
20 | + HeartBeat.creae(user_id: @user.id, ip_address: request.remote_ip) |
|
|
21 | + end | ||
|
|
22 | + render text: "OK" | ||
|
|
23 | + end | ||
|
|
24 | + | ||
|
|
25 | + def index | ||
|
|
26 | + @hb = HeartBeat.includes(:user).order(:user_id).all | ||
|
|
27 | + @num = HeartBeat.where("updated_at >= ?",Time.zone.now-5.minutes).count | ||
|
12 |
|
|
28 | end |
|
13 |
|
|
29 | end |
|
14 | - end |
|
@@ -1,536 +1,543 | |||||
|
1 | require 'csv' |
|
1 | require 'csv' |
|
2 |
|
2 | ||
|
3 | class UserAdminController < ApplicationController |
|
3 | class UserAdminController < ApplicationController |
|
4 |
|
4 | ||
|
5 | include MailHelperMethods |
|
5 | include MailHelperMethods |
|
6 |
|
6 | ||
|
7 | before_filter :admin_authorization |
|
7 | before_filter :admin_authorization |
|
8 |
|
8 | ||
|
9 | # GETs should be safe (see http://www.w3.org/2001/tag/doc/whenToUseGet.html) |
|
9 | # GETs should be safe (see http://www.w3.org/2001/tag/doc/whenToUseGet.html) |
|
10 | verify :method => :post, :only => [ :destroy, |
|
10 | verify :method => :post, :only => [ :destroy, |
|
11 | :create, :create_from_list, |
|
11 | :create, :create_from_list, |
|
12 | :update, |
|
12 | :update, |
|
13 | :manage_contest, |
|
13 | :manage_contest, |
|
14 | :bulk_mail |
|
14 | :bulk_mail |
|
15 | ], |
|
15 | ], |
|
16 | :redirect_to => { :action => :list } |
|
16 | :redirect_to => { :action => :list } |
|
17 |
|
17 | ||
|
18 | def index |
|
18 | def index |
|
19 | list |
|
19 | list |
|
20 | render :action => 'list' |
|
20 | render :action => 'list' |
|
21 | end |
|
21 | end |
|
22 |
|
22 | ||
|
23 | def list |
|
23 | def list |
|
24 | @user_count = User.count |
|
24 | @user_count = User.count |
|
25 | if params[:page] == 'all' |
|
25 | if params[:page] == 'all' |
|
26 | @users = User.all |
|
26 | @users = User.all |
|
27 | @paginated = false |
|
27 | @paginated = false |
|
28 | else |
|
28 | else |
|
29 | @users = User.paginate :page => params[:page] |
|
29 | @users = User.paginate :page => params[:page] |
|
30 | @paginated = true |
|
30 | @paginated = true |
|
31 | end |
|
31 | end |
|
32 | @hidden_columns = ['hashed_password', 'salt', 'created_at', 'updated_at'] |
|
32 | @hidden_columns = ['hashed_password', 'salt', 'created_at', 'updated_at'] |
|
33 | @contests = Contest.enabled |
|
33 | @contests = Contest.enabled |
|
34 | end |
|
34 | end |
|
35 |
|
35 | ||
|
36 | def active |
|
36 | def active |
|
37 | sessions = ActiveRecord::SessionStore::Session.find(:all, :conditions => ["updated_at >= ?", 60.minutes.ago]) |
|
37 | sessions = ActiveRecord::SessionStore::Session.find(:all, :conditions => ["updated_at >= ?", 60.minutes.ago]) |
|
38 | @users = [] |
|
38 | @users = [] |
|
39 | sessions.each do |session| |
|
39 | sessions.each do |session| |
|
40 | if session.data[:user_id] |
|
40 | if session.data[:user_id] |
|
41 | @users << User.find(session.data[:user_id]) |
|
41 | @users << User.find(session.data[:user_id]) |
|
42 | end |
|
42 | end |
|
43 | end |
|
43 | end |
|
44 | end |
|
44 | end |
|
45 |
|
45 | ||
|
46 | def show |
|
46 | def show |
|
47 | @user = User.find(params[:id]) |
|
47 | @user = User.find(params[:id]) |
|
48 | end |
|
48 | end |
|
49 |
|
49 | ||
|
50 | def new |
|
50 | def new |
|
51 | @user = User.new |
|
51 | @user = User.new |
|
52 | end |
|
52 | end |
|
53 |
|
53 | ||
|
54 | def create |
|
54 | def create |
|
55 | @user = User.new(params[:user]) |
|
55 | @user = User.new(params[:user]) |
|
56 | @user.activated = true |
|
56 | @user.activated = true |
|
57 | if @user.save |
|
57 | if @user.save |
|
58 | flash[:notice] = 'User was successfully created.' |
|
58 | flash[:notice] = 'User was successfully created.' |
|
59 | redirect_to :action => 'list' |
|
59 | redirect_to :action => 'list' |
|
60 | else |
|
60 | else |
|
61 | render :action => 'new' |
|
61 | render :action => 'new' |
|
62 | end |
|
62 | end |
|
63 | end |
|
63 | end |
|
64 |
|
64 | ||
|
|
65 | + def clear_last_ip | ||
|
|
66 | + @user = User.find(params[:id]) | ||
|
|
67 | + @user.last_ip = nil | ||
|
|
68 | + @user.save | ||
|
|
69 | + redirect_to action: 'list', page: params[:page] | ||
|
|
70 | + end | ||
|
|
71 | + | ||
|
65 | def create_from_list |
|
72 | def create_from_list |
|
66 | lines = params[:user_list] |
|
73 | lines = params[:user_list] |
|
67 |
|
74 | ||
|
68 | note = [] |
|
75 | note = [] |
|
69 |
|
76 | ||
|
70 | lines.split("\n").each do |line| |
|
77 | lines.split("\n").each do |line| |
|
71 | items = line.chomp.split(',') |
|
78 | items = line.chomp.split(',') |
|
72 | if items.length>=2 |
|
79 | if items.length>=2 |
|
73 | login = items[0] |
|
80 | login = items[0] |
|
74 | full_name = items[1] |
|
81 | full_name = items[1] |
|
75 |
|
82 | ||
|
76 | added_random_password = false |
|
83 | added_random_password = false |
|
77 | if items.length>=3 |
|
84 | if items.length>=3 |
|
78 | password = items[2].chomp(" ") |
|
85 | password = items[2].chomp(" ") |
|
79 | user_alias = (items.length>=4) ? items[3] : login |
|
86 | user_alias = (items.length>=4) ? items[3] : login |
|
80 | else |
|
87 | else |
|
81 | password = random_password |
|
88 | password = random_password |
|
82 | user_alias = (items.length>=4) ? items[3] : login |
|
89 | user_alias = (items.length>=4) ? items[3] : login |
|
83 | added_random_password = true |
|
90 | added_random_password = true |
|
84 | end |
|
91 | end |
|
85 |
|
92 | ||
|
86 | user = User.find_by_login(login) |
|
93 | user = User.find_by_login(login) |
|
87 | if (user) |
|
94 | if (user) |
|
88 | user.full_name = full_name |
|
95 | user.full_name = full_name |
|
89 | user.password = password |
|
96 | user.password = password |
|
90 | else |
|
97 | else |
|
91 | user = User.new({:login => login, |
|
98 | user = User.new({:login => login, |
|
92 | :full_name => full_name, |
|
99 | :full_name => full_name, |
|
93 | :password => password, |
|
100 | :password => password, |
|
94 | :password_confirmation => password, |
|
101 | :password_confirmation => password, |
|
95 | :alias => user_alias}) |
|
102 | :alias => user_alias}) |
|
96 | end |
|
103 | end |
|
97 | user.activated = true |
|
104 | user.activated = true |
|
98 | user.save |
|
105 | user.save |
|
99 |
|
106 | ||
|
100 | if added_random_password |
|
107 | if added_random_password |
|
101 | note << "'#{login}' (+)" |
|
108 | note << "'#{login}' (+)" |
|
102 | else |
|
109 | else |
|
103 | note << login |
|
110 | note << login |
|
104 | end |
|
111 | end |
|
105 | end |
|
112 | end |
|
106 | end |
|
113 | end |
|
107 | flash[:notice] = 'User(s) ' + note.join(', ') + |
|
114 | flash[:notice] = 'User(s) ' + note.join(', ') + |
|
108 | ' were successfully created. ' + |
|
115 | ' were successfully created. ' + |
|
109 | '( (+) - created with random passwords.)' |
|
116 | '( (+) - created with random passwords.)' |
|
110 | redirect_to :action => 'list' |
|
117 | redirect_to :action => 'list' |
|
111 | end |
|
118 | end |
|
112 |
|
119 | ||
|
113 | def edit |
|
120 | def edit |
|
114 | @user = User.find(params[:id]) |
|
121 | @user = User.find(params[:id]) |
|
115 | end |
|
122 | end |
|
116 |
|
123 | ||
|
117 | def update |
|
124 | def update |
|
118 | @user = User.find(params[:id]) |
|
125 | @user = User.find(params[:id]) |
|
119 | if @user.update_attributes(params[:user]) |
|
126 | if @user.update_attributes(params[:user]) |
|
120 | flash[:notice] = 'User was successfully updated.' |
|
127 | flash[:notice] = 'User was successfully updated.' |
|
121 | redirect_to :action => 'show', :id => @user |
|
128 | redirect_to :action => 'show', :id => @user |
|
122 | else |
|
129 | else |
|
123 | render :action => 'edit' |
|
130 | render :action => 'edit' |
|
124 | end |
|
131 | end |
|
125 | end |
|
132 | end |
|
126 |
|
133 | ||
|
127 | def destroy |
|
134 | def destroy |
|
128 | User.find(params[:id]).destroy |
|
135 | User.find(params[:id]).destroy |
|
129 | redirect_to :action => 'list' |
|
136 | redirect_to :action => 'list' |
|
130 | end |
|
137 | end |
|
131 |
|
138 | ||
|
132 | def user_stat |
|
139 | def user_stat |
|
133 | if params[:commit] == 'download csv' |
|
140 | if params[:commit] == 'download csv' |
|
134 | @problems = Problem.all |
|
141 | @problems = Problem.all |
|
135 | else |
|
142 | else |
|
136 | @problems = Problem.find_available_problems |
|
143 | @problems = Problem.find_available_problems |
|
137 | end |
|
144 | end |
|
138 | @users = User.find(:all, :include => [:contests, :contest_stat]) |
|
145 | @users = User.find(:all, :include => [:contests, :contest_stat]) |
|
139 | @scorearray = Array.new |
|
146 | @scorearray = Array.new |
|
140 | @users.each do |u| |
|
147 | @users.each do |u| |
|
141 | ustat = Array.new |
|
148 | ustat = Array.new |
|
142 | ustat[0] = u |
|
149 | ustat[0] = u |
|
143 | @problems.each do |p| |
|
150 | @problems.each do |p| |
|
144 | sub = Submission.find_last_by_user_and_problem(u.id,p.id) |
|
151 | sub = Submission.find_last_by_user_and_problem(u.id,p.id) |
|
145 | if (sub!=nil) and (sub.points!=nil) and p and p.full_score |
|
152 | if (sub!=nil) and (sub.points!=nil) and p and p.full_score |
|
146 | ustat << [(sub.points.to_f*100/p.full_score).round, (sub.points>=p.full_score)] |
|
153 | ustat << [(sub.points.to_f*100/p.full_score).round, (sub.points>=p.full_score)] |
|
147 | else |
|
154 | else |
|
148 | ustat << [0,false] |
|
155 | ustat << [0,false] |
|
149 | end |
|
156 | end |
|
150 | end |
|
157 | end |
|
151 | @scorearray << ustat |
|
158 | @scorearray << ustat |
|
152 | end |
|
159 | end |
|
153 | if params[:commit] == 'download csv' then |
|
160 | if params[:commit] == 'download csv' then |
|
154 | csv = gen_csv_from_scorearray(@scorearray,@problems) |
|
161 | csv = gen_csv_from_scorearray(@scorearray,@problems) |
|
155 | send_data csv, filename: 'last_score.csv' |
|
162 | send_data csv, filename: 'last_score.csv' |
|
156 | else |
|
163 | else |
|
157 | render template: 'user_admin/user_stat' |
|
164 | render template: 'user_admin/user_stat' |
|
158 | end |
|
165 | end |
|
159 | end |
|
166 | end |
|
160 |
|
167 | ||
|
161 | def user_stat_max |
|
168 | def user_stat_max |
|
162 | if params[:commit] == 'download csv' |
|
169 | if params[:commit] == 'download csv' |
|
163 | @problems = Problem.all |
|
170 | @problems = Problem.all |
|
164 | else |
|
171 | else |
|
165 | @problems = Problem.find_available_problems |
|
172 | @problems = Problem.find_available_problems |
|
166 | end |
|
173 | end |
|
167 | @users = User.find(:all, :include => [:contests, :contest_stat]) |
|
174 | @users = User.find(:all, :include => [:contests, :contest_stat]) |
|
168 | @scorearray = Array.new |
|
175 | @scorearray = Array.new |
|
169 | #set up range from param |
|
176 | #set up range from param |
|
170 | since_id = params.fetch(:since_id, 0).to_i |
|
177 | since_id = params.fetch(:since_id, 0).to_i |
|
171 | until_id = params.fetch(:until_id, 0).to_i |
|
178 | until_id = params.fetch(:until_id, 0).to_i |
|
172 | @users.each do |u| |
|
179 | @users.each do |u| |
|
173 | ustat = Array.new |
|
180 | ustat = Array.new |
|
174 | ustat[0] = u |
|
181 | ustat[0] = u |
|
175 | @problems.each do |p| |
|
182 | @problems.each do |p| |
|
176 | max_points = 0 |
|
183 | max_points = 0 |
|
177 | Submission.find_in_range_by_user_and_problem(u.id,p.id,since_id,until_id).each do |sub| |
|
184 | Submission.find_in_range_by_user_and_problem(u.id,p.id,since_id,until_id).each do |sub| |
|
178 | max_points = sub.points if sub and sub.points and (sub.points > max_points) |
|
185 | max_points = sub.points if sub and sub.points and (sub.points > max_points) |
|
179 | end |
|
186 | end |
|
180 | ustat << [(max_points.to_f*100/p.full_score).round, (max_points>=p.full_score)] |
|
187 | ustat << [(max_points.to_f*100/p.full_score).round, (max_points>=p.full_score)] |
|
181 | end |
|
188 | end |
|
182 | @scorearray << ustat |
|
189 | @scorearray << ustat |
|
183 | end |
|
190 | end |
|
184 |
|
191 | ||
|
185 | if params[:commit] == 'download csv' then |
|
192 | if params[:commit] == 'download csv' then |
|
186 | csv = gen_csv_from_scorearray(@scorearray,@problems) |
|
193 | csv = gen_csv_from_scorearray(@scorearray,@problems) |
|
187 | send_data csv, filename: 'max_score.csv' |
|
194 | send_data csv, filename: 'max_score.csv' |
|
188 | else |
|
195 | else |
|
189 | render template: 'user_admin/user_stat' |
|
196 | render template: 'user_admin/user_stat' |
|
190 | end |
|
197 | end |
|
191 | end |
|
198 | end |
|
192 |
|
199 | ||
|
193 | def import |
|
200 | def import |
|
194 | if params[:file]=='' |
|
201 | if params[:file]=='' |
|
195 | flash[:notice] = 'Error importing no file' |
|
202 | flash[:notice] = 'Error importing no file' |
|
196 | redirect_to :action => 'list' and return |
|
203 | redirect_to :action => 'list' and return |
|
197 | end |
|
204 | end |
|
198 | import_from_file(params[:file]) |
|
205 | import_from_file(params[:file]) |
|
199 | end |
|
206 | end |
|
200 |
|
207 | ||
|
201 | def random_all_passwords |
|
208 | def random_all_passwords |
|
202 | users = User.find(:all) |
|
209 | users = User.find(:all) |
|
203 | @prefix = params[:prefix] || '' |
|
210 | @prefix = params[:prefix] || '' |
|
204 | @non_admin_users = User.find_non_admin_with_prefix(@prefix) |
|
211 | @non_admin_users = User.find_non_admin_with_prefix(@prefix) |
|
205 | @changed = false |
|
212 | @changed = false |
|
206 | if request.request_method == 'POST' |
|
213 | if request.request_method == 'POST' |
|
207 | @non_admin_users.each do |user| |
|
214 | @non_admin_users.each do |user| |
|
208 | password = random_password |
|
215 | password = random_password |
|
209 | user.password = password |
|
216 | user.password = password |
|
210 | user.password_confirmation = password |
|
217 | user.password_confirmation = password |
|
211 | user.save |
|
218 | user.save |
|
212 | end |
|
219 | end |
|
213 | @changed = true |
|
220 | @changed = true |
|
214 | end |
|
221 | end |
|
215 | end |
|
222 | end |
|
216 |
|
223 | ||
|
217 | # contest management |
|
224 | # contest management |
|
218 |
|
225 | ||
|
219 | def contests |
|
226 | def contests |
|
220 | @contest, @users = find_contest_and_user_from_contest_id(params[:id]) |
|
227 | @contest, @users = find_contest_and_user_from_contest_id(params[:id]) |
|
221 | @contests = Contest.enabled |
|
228 | @contests = Contest.enabled |
|
222 | end |
|
229 | end |
|
223 |
|
230 | ||
|
224 | def assign_from_list |
|
231 | def assign_from_list |
|
225 | contest_id = params[:users_contest_id] |
|
232 | contest_id = params[:users_contest_id] |
|
226 | org_contest, users = find_contest_and_user_from_contest_id(contest_id) |
|
233 | org_contest, users = find_contest_and_user_from_contest_id(contest_id) |
|
227 | contest = Contest.find(params[:new_contest][:id]) |
|
234 | contest = Contest.find(params[:new_contest][:id]) |
|
228 | if !contest |
|
235 | if !contest |
|
229 | flash[:notice] = 'Error: no contest' |
|
236 | flash[:notice] = 'Error: no contest' |
|
230 | redirect_to :action => 'contests', :id =>contest_id |
|
237 | redirect_to :action => 'contests', :id =>contest_id |
|
231 | end |
|
238 | end |
|
232 |
|
239 | ||
|
233 | note = [] |
|
240 | note = [] |
|
234 | users.each do |u| |
|
241 | users.each do |u| |
|
235 | u.contests = [contest] |
|
242 | u.contests = [contest] |
|
236 | note << u.login |
|
243 | note << u.login |
|
237 | end |
|
244 | end |
|
238 | flash[:notice] = 'User(s) ' + note.join(', ') + |
|
245 | flash[:notice] = 'User(s) ' + note.join(', ') + |
|
239 | " were successfully reassigned to #{contest.title}." |
|
246 | " were successfully reassigned to #{contest.title}." |
|
240 | redirect_to :action => 'contests', :id =>contest.id |
|
247 | redirect_to :action => 'contests', :id =>contest.id |
|
241 | end |
|
248 | end |
|
242 |
|
249 | ||
|
243 | def add_to_contest |
|
250 | def add_to_contest |
|
244 | user = User.find(params[:id]) |
|
251 | user = User.find(params[:id]) |
|
245 | contest = Contest.find(params[:contest_id]) |
|
252 | contest = Contest.find(params[:contest_id]) |
|
246 | if user and contest |
|
253 | if user and contest |
|
247 | user.contests << contest |
|
254 | user.contests << contest |
|
248 | end |
|
255 | end |
|
249 | redirect_to :action => 'list' |
|
256 | redirect_to :action => 'list' |
|
250 | end |
|
257 | end |
|
251 |
|
258 | ||
|
252 | def remove_from_contest |
|
259 | def remove_from_contest |
|
253 | user = User.find(params[:id]) |
|
260 | user = User.find(params[:id]) |
|
254 | contest = Contest.find(params[:contest_id]) |
|
261 | contest = Contest.find(params[:contest_id]) |
|
255 | if user and contest |
|
262 | if user and contest |
|
256 | user.contests.delete(contest) |
|
263 | user.contests.delete(contest) |
|
257 | end |
|
264 | end |
|
258 | redirect_to :action => 'list' |
|
265 | redirect_to :action => 'list' |
|
259 | end |
|
266 | end |
|
260 |
|
267 | ||
|
261 | def contest_management |
|
268 | def contest_management |
|
262 | end |
|
269 | end |
|
263 |
|
270 | ||
|
264 | def manage_contest |
|
271 | def manage_contest |
|
265 | contest = Contest.find(params[:contest][:id]) |
|
272 | contest = Contest.find(params[:contest][:id]) |
|
266 | if !contest |
|
273 | if !contest |
|
267 | flash[:notice] = 'You did not choose the contest.' |
|
274 | flash[:notice] = 'You did not choose the contest.' |
|
268 | redirect_to :action => 'contest_management' and return |
|
275 | redirect_to :action => 'contest_management' and return |
|
269 | end |
|
276 | end |
|
270 |
|
277 | ||
|
271 | operation = params[:operation] |
|
278 | operation = params[:operation] |
|
272 |
|
279 | ||
|
273 | if not ['add','remove','assign'].include? operation |
|
280 | if not ['add','remove','assign'].include? operation |
|
274 | flash[:notice] = 'You did not choose the operation to perform.' |
|
281 | flash[:notice] = 'You did not choose the operation to perform.' |
|
275 | redirect_to :action => 'contest_management' and return |
|
282 | redirect_to :action => 'contest_management' and return |
|
276 | end |
|
283 | end |
|
277 |
|
284 | ||
|
278 | lines = params[:login_list] |
|
285 | lines = params[:login_list] |
|
279 | if !lines or lines.blank? |
|
286 | if !lines or lines.blank? |
|
280 | flash[:notice] = 'You entered an empty list.' |
|
287 | flash[:notice] = 'You entered an empty list.' |
|
281 | redirect_to :action => 'contest_management' and return |
|
288 | redirect_to :action => 'contest_management' and return |
|
282 | end |
|
289 | end |
|
283 |
|
290 | ||
|
284 | note = [] |
|
291 | note = [] |
|
285 | users = [] |
|
292 | users = [] |
|
286 | lines.split("\n").each do |line| |
|
293 | lines.split("\n").each do |line| |
|
287 | user = User.find_by_login(line.chomp) |
|
294 | user = User.find_by_login(line.chomp) |
|
288 | if user |
|
295 | if user |
|
289 | if operation=='add' |
|
296 | if operation=='add' |
|
290 | if ! user.contests.include? contest |
|
297 | if ! user.contests.include? contest |
|
291 | user.contests << contest |
|
298 | user.contests << contest |
|
292 | end |
|
299 | end |
|
293 | elsif operation=='remove' |
|
300 | elsif operation=='remove' |
|
294 | user.contests.delete(contest) |
|
301 | user.contests.delete(contest) |
|
295 | else |
|
302 | else |
|
296 | user.contests = [contest] |
|
303 | user.contests = [contest] |
|
297 | end |
|
304 | end |
|
298 |
|
305 | ||
|
299 | if params[:reset_timer] |
|
306 | if params[:reset_timer] |
|
300 | user.contest_stat.forced_logout = true |
|
307 | user.contest_stat.forced_logout = true |
|
301 | user.contest_stat.reset_timer_and_save |
|
308 | user.contest_stat.reset_timer_and_save |
|
302 | end |
|
309 | end |
|
303 |
|
310 | ||
|
304 | if params[:notification_emails] |
|
311 | if params[:notification_emails] |
|
305 | send_contest_update_notification_email(user, contest) |
|
312 | send_contest_update_notification_email(user, contest) |
|
306 | end |
|
313 | end |
|
307 |
|
314 | ||
|
308 | note << user.login |
|
315 | note << user.login |
|
309 | users << user |
|
316 | users << user |
|
310 | end |
|
317 | end |
|
311 | end |
|
318 | end |
|
312 |
|
319 | ||
|
313 | if params[:reset_timer] |
|
320 | if params[:reset_timer] |
|
314 | logout_users(users) |
|
321 | logout_users(users) |
|
315 | end |
|
322 | end |
|
316 |
|
323 | ||
|
317 | flash[:notice] = 'User(s) ' + note.join(', ') + |
|
324 | flash[:notice] = 'User(s) ' + note.join(', ') + |
|
318 | ' were successfully modified. ' |
|
325 | ' were successfully modified. ' |
|
319 | redirect_to :action => 'contest_management' |
|
326 | redirect_to :action => 'contest_management' |
|
320 | end |
|
327 | end |
|
321 |
|
328 | ||
|
322 | # admin management |
|
329 | # admin management |
|
323 |
|
330 | ||
|
324 | def admin |
|
331 | def admin |
|
325 | @admins = User.find(:all).find_all {|user| user.admin? } |
|
332 | @admins = User.find(:all).find_all {|user| user.admin? } |
|
326 | end |
|
333 | end |
|
327 |
|
334 | ||
|
328 | def grant_admin |
|
335 | def grant_admin |
|
329 | login = params[:login] |
|
336 | login = params[:login] |
|
330 | user = User.find_by_login(login) |
|
337 | user = User.find_by_login(login) |
|
331 | if user!=nil |
|
338 | if user!=nil |
|
332 | admin_role = Role.find_by_name('admin') |
|
339 | admin_role = Role.find_by_name('admin') |
|
333 | user.roles << admin_role |
|
340 | user.roles << admin_role |
|
334 | else |
|
341 | else |
|
335 | flash[:notice] = 'Unknown user' |
|
342 | flash[:notice] = 'Unknown user' |
|
336 | end |
|
343 | end |
|
337 | flash[:notice] = 'User added as admins' |
|
344 | flash[:notice] = 'User added as admins' |
|
338 | redirect_to :action => 'admin' |
|
345 | redirect_to :action => 'admin' |
|
339 | end |
|
346 | end |
|
340 |
|
347 | ||
|
341 | def revoke_admin |
|
348 | def revoke_admin |
|
342 | user = User.find(params[:id]) |
|
349 | user = User.find(params[:id]) |
|
343 | if user==nil |
|
350 | if user==nil |
|
344 | flash[:notice] = 'Unknown user' |
|
351 | flash[:notice] = 'Unknown user' |
|
345 | redirect_to :action => 'admin' and return |
|
352 | redirect_to :action => 'admin' and return |
|
346 | elsif user.login == 'root' |
|
353 | elsif user.login == 'root' |
|
347 | flash[:notice] = 'You cannot revoke admisnistrator permission from root.' |
|
354 | flash[:notice] = 'You cannot revoke admisnistrator permission from root.' |
|
348 | redirect_to :action => 'admin' and return |
|
355 | redirect_to :action => 'admin' and return |
|
349 | end |
|
356 | end |
|
350 |
|
357 | ||
|
351 | admin_role = Role.find_by_name('admin') |
|
358 | admin_role = Role.find_by_name('admin') |
|
352 | user.roles.delete(admin_role) |
|
359 | user.roles.delete(admin_role) |
|
353 | flash[:notice] = 'User permission revoked' |
|
360 | flash[:notice] = 'User permission revoked' |
|
354 | redirect_to :action => 'admin' |
|
361 | redirect_to :action => 'admin' |
|
355 | end |
|
362 | end |
|
356 |
|
363 | ||
|
357 | # mass mailing |
|
364 | # mass mailing |
|
358 |
|
365 | ||
|
359 | def mass_mailing |
|
366 | def mass_mailing |
|
360 | end |
|
367 | end |
|
361 |
|
368 | ||
|
362 | def bulk_mail |
|
369 | def bulk_mail |
|
363 | lines = params[:login_list] |
|
370 | lines = params[:login_list] |
|
364 | if !lines or lines.blank? |
|
371 | if !lines or lines.blank? |
|
365 | flash[:notice] = 'You entered an empty list.' |
|
372 | flash[:notice] = 'You entered an empty list.' |
|
366 | redirect_to :action => 'mass_mailing' and return |
|
373 | redirect_to :action => 'mass_mailing' and return |
|
367 | end |
|
374 | end |
|
368 |
|
375 | ||
|
369 | mail_subject = params[:subject] |
|
376 | mail_subject = params[:subject] |
|
370 | if !mail_subject or mail_subject.blank? |
|
377 | if !mail_subject or mail_subject.blank? |
|
371 | flash[:notice] = 'You entered an empty mail subject.' |
|
378 | flash[:notice] = 'You entered an empty mail subject.' |
|
372 | redirect_to :action => 'mass_mailing' and return |
|
379 | redirect_to :action => 'mass_mailing' and return |
|
373 | end |
|
380 | end |
|
374 |
|
381 | ||
|
375 | mail_body = params[:email_body] |
|
382 | mail_body = params[:email_body] |
|
376 | if !mail_body or mail_body.blank? |
|
383 | if !mail_body or mail_body.blank? |
|
377 | flash[:notice] = 'You entered an empty mail body.' |
|
384 | flash[:notice] = 'You entered an empty mail body.' |
|
378 | redirect_to :action => 'mass_mailing' and return |
|
385 | redirect_to :action => 'mass_mailing' and return |
|
379 | end |
|
386 | end |
|
380 |
|
387 | ||
|
381 | note = [] |
|
388 | note = [] |
|
382 | users = [] |
|
389 | users = [] |
|
383 | lines.split("\n").each do |line| |
|
390 | lines.split("\n").each do |line| |
|
384 | user = User.find_by_login(line.chomp) |
|
391 | user = User.find_by_login(line.chomp) |
|
385 | if user |
|
392 | if user |
|
386 | send_mail(user.email, mail_subject, mail_body) |
|
393 | send_mail(user.email, mail_subject, mail_body) |
|
387 | note << user.login |
|
394 | note << user.login |
|
388 | end |
|
395 | end |
|
389 | end |
|
396 | end |
|
390 |
|
397 | ||
|
391 | flash[:notice] = 'User(s) ' + note.join(', ') + |
|
398 | flash[:notice] = 'User(s) ' + note.join(', ') + |
|
392 | ' were successfully modified. ' |
|
399 | ' were successfully modified. ' |
|
393 | redirect_to :action => 'mass_mailing' |
|
400 | redirect_to :action => 'mass_mailing' |
|
394 | end |
|
401 | end |
|
395 |
|
402 | ||
|
396 | protected |
|
403 | protected |
|
397 |
|
404 | ||
|
398 | def random_password(length=5) |
|
405 | def random_password(length=5) |
|
399 | chars = 'abcdefghijkmnopqrstuvwxyz23456789' |
|
406 | chars = 'abcdefghijkmnopqrstuvwxyz23456789' |
|
400 | newpass = "" |
|
407 | newpass = "" |
|
401 | length.times { newpass << chars[rand(chars.size-1)] } |
|
408 | length.times { newpass << chars[rand(chars.size-1)] } |
|
402 | return newpass |
|
409 | return newpass |
|
403 | end |
|
410 | end |
|
404 |
|
411 | ||
|
405 | def import_from_file(f) |
|
412 | def import_from_file(f) |
|
406 | data_hash = YAML.load(f) |
|
413 | data_hash = YAML.load(f) |
|
407 | @import_log = "" |
|
414 | @import_log = "" |
|
408 |
|
415 | ||
|
409 | country_data = data_hash[:countries] |
|
416 | country_data = data_hash[:countries] |
|
410 | site_data = data_hash[:sites] |
|
417 | site_data = data_hash[:sites] |
|
411 | user_data = data_hash[:users] |
|
418 | user_data = data_hash[:users] |
|
412 |
|
419 | ||
|
413 | # import country |
|
420 | # import country |
|
414 | countries = {} |
|
421 | countries = {} |
|
415 | country_data.each_pair do |id,country| |
|
422 | country_data.each_pair do |id,country| |
|
416 | c = Country.find_by_name(country[:name]) |
|
423 | c = Country.find_by_name(country[:name]) |
|
417 | if c!=nil |
|
424 | if c!=nil |
|
418 | countries[id] = c |
|
425 | countries[id] = c |
|
419 | @import_log << "Found #{country[:name]}\n" |
|
426 | @import_log << "Found #{country[:name]}\n" |
|
420 | else |
|
427 | else |
|
421 | countries[id] = Country.new(:name => country[:name]) |
|
428 | countries[id] = Country.new(:name => country[:name]) |
|
422 | countries[id].save |
|
429 | countries[id].save |
|
423 | @import_log << "Created #{country[:name]}\n" |
|
430 | @import_log << "Created #{country[:name]}\n" |
|
424 | end |
|
431 | end |
|
425 | end |
|
432 | end |
|
426 |
|
433 | ||
|
427 | # import sites |
|
434 | # import sites |
|
428 | sites = {} |
|
435 | sites = {} |
|
429 | site_data.each_pair do |id,site| |
|
436 | site_data.each_pair do |id,site| |
|
430 | s = Site.find_by_name(site[:name]) |
|
437 | s = Site.find_by_name(site[:name]) |
|
431 | if s!=nil |
|
438 | if s!=nil |
|
432 | @import_log << "Found #{site[:name]}\n" |
|
439 | @import_log << "Found #{site[:name]}\n" |
|
433 | else |
|
440 | else |
|
434 | s = Site.new(:name => site[:name]) |
|
441 | s = Site.new(:name => site[:name]) |
|
435 | @import_log << "Created #{site[:name]}\n" |
|
442 | @import_log << "Created #{site[:name]}\n" |
|
436 | end |
|
443 | end |
|
437 | s.password = site[:password] |
|
444 | s.password = site[:password] |
|
438 | s.country = countries[site[:country_id]] |
|
445 | s.country = countries[site[:country_id]] |
|
439 | s.save |
|
446 | s.save |
|
440 | sites[id] = s |
|
447 | sites[id] = s |
|
441 | end |
|
448 | end |
|
442 |
|
449 | ||
|
443 | # import users |
|
450 | # import users |
|
444 | user_data.each_pair do |id,user| |
|
451 | user_data.each_pair do |id,user| |
|
445 | u = User.find_by_login(user[:login]) |
|
452 | u = User.find_by_login(user[:login]) |
|
446 | if u!=nil |
|
453 | if u!=nil |
|
447 | @import_log << "Found #{user[:login]}\n" |
|
454 | @import_log << "Found #{user[:login]}\n" |
|
448 | else |
|
455 | else |
|
449 | u = User.new(:login => user[:login]) |
|
456 | u = User.new(:login => user[:login]) |
|
450 | @import_log << "Created #{user[:login]}\n" |
|
457 | @import_log << "Created #{user[:login]}\n" |
|
451 | end |
|
458 | end |
|
452 | u.full_name = user[:name] |
|
459 | u.full_name = user[:name] |
|
453 | u.password = user[:password] |
|
460 | u.password = user[:password] |
|
454 | u.country = countries[user[:country_id]] |
|
461 | u.country = countries[user[:country_id]] |
|
455 | u.site = sites[user[:site_id]] |
|
462 | u.site = sites[user[:site_id]] |
|
456 | u.activated = true |
|
463 | u.activated = true |
|
457 | u.email = "empty-#{u.login}@none.com" |
|
464 | u.email = "empty-#{u.login}@none.com" |
|
458 | if not u.save |
|
465 | if not u.save |
|
459 | @import_log << "Errors\n" |
|
466 | @import_log << "Errors\n" |
|
460 | u.errors.each { |attr,msg| @import_log << "#{attr} - #{msg}\n" } |
|
467 | u.errors.each { |attr,msg| @import_log << "#{attr} - #{msg}\n" } |
|
461 | end |
|
468 | end |
|
462 | end |
|
469 | end |
|
463 |
|
470 | ||
|
464 | end |
|
471 | end |
|
465 |
|
472 | ||
|
466 | def logout_users(users) |
|
473 | def logout_users(users) |
|
467 | users.each do |user| |
|
474 | users.each do |user| |
|
468 | contest_stat = user.contest_stat(true) |
|
475 | contest_stat = user.contest_stat(true) |
|
469 | if contest_stat and !contest_stat.forced_logout |
|
476 | if contest_stat and !contest_stat.forced_logout |
|
470 | contest_stat.forced_logout = true |
|
477 | contest_stat.forced_logout = true |
|
471 | contest_stat.save |
|
478 | contest_stat.save |
|
472 | end |
|
479 | end |
|
473 | end |
|
480 | end |
|
474 | end |
|
481 | end |
|
475 |
|
482 | ||
|
476 | def send_contest_update_notification_email(user, contest) |
|
483 | def send_contest_update_notification_email(user, contest) |
|
477 | contest_title_name = GraderConfiguration['contest.name'] |
|
484 | contest_title_name = GraderConfiguration['contest.name'] |
|
478 | contest_name = contest.name |
|
485 | contest_name = contest.name |
|
479 | mail_subject = t('contest.notification.email_subject', { |
|
486 | mail_subject = t('contest.notification.email_subject', { |
|
480 | :contest_title_name => contest_title_name, |
|
487 | :contest_title_name => contest_title_name, |
|
481 | :contest_name => contest_name }) |
|
488 | :contest_name => contest_name }) |
|
482 | mail_body = t('contest.notification.email_body', { |
|
489 | mail_body = t('contest.notification.email_body', { |
|
483 | :full_name => user.full_name, |
|
490 | :full_name => user.full_name, |
|
484 | :contest_title_name => contest_title_name, |
|
491 | :contest_title_name => contest_title_name, |
|
485 | :contest_name => contest.name, |
|
492 | :contest_name => contest.name, |
|
486 | }) |
|
493 | }) |
|
487 |
|
494 | ||
|
488 | logger.info mail_body |
|
495 | logger.info mail_body |
|
489 | send_mail(user.email, mail_subject, mail_body) |
|
496 | send_mail(user.email, mail_subject, mail_body) |
|
490 | end |
|
497 | end |
|
491 |
|
498 | ||
|
492 | def find_contest_and_user_from_contest_id(id) |
|
499 | def find_contest_and_user_from_contest_id(id) |
|
493 | if id!='none' |
|
500 | if id!='none' |
|
494 | @contest = Contest.find(id) |
|
501 | @contest = Contest.find(id) |
|
495 | else |
|
502 | else |
|
496 | @contest = nil |
|
503 | @contest = nil |
|
497 | end |
|
504 | end |
|
498 | if @contest |
|
505 | if @contest |
|
499 | @users = @contest.users |
|
506 | @users = @contest.users |
|
500 | else |
|
507 | else |
|
501 | @users = User.find_users_with_no_contest |
|
508 | @users = User.find_users_with_no_contest |
|
502 | end |
|
509 | end |
|
503 | return [@contest, @users] |
|
510 | return [@contest, @users] |
|
504 | end |
|
511 | end |
|
505 |
|
512 | ||
|
506 | def gen_csv_from_scorearray(scorearray,problem) |
|
513 | def gen_csv_from_scorearray(scorearray,problem) |
|
507 | CSV.generate do |csv| |
|
514 | CSV.generate do |csv| |
|
508 | #add header |
|
515 | #add header |
|
509 | header = ['User','Name', 'Activated?', 'Logged in', 'Contest'] |
|
516 | header = ['User','Name', 'Activated?', 'Logged in', 'Contest'] |
|
510 | problem.each { |p| header << p.name } |
|
517 | problem.each { |p| header << p.name } |
|
511 | header += ['Total','Passed'] |
|
518 | header += ['Total','Passed'] |
|
512 | csv << header |
|
519 | csv << header |
|
513 | #add data |
|
520 | #add data |
|
514 | scorearray.each do |sc| |
|
521 | scorearray.each do |sc| |
|
515 | total = num_passed = 0 |
|
522 | total = num_passed = 0 |
|
516 | row = Array.new |
|
523 | row = Array.new |
|
517 | sc.each_index do |i| |
|
524 | sc.each_index do |i| |
|
518 | if i == 0 |
|
525 | if i == 0 |
|
519 | row << sc[i].login |
|
526 | row << sc[i].login |
|
520 | row << sc[i].full_name |
|
527 | row << sc[i].full_name |
|
521 | row << sc[i].activated |
|
528 | row << sc[i].activated |
|
522 | row << (sc[i].try(:contest_stat).try(:started_at)!=nil ? 'yes' : 'no') |
|
529 | row << (sc[i].try(:contest_stat).try(:started_at)!=nil ? 'yes' : 'no') |
|
523 | row << sc[i].contests.collect {|c| c.name}.join(', ') |
|
530 | row << sc[i].contests.collect {|c| c.name}.join(', ') |
|
524 | else |
|
531 | else |
|
525 | row << sc[i][0] |
|
532 | row << sc[i][0] |
|
526 | total += sc[i][0] |
|
533 | total += sc[i][0] |
|
527 | num_passed += 1 if sc[i][1] |
|
534 | num_passed += 1 if sc[i][1] |
|
528 | end |
|
535 | end |
|
529 | end |
|
536 | end |
|
530 | row << total |
|
537 | row << total |
|
531 | row << num_passed |
|
538 | row << num_passed |
|
532 | csv << row |
|
539 | csv << row |
|
533 | end |
|
540 | end |
|
534 | end |
|
541 | end |
|
535 | end |
|
542 | end |
|
536 | end |
|
543 | end |
@@ -1,87 +1,89 | |||||
|
1 | <h1>Listing users</h1> |
|
1 | <h1>Listing users</h1> |
|
2 |
|
2 | ||
|
3 | <div class="submitbox"> |
|
3 | <div class="submitbox"> |
|
4 | <b>Quick add</b> |
|
4 | <b>Quick add</b> |
|
5 | <%= form_tag :action => 'create' do %> |
|
5 | <%= form_tag :action => 'create' do %> |
|
6 | <table border="0"> |
|
6 | <table border="0"> |
|
7 | <tr> |
|
7 | <tr> |
|
8 | <td><label for="user_login">Login</label></td> |
|
8 | <td><label for="user_login">Login</label></td> |
|
9 | <td><label for="user_full_name">Full name</label></td> |
|
9 | <td><label for="user_full_name">Full name</label></td> |
|
10 | <td><label for="user_password">Password</label></td> |
|
10 | <td><label for="user_password">Password</label></td> |
|
11 | <td><label for="user_password_confirmation">Confirm</label></td> |
|
11 | <td><label for="user_password_confirmation">Confirm</label></td> |
|
12 | <td><label for="user_email">Email</label></td> |
|
12 | <td><label for="user_email">Email</label></td> |
|
13 | </tr> |
|
13 | </tr> |
|
14 | <tr> |
|
14 | <tr> |
|
15 | <td><%= text_field 'user', 'login', :size => 10 %></td> |
|
15 | <td><%= text_field 'user', 'login', :size => 10 %></td> |
|
16 | <td><%= text_field 'user', 'full_name', :size => 30 %></td> |
|
16 | <td><%= text_field 'user', 'full_name', :size => 30 %></td> |
|
17 | <td><%= password_field 'user', 'password', :size => 10 %></td> |
|
17 | <td><%= password_field 'user', 'password', :size => 10 %></td> |
|
18 | <td><%= password_field 'user', 'password_confirmation', :size => 10 %></td> |
|
18 | <td><%= password_field 'user', 'password_confirmation', :size => 10 %></td> |
|
19 | <td><%= email_field 'user', 'email', :size => 15 %></td> |
|
19 | <td><%= email_field 'user', 'email', :size => 15 %></td> |
|
20 | <td><%= submit_tag "Create" %></td> |
|
20 | <td><%= submit_tag "Create" %></td> |
|
21 | </tr> |
|
21 | </tr> |
|
22 | </table> |
|
22 | </table> |
|
23 | <% end %> |
|
23 | <% end %> |
|
24 | <br/> |
|
24 | <br/> |
|
25 | <b>Import from site management</b> |
|
25 | <b>Import from site management</b> |
|
26 | <%= form_tag({:action => 'import'}, :multipart => true) do %> |
|
26 | <%= form_tag({:action => 'import'}, :multipart => true) do %> |
|
27 | File: <%= file_field_tag 'file' %> <%= submit_tag 'Import' %> |
|
27 | File: <%= file_field_tag 'file' %> <%= submit_tag 'Import' %> |
|
28 | <% end %> |
|
28 | <% end %> |
|
29 | <br/> |
|
29 | <br/> |
|
30 | <b>What else: </b> |
|
30 | <b>What else: </b> |
|
31 | <%= link_to '[New user]', :action => 'new' %> |
|
31 | <%= link_to '[New user]', :action => 'new' %> |
|
32 | <%= link_to '[New list of users]', :action => 'new_list' %> |
|
32 | <%= link_to '[New list of users]', :action => 'new_list' %> |
|
33 | <%= link_to '[View administrators]', :action => 'admin' %> |
|
33 | <%= link_to '[View administrators]', :action => 'admin' %> |
|
34 | <%= link_to '[Random passwords]', :action => 'random_all_passwords' %> |
|
34 | <%= link_to '[Random passwords]', :action => 'random_all_passwords' %> |
|
35 | <%= link_to '[View active users]', :action => 'active' %> |
|
35 | <%= link_to '[View active users]', :action => 'active' %> |
|
36 | <%= link_to '[Mass mailing]', :action => 'mass_mailing' %> |
|
36 | <%= link_to '[Mass mailing]', :action => 'mass_mailing' %> |
|
37 | <% if GraderConfiguration.multicontests? %> |
|
37 | <% if GraderConfiguration.multicontests? %> |
|
38 | <br/><b>Multi-contest:</b> |
|
38 | <br/><b>Multi-contest:</b> |
|
39 | <%= link_to '[Manage bulk users in contests]', :action => 'contest_management' %> |
|
39 | <%= link_to '[Manage bulk users in contests]', :action => 'contest_management' %> |
|
40 | View users in: |
|
40 | View users in: |
|
41 | <% @contests.each do |contest| %> |
|
41 | <% @contests.each do |contest| %> |
|
42 | <%= link_to "[#{contest.name}]", :action => 'contests', :id => contest.id %> |
|
42 | <%= link_to "[#{contest.name}]", :action => 'contests', :id => contest.id %> |
|
43 | <% end %> |
|
43 | <% end %> |
|
44 | <%= link_to "[no contest]", :action => 'contests', :id => 'none' %> |
|
44 | <%= link_to "[no contest]", :action => 'contests', :id => 'none' %> |
|
45 | <% end %> |
|
45 | <% end %> |
|
46 | </div> |
|
46 | </div> |
|
47 |
|
47 | ||
|
48 | Total <%= @user_count %> users | |
|
48 | Total <%= @user_count %> users | |
|
49 | <% if !@paginated %> |
|
49 | <% if !@paginated %> |
|
50 | Display all users. |
|
50 | Display all users. |
|
51 | <%= link_to '[show in pages]', :action => 'list', :page => '1' %> |
|
51 | <%= link_to '[show in pages]', :action => 'list', :page => '1' %> |
|
52 | <% else %> |
|
52 | <% else %> |
|
53 | Display in pages. |
|
53 | Display in pages. |
|
54 | <%= link_to '[display all]', :action => 'list', :page => 'all' %> | |
|
54 | <%= link_to '[display all]', :action => 'list', :page => 'all' %> | |
|
55 | <%= will_paginate @users, :container => false %> |
|
55 | <%= will_paginate @users, :container => false %> |
|
56 | <% end %> |
|
56 | <% end %> |
|
57 | <table class="info"> |
|
57 | <table class="info"> |
|
58 | <tr class="info-head"> |
|
58 | <tr class="info-head"> |
|
59 | <% for column in User.content_columns %> |
|
59 | <% for column in User.content_columns %> |
|
60 | <% if !@hidden_columns.index(column.name) %> |
|
60 | <% if !@hidden_columns.index(column.name) %> |
|
61 | <th><%= column.human_name %></th> |
|
61 | <th><%= column.human_name %></th> |
|
62 | <% end %> |
|
62 | <% end %> |
|
63 | <% end %> |
|
63 | <% end %> |
|
64 | <th></th> |
|
64 | <th></th> |
|
65 | <th></th> |
|
65 | <th></th> |
|
66 | <th></th> |
|
66 | <th></th> |
|
|
67 | + <th></th> | ||
|
67 | </tr> |
|
68 | </tr> |
|
68 |
|
69 | ||
|
69 | <% for user in @users %> |
|
70 | <% for user in @users %> |
|
70 | <tr class="info-<%= cycle("odd","even") %>"> |
|
71 | <tr class="info-<%= cycle("odd","even") %>"> |
|
71 | <td><%= link_to user.login, controller: :users, :action => 'profile', :id => user %></td> |
|
72 | <td><%= link_to user.login, controller: :users, :action => 'profile', :id => user %></td> |
|
72 | <% for column in User.content_columns %> |
|
73 | <% for column in User.content_columns %> |
|
73 | <% if !@hidden_columns.index(column.name) and column.name != 'login' %> |
|
74 | <% if !@hidden_columns.index(column.name) and column.name != 'login' %> |
|
74 | <td><%=h user.send(column.name) %></td> |
|
75 | <td><%=h user.send(column.name) %></td> |
|
75 | <% end %> |
|
76 | <% end %> |
|
76 | <% end %> |
|
77 | <% end %> |
|
|
78 | + <td><%= link_to 'Clear IP', {:action => 'clear_last_ip', :id => user, :page=>params[:page]}, :confirm => 'This will reset last logging in ip of the user, are you sure?' %></td> | ||
|
77 | <td><%= link_to 'Show', :action => 'show', :id => user %></td> |
|
79 | <td><%= link_to 'Show', :action => 'show', :id => user %></td> |
|
78 | <td><%= link_to 'Edit', :action => 'edit', :id => user %></td> |
|
80 | <td><%= link_to 'Edit', :action => 'edit', :id => user %></td> |
|
79 | <td><%= link_to 'Destroy', { :action => 'destroy', :id => user }, :confirm => 'Are you sure?', :method => :post %></td> |
|
81 | <td><%= link_to 'Destroy', { :action => 'destroy', :id => user }, :confirm => 'Are you sure?', :method => :post %></td> |
|
80 | </tr> |
|
82 | </tr> |
|
81 | <% end %> |
|
83 | <% end %> |
|
82 | </table> |
|
84 | </table> |
|
83 |
|
85 | ||
|
84 | <br /> |
|
86 | <br /> |
|
85 |
|
87 | ||
|
86 | <%= link_to '[New user]', :action => 'new' %> |
|
88 | <%= link_to '[New user]', :action => 'new' %> |
|
87 | <%= link_to '[New list of users]', :action => 'new_list' %> |
|
89 | <%= link_to '[New list of users]', :action => 'new_list' %> |
@@ -1,264 +1,265 | |||||
|
1 | # encoding: UTF-8 |
|
1 | # encoding: UTF-8 |
|
2 | # This file is auto-generated from the current state of the database. Instead |
|
2 | # This file is auto-generated from the current state of the database. Instead |
|
3 | # of editing this file, please use the migrations feature of Active Record to |
|
3 | # of editing this file, please use the migrations feature of Active Record to |
|
4 | # incrementally modify your database, and then regenerate this schema definition. |
|
4 | # incrementally modify your database, and then regenerate this schema definition. |
|
5 | # |
|
5 | # |
|
6 | # Note that this schema.rb definition is the authoritative source for your |
|
6 | # Note that this schema.rb definition is the authoritative source for your |
|
7 | # database schema. If you need to create the application database on another |
|
7 | # database schema. If you need to create the application database on another |
|
8 | # system, you should be using db:schema:load, not running all the migrations |
|
8 | # system, you should be using db:schema:load, not running all the migrations |
|
9 | # from scratch. The latter is a flawed and unsustainable approach (the more migrations |
|
9 | # from scratch. The latter is a flawed and unsustainable approach (the more migrations |
|
10 | # you'll amass, the slower it'll run and the greater likelihood for issues). |
|
10 | # you'll amass, the slower it'll run and the greater likelihood for issues). |
|
11 | # |
|
11 | # |
|
12 | # It's strongly recommended to check this file into your version control system. |
|
12 | # It's strongly recommended to check this file into your version control system. |
|
13 |
|
13 | ||
|
14 |
- ActiveRecord::Schema.define(:version => 20150914 |
|
14 | + ActiveRecord::Schema.define(:version => 20150914155101) do |
|
15 |
|
15 | ||
|
16 | create_table "announcements", :force => true do |t| |
|
16 | create_table "announcements", :force => true do |t| |
|
17 | t.string "author" |
|
17 | t.string "author" |
|
18 | - t.text "body" |
|
18 | + t.text "body", :limit => 16777215 |
|
19 | t.boolean "published" |
|
19 | t.boolean "published" |
|
20 | t.datetime "created_at", :null => false |
|
20 | t.datetime "created_at", :null => false |
|
21 | t.datetime "updated_at", :null => false |
|
21 | t.datetime "updated_at", :null => false |
|
22 | t.boolean "frontpage", :default => false |
|
22 | t.boolean "frontpage", :default => false |
|
23 | t.boolean "contest_only", :default => false |
|
23 | t.boolean "contest_only", :default => false |
|
24 | t.string "title" |
|
24 | t.string "title" |
|
25 | t.string "notes" |
|
25 | t.string "notes" |
|
26 | end |
|
26 | end |
|
27 |
|
27 | ||
|
28 | create_table "contests", :force => true do |t| |
|
28 | create_table "contests", :force => true do |t| |
|
29 | t.string "title" |
|
29 | t.string "title" |
|
30 | t.boolean "enabled" |
|
30 | t.boolean "enabled" |
|
31 | t.datetime "created_at", :null => false |
|
31 | t.datetime "created_at", :null => false |
|
32 | t.datetime "updated_at", :null => false |
|
32 | t.datetime "updated_at", :null => false |
|
33 | t.string "name" |
|
33 | t.string "name" |
|
34 | end |
|
34 | end |
|
35 |
|
35 | ||
|
36 | create_table "contests_problems", :id => false, :force => true do |t| |
|
36 | create_table "contests_problems", :id => false, :force => true do |t| |
|
37 | t.integer "contest_id" |
|
37 | t.integer "contest_id" |
|
38 | t.integer "problem_id" |
|
38 | t.integer "problem_id" |
|
39 | end |
|
39 | end |
|
40 |
|
40 | ||
|
41 | create_table "contests_users", :id => false, :force => true do |t| |
|
41 | create_table "contests_users", :id => false, :force => true do |t| |
|
42 | t.integer "contest_id" |
|
42 | t.integer "contest_id" |
|
43 | t.integer "user_id" |
|
43 | t.integer "user_id" |
|
44 | end |
|
44 | end |
|
45 |
|
45 | ||
|
46 | create_table "countries", :force => true do |t| |
|
46 | create_table "countries", :force => true do |t| |
|
47 | t.string "name" |
|
47 | t.string "name" |
|
48 | t.datetime "created_at", :null => false |
|
48 | t.datetime "created_at", :null => false |
|
49 | t.datetime "updated_at", :null => false |
|
49 | t.datetime "updated_at", :null => false |
|
50 | end |
|
50 | end |
|
51 |
|
51 | ||
|
52 | create_table "descriptions", :force => true do |t| |
|
52 | create_table "descriptions", :force => true do |t| |
|
53 | - t.text "body" |
|
53 | + t.text "body", :limit => 16777215 |
|
54 | t.boolean "markdowned" |
|
54 | t.boolean "markdowned" |
|
55 | t.datetime "created_at", :null => false |
|
55 | t.datetime "created_at", :null => false |
|
56 | t.datetime "updated_at", :null => false |
|
56 | t.datetime "updated_at", :null => false |
|
57 | end |
|
57 | end |
|
58 |
|
58 | ||
|
59 | create_table "grader_configurations", :force => true do |t| |
|
59 | create_table "grader_configurations", :force => true do |t| |
|
60 | t.string "key" |
|
60 | t.string "key" |
|
61 | t.string "value_type" |
|
61 | t.string "value_type" |
|
62 | t.string "value" |
|
62 | t.string "value" |
|
63 | t.datetime "created_at", :null => false |
|
63 | t.datetime "created_at", :null => false |
|
64 | t.datetime "updated_at", :null => false |
|
64 | t.datetime "updated_at", :null => false |
|
65 | - t.text "description" |
|
65 | + t.text "description", :limit => 16777215 |
|
66 | end |
|
66 | end |
|
67 |
|
67 | ||
|
68 | create_table "grader_processes", :force => true do |t| |
|
68 | create_table "grader_processes", :force => true do |t| |
|
69 | t.string "host", :limit => 20 |
|
69 | t.string "host", :limit => 20 |
|
70 | t.integer "pid" |
|
70 | t.integer "pid" |
|
71 | t.string "mode" |
|
71 | t.string "mode" |
|
72 | t.boolean "active" |
|
72 | t.boolean "active" |
|
73 | t.datetime "created_at", :null => false |
|
73 | t.datetime "created_at", :null => false |
|
74 | t.datetime "updated_at", :null => false |
|
74 | t.datetime "updated_at", :null => false |
|
75 | t.integer "task_id" |
|
75 | t.integer "task_id" |
|
76 | t.string "task_type" |
|
76 | t.string "task_type" |
|
77 | t.boolean "terminated" |
|
77 | t.boolean "terminated" |
|
78 | end |
|
78 | end |
|
79 |
|
79 | ||
|
80 | add_index "grader_processes", ["host", "pid"], :name => "index_grader_processes_on_ip_and_pid" |
|
80 | add_index "grader_processes", ["host", "pid"], :name => "index_grader_processes_on_ip_and_pid" |
|
81 |
|
81 | ||
|
82 | create_table "heart_beats", :force => true do |t| |
|
82 | create_table "heart_beats", :force => true do |t| |
|
83 | t.integer "user_id" |
|
83 | t.integer "user_id" |
|
84 | t.string "ip_address" |
|
84 | t.string "ip_address" |
|
85 | t.datetime "created_at", :null => false |
|
85 | t.datetime "created_at", :null => false |
|
86 | t.datetime "updated_at", :null => false |
|
86 | t.datetime "updated_at", :null => false |
|
|
87 | + t.string "status" | ||
|
87 | end |
|
88 | end |
|
88 |
|
89 | ||
|
89 | create_table "languages", :force => true do |t| |
|
90 | create_table "languages", :force => true do |t| |
|
90 | t.string "name", :limit => 10 |
|
91 | t.string "name", :limit => 10 |
|
91 | t.string "pretty_name" |
|
92 | t.string "pretty_name" |
|
92 | t.string "ext", :limit => 10 |
|
93 | t.string "ext", :limit => 10 |
|
93 | t.string "common_ext" |
|
94 | t.string "common_ext" |
|
94 | end |
|
95 | end |
|
95 |
|
96 | ||
|
96 | create_table "logins", :force => true do |t| |
|
97 | create_table "logins", :force => true do |t| |
|
97 | t.integer "user_id" |
|
98 | t.integer "user_id" |
|
98 | t.string "ip_address" |
|
99 | t.string "ip_address" |
|
99 | t.datetime "created_at", :null => false |
|
100 | t.datetime "created_at", :null => false |
|
100 | t.datetime "updated_at", :null => false |
|
101 | t.datetime "updated_at", :null => false |
|
101 | end |
|
102 | end |
|
102 |
|
103 | ||
|
103 | create_table "messages", :force => true do |t| |
|
104 | create_table "messages", :force => true do |t| |
|
104 | t.integer "sender_id" |
|
105 | t.integer "sender_id" |
|
105 | t.integer "receiver_id" |
|
106 | t.integer "receiver_id" |
|
106 | t.integer "replying_message_id" |
|
107 | t.integer "replying_message_id" |
|
107 | - t.text "body" |
|
108 | + t.text "body", :limit => 16777215 |
|
108 | t.boolean "replied" |
|
109 | t.boolean "replied" |
|
109 | t.datetime "created_at", :null => false |
|
110 | t.datetime "created_at", :null => false |
|
110 | t.datetime "updated_at", :null => false |
|
111 | t.datetime "updated_at", :null => false |
|
111 | end |
|
112 | end |
|
112 |
|
113 | ||
|
113 | create_table "problems", :force => true do |t| |
|
114 | create_table "problems", :force => true do |t| |
|
114 | t.string "name", :limit => 30 |
|
115 | t.string "name", :limit => 30 |
|
115 | t.string "full_name" |
|
116 | t.string "full_name" |
|
116 | t.integer "full_score" |
|
117 | t.integer "full_score" |
|
117 | t.date "date_added" |
|
118 | t.date "date_added" |
|
118 | t.boolean "available" |
|
119 | t.boolean "available" |
|
119 | t.string "url" |
|
120 | t.string "url" |
|
120 | t.integer "description_id" |
|
121 | t.integer "description_id" |
|
121 | t.boolean "test_allowed" |
|
122 | t.boolean "test_allowed" |
|
122 | t.boolean "output_only" |
|
123 | t.boolean "output_only" |
|
123 | t.string "description_filename" |
|
124 | t.string "description_filename" |
|
124 | end |
|
125 | end |
|
125 |
|
126 | ||
|
126 | create_table "rights", :force => true do |t| |
|
127 | create_table "rights", :force => true do |t| |
|
127 | t.string "name" |
|
128 | t.string "name" |
|
128 | t.string "controller" |
|
129 | t.string "controller" |
|
129 | t.string "action" |
|
130 | t.string "action" |
|
130 | end |
|
131 | end |
|
131 |
|
132 | ||
|
132 | create_table "rights_roles", :id => false, :force => true do |t| |
|
133 | create_table "rights_roles", :id => false, :force => true do |t| |
|
133 | t.integer "right_id" |
|
134 | t.integer "right_id" |
|
134 | t.integer "role_id" |
|
135 | t.integer "role_id" |
|
135 | end |
|
136 | end |
|
136 |
|
137 | ||
|
137 | add_index "rights_roles", ["role_id"], :name => "index_rights_roles_on_role_id" |
|
138 | add_index "rights_roles", ["role_id"], :name => "index_rights_roles_on_role_id" |
|
138 |
|
139 | ||
|
139 | create_table "roles", :force => true do |t| |
|
140 | create_table "roles", :force => true do |t| |
|
140 | t.string "name" |
|
141 | t.string "name" |
|
141 | end |
|
142 | end |
|
142 |
|
143 | ||
|
143 | create_table "roles_users", :id => false, :force => true do |t| |
|
144 | create_table "roles_users", :id => false, :force => true do |t| |
|
144 | t.integer "role_id" |
|
145 | t.integer "role_id" |
|
145 | t.integer "user_id" |
|
146 | t.integer "user_id" |
|
146 | end |
|
147 | end |
|
147 |
|
148 | ||
|
148 | add_index "roles_users", ["user_id"], :name => "index_roles_users_on_user_id" |
|
149 | add_index "roles_users", ["user_id"], :name => "index_roles_users_on_user_id" |
|
149 |
|
150 | ||
|
150 | create_table "sessions", :force => true do |t| |
|
151 | create_table "sessions", :force => true do |t| |
|
151 | t.string "session_id" |
|
152 | t.string "session_id" |
|
152 | - t.text "data" |
|
153 | + t.text "data", :limit => 16777215 |
|
153 | t.datetime "updated_at" |
|
154 | t.datetime "updated_at" |
|
154 | end |
|
155 | end |
|
155 |
|
156 | ||
|
156 | add_index "sessions", ["session_id"], :name => "index_sessions_on_session_id" |
|
157 | add_index "sessions", ["session_id"], :name => "index_sessions_on_session_id" |
|
157 | add_index "sessions", ["updated_at"], :name => "index_sessions_on_updated_at" |
|
158 | add_index "sessions", ["updated_at"], :name => "index_sessions_on_updated_at" |
|
158 |
|
159 | ||
|
159 | create_table "sites", :force => true do |t| |
|
160 | create_table "sites", :force => true do |t| |
|
160 | t.string "name" |
|
161 | t.string "name" |
|
161 | t.boolean "started" |
|
162 | t.boolean "started" |
|
162 | t.datetime "start_time" |
|
163 | t.datetime "start_time" |
|
163 | t.datetime "created_at", :null => false |
|
164 | t.datetime "created_at", :null => false |
|
164 | t.datetime "updated_at", :null => false |
|
165 | t.datetime "updated_at", :null => false |
|
165 | t.integer "country_id" |
|
166 | t.integer "country_id" |
|
166 | t.string "password" |
|
167 | t.string "password" |
|
167 | end |
|
168 | end |
|
168 |
|
169 | ||
|
169 | create_table "submission_view_logs", :force => true do |t| |
|
170 | create_table "submission_view_logs", :force => true do |t| |
|
170 | t.integer "user_id" |
|
171 | t.integer "user_id" |
|
171 | t.integer "submission_id" |
|
172 | t.integer "submission_id" |
|
172 | t.datetime "created_at", :null => false |
|
173 | t.datetime "created_at", :null => false |
|
173 | t.datetime "updated_at", :null => false |
|
174 | t.datetime "updated_at", :null => false |
|
174 | end |
|
175 | end |
|
175 |
|
176 | ||
|
176 | create_table "submissions", :force => true do |t| |
|
177 | create_table "submissions", :force => true do |t| |
|
177 | t.integer "user_id" |
|
178 | t.integer "user_id" |
|
178 | t.integer "problem_id" |
|
179 | t.integer "problem_id" |
|
179 | t.integer "language_id" |
|
180 | t.integer "language_id" |
|
180 | - t.text "source" |
|
181 | + t.text "source", :limit => 16777215 |
|
181 | t.binary "binary" |
|
182 | t.binary "binary" |
|
182 | t.datetime "submitted_at" |
|
183 | t.datetime "submitted_at" |
|
183 | t.datetime "compiled_at" |
|
184 | t.datetime "compiled_at" |
|
184 | - t.text "compiler_message" |
|
185 | + t.text "compiler_message", :limit => 16777215 |
|
185 | t.datetime "graded_at" |
|
186 | t.datetime "graded_at" |
|
186 | t.integer "points" |
|
187 | t.integer "points" |
|
187 | - t.text "grader_comment" |
|
188 | + t.text "grader_comment", :limit => 16777215 |
|
188 | t.integer "number" |
|
189 | t.integer "number" |
|
189 | t.string "source_filename" |
|
190 | t.string "source_filename" |
|
190 | t.float "max_runtime" |
|
191 | t.float "max_runtime" |
|
191 | t.integer "peak_memory" |
|
192 | t.integer "peak_memory" |
|
192 | t.integer "effective_code_length" |
|
193 | t.integer "effective_code_length" |
|
193 | t.string "ip_address" |
|
194 | t.string "ip_address" |
|
194 | end |
|
195 | end |
|
195 |
|
196 | ||
|
196 | add_index "submissions", ["user_id", "problem_id", "number"], :name => "index_submissions_on_user_id_and_problem_id_and_number", :unique => true |
|
197 | add_index "submissions", ["user_id", "problem_id", "number"], :name => "index_submissions_on_user_id_and_problem_id_and_number", :unique => true |
|
197 | add_index "submissions", ["user_id", "problem_id"], :name => "index_submissions_on_user_id_and_problem_id" |
|
198 | add_index "submissions", ["user_id", "problem_id"], :name => "index_submissions_on_user_id_and_problem_id" |
|
198 |
|
199 | ||
|
199 | create_table "tasks", :force => true do |t| |
|
200 | create_table "tasks", :force => true do |t| |
|
200 | t.integer "submission_id" |
|
201 | t.integer "submission_id" |
|
201 | t.datetime "created_at" |
|
202 | t.datetime "created_at" |
|
202 | t.integer "status" |
|
203 | t.integer "status" |
|
203 | t.datetime "updated_at" |
|
204 | t.datetime "updated_at" |
|
204 | end |
|
205 | end |
|
205 |
|
206 | ||
|
206 | create_table "test_pairs", :force => true do |t| |
|
207 | create_table "test_pairs", :force => true do |t| |
|
207 | t.integer "problem_id" |
|
208 | t.integer "problem_id" |
|
208 |
- t.text "input", :limit => |
|
209 | + t.text "input", :limit => 2147483647 |
|
209 |
- t.text "solution", :limit => |
|
210 | + t.text "solution", :limit => 2147483647 |
|
210 | t.datetime "created_at", :null => false |
|
211 | t.datetime "created_at", :null => false |
|
211 | t.datetime "updated_at", :null => false |
|
212 | t.datetime "updated_at", :null => false |
|
212 | end |
|
213 | end |
|
213 |
|
214 | ||
|
214 | create_table "test_requests", :force => true do |t| |
|
215 | create_table "test_requests", :force => true do |t| |
|
215 | t.integer "user_id" |
|
216 | t.integer "user_id" |
|
216 | t.integer "problem_id" |
|
217 | t.integer "problem_id" |
|
217 | t.integer "submission_id" |
|
218 | t.integer "submission_id" |
|
218 | t.string "input_file_name" |
|
219 | t.string "input_file_name" |
|
219 | t.string "output_file_name" |
|
220 | t.string "output_file_name" |
|
220 | t.string "running_stat" |
|
221 | t.string "running_stat" |
|
221 | t.integer "status" |
|
222 | t.integer "status" |
|
222 | t.datetime "updated_at", :null => false |
|
223 | t.datetime "updated_at", :null => false |
|
223 | t.datetime "submitted_at" |
|
224 | t.datetime "submitted_at" |
|
224 | t.datetime "compiled_at" |
|
225 | t.datetime "compiled_at" |
|
225 | - t.text "compiler_message" |
|
226 | + t.text "compiler_message", :limit => 16777215 |
|
226 | t.datetime "graded_at" |
|
227 | t.datetime "graded_at" |
|
227 | t.string "grader_comment" |
|
228 | t.string "grader_comment" |
|
228 | t.datetime "created_at", :null => false |
|
229 | t.datetime "created_at", :null => false |
|
229 | t.float "running_time" |
|
230 | t.float "running_time" |
|
230 | t.string "exit_status" |
|
231 | t.string "exit_status" |
|
231 | t.integer "memory_usage" |
|
232 | t.integer "memory_usage" |
|
232 | end |
|
233 | end |
|
233 |
|
234 | ||
|
234 | add_index "test_requests", ["user_id", "problem_id"], :name => "index_test_requests_on_user_id_and_problem_id" |
|
235 | add_index "test_requests", ["user_id", "problem_id"], :name => "index_test_requests_on_user_id_and_problem_id" |
|
235 |
|
236 | ||
|
236 | create_table "user_contest_stats", :force => true do |t| |
|
237 | create_table "user_contest_stats", :force => true do |t| |
|
237 | t.integer "user_id" |
|
238 | t.integer "user_id" |
|
238 | t.datetime "started_at" |
|
239 | t.datetime "started_at" |
|
239 | t.datetime "created_at", :null => false |
|
240 | t.datetime "created_at", :null => false |
|
240 | t.datetime "updated_at", :null => false |
|
241 | t.datetime "updated_at", :null => false |
|
241 | t.boolean "forced_logout" |
|
242 | t.boolean "forced_logout" |
|
242 | end |
|
243 | end |
|
243 |
|
244 | ||
|
244 | create_table "users", :force => true do |t| |
|
245 | create_table "users", :force => true do |t| |
|
245 | t.string "login", :limit => 50 |
|
246 | t.string "login", :limit => 50 |
|
246 | t.string "full_name" |
|
247 | t.string "full_name" |
|
247 | t.string "hashed_password" |
|
248 | t.string "hashed_password" |
|
248 | t.string "salt", :limit => 5 |
|
249 | t.string "salt", :limit => 5 |
|
249 | t.string "alias" |
|
250 | t.string "alias" |
|
250 | t.string "email" |
|
251 | t.string "email" |
|
251 | t.integer "site_id" |
|
252 | t.integer "site_id" |
|
252 | t.integer "country_id" |
|
253 | t.integer "country_id" |
|
253 | t.boolean "activated", :default => false |
|
254 | t.boolean "activated", :default => false |
|
254 | t.datetime "created_at" |
|
255 | t.datetime "created_at" |
|
255 | t.datetime "updated_at" |
|
256 | t.datetime "updated_at" |
|
|
257 | + t.string "section" | ||
|
256 | t.boolean "enabled", :default => true |
|
258 | t.boolean "enabled", :default => true |
|
257 | t.string "remark" |
|
259 | t.string "remark" |
|
258 | t.string "last_ip" |
|
260 | t.string "last_ip" |
|
259 | - t.string "section" |
|
||
|
260 | end |
|
261 | end |
|
261 |
|
262 | ||
|
262 | add_index "users", ["login"], :name => "index_users_on_login", :unique => true |
|
263 | add_index "users", ["login"], :name => "index_users_on_login", :unique => true |
|
263 |
|
264 | ||
|
264 | end |
|
265 | end |
deleted file |
You need to be logged in to leave comments.
Login now