| 1 | ################################################################################ |
1 | ################################################################################ |
| 2 | # WeBWorK Online Homework Delivery System |
2 | # WeBWorK Online Homework Delivery System |
| 3 | # Copyright © 2000-2007 The WeBWorK Project, http://openwebwork.sf.net/ |
3 | # Copyright © 2000-2007 The WeBWorK Project, http://openwebwork.sf.net/ |
| 4 | # $CVSHeader: webwork2/lib/WeBWorK/ContentGenerator/Problem.pm,v 1.222 2010/05/15 18:22:35 gage Exp $ |
4 | # $CVSHeader: webwork2/lib/WeBWorK/ContentGenerator/Problem.pm,v 1.223 2010/05/25 18:22:12 gage Exp $ |
| 5 | # |
5 | # |
| 6 | # This program is free software; you can redistribute it and/or modify it under |
6 | # This program is free software; you can redistribute it and/or modify it under |
| 7 | # the terms of either: (a) the GNU General Public License as published by the |
7 | # the terms of either: (a) the GNU General Public License as published by the |
| 8 | # Free Software Foundation; either version 2, or (at your option) any later |
8 | # Free Software Foundation; either version 2, or (at your option) any later |
| 9 | # version, or (b) the "Artistic License" which comes with this package. |
9 | # version, or (b) the "Artistic License" which comes with this package. |
| … | |
… | |
| 1129 | -value => $self->{editMode}, |
1129 | -value => $self->{editMode}, |
| 1130 | ) |
1130 | ) |
| 1131 | ) if defined($self->{editMode}) and $self->{editMode} eq 'temporaryFile'; |
1131 | ) if defined($self->{editMode}) and $self->{editMode} eq 'temporaryFile'; |
| 1132 | |
1132 | |
| 1133 | # this is a security risk -- students can use this to find the source code for the problem |
1133 | # this is a security risk -- students can use this to find the source code for the problem |
|
|
1134 | |
| 1134 | my $permissionLevel = $db->getPermissionLevel($user)->permission; |
1135 | my $permissionLevel = $db->getPermissionLevel($user)->permission; |
| 1135 | my $professorPermissionLevel = $ce->{userRoles}->{professor}; |
1136 | my $professorPermissionLevel = $ce->{userRoles}->{professor}; |
| 1136 | warn "checking permssionlevel", $permissionLevel>= $professorPermissionLevel; |
|
|
| 1137 | print( CGI::hidden( |
1137 | print( CGI::hidden( |
| 1138 | -name => 'sourceFilePath', |
1138 | -name => 'sourceFilePath', |
| 1139 | -value => $self->{problem}->{source_file} |
1139 | -value => $self->{problem}->{source_file} |
| 1140 | )) if defined($self->{problem}->{source_file}) and $permissionLevel>= $professorPermissionLevel; # only allow this for professors |
1140 | )) if defined($self->{problem}->{source_file}) and $permissionLevel>= $professorPermissionLevel; # only allow this for professors |
| 1141 | |
1141 | |
| 1142 | print( CGI::hidden( |
1142 | print( CGI::hidden( |
| 1143 | -name => 'problemSeed', |
1143 | -name => 'problemSeed', |
| 1144 | -value => $r->param("problemSeed") |
1144 | -value => $r->param("problemSeed") |
| 1145 | )) if defined($r->param("problemSeed")) and $permissionLevel>= $professorPermissionLevel; # only allow this for professors |
1145 | )) if defined($r->param("problemSeed")) and $permissionLevel>= $professorPermissionLevel; # only allow this for professors |
|
|
1146 | |
| 1146 | |
1147 | |
| 1147 | # end of main form |
1148 | # end of main form |
| 1148 | print CGI::endform(); |
1149 | print CGI::endform(); |
| 1149 | |
1150 | |
| 1150 | print CGI::start_div({class=>"problemFooter"}); |
1151 | print CGI::start_div({class=>"problemFooter"}); |