| … | |
… | |
| 166 | push @error, E_ONE_USER unless $nusers == 1; |
166 | push @error, E_ONE_USER unless $nusers == 1; |
| 167 | push @error, E_MAX_ONE_SET unless $nsets <= 1; |
167 | push @error, E_MAX_ONE_SET unless $nsets <= 1; |
| 168 | } |
168 | } |
| 169 | }; |
169 | }; |
| 170 | |
170 | |
| 171 | defined param $r "edit_set_for_user" and do { |
171 | defined param $r "add_users" and do { |
| 172 | if ($nusers == 1 and $nsets == 1) { |
172 | $module = "${ipfx}::AddUsers"; |
| 173 | $module = "${ipfx}::ProblemSetEditor"; |
173 | |
| 174 | $args{setID} = $firstSetID; |
|
|
| 175 | $params{editForUser} = $firstUserID; |
|
|
| 176 | } else { |
|
|
| 177 | push @error, E_ONE_USER unless $nusers == 1; |
|
|
| 178 | push @error, E_ONE_SET unless $nsets == 1; |
|
|
| 179 | |
|
|
| 180 | } |
|
|
| 181 | }; |
174 | }; |
| 182 | |
175 | |
| 183 | push @error, "You are not allowed to act as a student." |
176 | push @error, "You are not allowed to act as a student." |
| 184 | if (defined param $r "act_as_user" and not $authz->hasPermissions($userID, "become_student")); |
177 | if (defined param $r "act_as_user" and not $authz->hasPermissions($userID, "become_student")); |
| 185 | push @error, "You are not allowed to modify problem sets." |
178 | push @error, "You are not allowed to modify problem sets." |
| 186 | if ((defined param $r "edit_sets" or defined param $r "edit_set_for_user") and not $authz->hasPermissions($userID, "modify_problem_sets")); |
179 | if ((defined param $r "edit_sets" or defined param $r "edit_set_for_user") and not $authz->hasPermissions($userID, "modify_problem_sets")); |
| 187 | push @error, "You are not allowed to assign problem sets." |
180 | push @error, "You are not allowed to assign problem sets." |
| 188 | if ((defined param $r "sets_assigned_to_user" or defined param $r "users_assigned_to_set") and not $authz->hasPermissions($userID, "assign_problem_sets")); |
181 | if ((defined param $r "sets_assigned_to_user" or defined param $r "users_assigned_to_set") and not $authz->hasPermissions($userID, "assign_problem_sets")); |
| 189 | push @error, "You are not allowed to modify student data." |
182 | push @error, "You are not allowed to modify student data." |
| 190 | if ((defined param $r "edit_users" or defined param $r "user_options") and not $authz->hasPermissions($userID, "modify_student_data")); |
183 | if ((defined param $r "edit_users" or defined param $r "user_options" or defined param $r "user_options") and not $authz->hasPermissions($userID, "modify_student_data")); |
| 191 | push @error, "You are not allowed to score sets." |
184 | push @error, "You are not allowed to score sets." |
| 192 | if (defined param $r "score_sets" and not $authz->hasPermissions($userID, "score_sets")); |
185 | if (defined param $r "score_sets" and not $authz->hasPermissions($userID, "score_sets")); |
| 193 | |
186 | |
| 194 | # handle errors, redirect to target page |
187 | # handle errors, redirect to target page |
| 195 | if (@error) { |
188 | if (@error) { |
| … | |
… | |
| 312 | ), |
305 | ), |
| 313 | CGI::td({colspan=>2,style=>'text-align:center'}, |
306 | CGI::td({colspan=>2,style=>'text-align:center'}, |
| 314 | CGI::submit("edit_set_for_user", "Edit"). " one <b>set</b> for one <b>user</b>", |
307 | CGI::submit("edit_set_for_user", "Edit"). " one <b>set</b> for one <b>user</b>", |
| 315 | ), |
308 | ), |
| 316 | CGI::td({colspan=>2,style=>'text-align:center'}, |
309 | CGI::td({colspan=>2,style=>'text-align:center'}, |
| 317 | CGI::a({href=>"http://webwork3.math.rochester.edu:11002/webwork2/$courseName/instructor/add_users?".$self->url_authen_args}, |
310 | CGI::submit("add_users", "Add"). " new users.", |
| 318 | "Add users", |
|
|
| 319 | ), |
|
|
| 320 | ), |
311 | ), |
|
|
312 | |
| 321 | ]), |
313 | ]), |
| 322 | ); |
314 | ); |
| 323 | |
315 | |
| 324 | print CGI::end_form(); |
316 | print CGI::end_form(); |
| 325 | |
317 | |