Description:
fixed seed.db for mock valid?
Commit status:
[Not Reviewed]
References:
Diff options:
Comments:
0 Commit comments
0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
r333:6abae4dc17ba - - 1 file changed: 1 inserted, 1 deleted
@@ -155,44 +155,44 | |||||
|
155 | problem_admin_right = Right.create(:name=> 'problem_admin', |
|
155 | problem_admin_right = Right.create(:name=> 'problem_admin', |
|
156 | :controller => 'problems', |
|
156 | :controller => 'problems', |
|
157 | :action => 'all') |
|
157 | :action => 'all') |
|
158 |
|
158 | ||
|
159 | graders_right = Right.create(:name => 'graders_admin', |
|
159 | graders_right = Right.create(:name => 'graders_admin', |
|
160 | :controller => 'graders', |
|
160 | :controller => 'graders', |
|
161 | :action => 'all') |
|
161 | :action => 'all') |
|
162 |
|
162 | ||
|
163 | role.rights << user_admin_right; |
|
163 | role.rights << user_admin_right; |
|
164 | role.rights << problem_admin_right; |
|
164 | role.rights << problem_admin_right; |
|
165 | role.rights << graders_right; |
|
165 | role.rights << graders_right; |
|
166 | role.save |
|
166 | role.save |
|
167 | end |
|
167 | end |
|
168 |
|
168 | ||
|
169 | def seed_root |
|
169 | def seed_root |
|
170 | return if User.find_by_login('root') |
|
170 | return if User.find_by_login('root') |
|
171 |
|
171 | ||
|
172 | root = User.new(:login => 'root', |
|
172 | root = User.new(:login => 'root', |
|
173 | :full_name => 'Administrator', |
|
173 | :full_name => 'Administrator', |
|
174 | :alias => 'root') |
|
174 | :alias => 'root') |
|
175 | root.password = 'ioionrails'; |
|
175 | root.password = 'ioionrails'; |
|
176 |
|
176 | ||
|
177 | class << root |
|
177 | class << root |
|
178 | public :encrypt_new_password |
|
178 | public :encrypt_new_password |
|
179 | - def valid? |
|
179 | + def valid?(context=nil) |
|
180 | true |
|
180 | true |
|
181 | end |
|
181 | end |
|
182 | end |
|
182 | end |
|
183 |
|
183 | ||
|
184 | root.encrypt_new_password |
|
184 | root.encrypt_new_password |
|
185 |
|
185 | ||
|
186 | root.roles << Role.find_by_name('admin') |
|
186 | root.roles << Role.find_by_name('admin') |
|
187 |
|
187 | ||
|
188 | root.activated = true |
|
188 | root.activated = true |
|
189 | root.save |
|
189 | root.save |
|
190 | end |
|
190 | end |
|
191 |
|
191 | ||
|
192 | def seed_users_and_roles |
|
192 | def seed_users_and_roles |
|
193 | seed_roles |
|
193 | seed_roles |
|
194 | seed_root |
|
194 | seed_root |
|
195 | end |
|
195 | end |
|
196 |
|
196 | ||
|
197 | seed_config |
|
197 | seed_config |
|
198 | seed_users_and_roles |
|
198 | seed_users_and_roles |
You need to be logged in to leave comments.
Login now