Skip to content

Commit c253294

Browse files
committed
Remove PRINT_FILE_NAMES_FOR and PRINT_FILE_NAMES_PERMISSION_LEVEL
1 parent 983c1c6 commit c253294

8 files changed

Lines changed: 9 additions & 64 deletions

File tree

conf/defaults.config

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -797,7 +797,7 @@ $authen{admin_module} = ['WeBWorK::Authen::Basic_TheLastOption'];
797797
can_check_and_submit_answers => "ta",
798798
can_use_show_me_another_early => "ta",
799799
create_new_set_version_when_acting_as_student => undef,
800-
print_path_to_problem => "professor", # see "Special" PG environment variables
800+
print_path_to_problem => "professor",
801801
always_show_hint => "professor",
802802
always_show_solution => "professor",
803803
record_set_version_answers_when_acting_as_student => undef,
@@ -1175,13 +1175,6 @@ $pg{URLs}{localHelpURL} = "$pg_htdocs_url/helpFiles";
11751175

11761176
##### "Special" PG environment variables. (Stuff that doesn't fit in anywhere else.)
11771177

1178-
# Users for whom to print the file name of the PG file being processed.
1179-
$pg{specialPGEnvironmentVars}{PRINT_FILE_NAMES_FOR} = [ "professor", ];
1180-
1181-
# File names are also printed for anyone with this permission or higher
1182-
$pg{specialPGEnvironmentVars}{PRINT_FILE_NAMES_PERMISSION_LEVEL} =
1183-
$userRoles{ $permissionLevels{print_path_to_problem} };
1184-
11851178
# whether to use javascript for rendering Live3D graphs
11861179
$pg{specialPGEnvironmentVars}{use_javascript_for_live3d} = 1;
11871180

courses.dist/modelCourse/course.conf

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,6 @@
22

33
# This file is used to override the global WeBWorK course environment for this course.
44

5-
# Users for whom to label problems with the PG file name (global value typically "professor")
6-
# For users in this list, PG will display the source file name when rendering a problem.
7-
# defaults.config values:
8-
# $pg{specialPGEnvironmentVars}{PRINT_FILE_NAMES_FOR} = ['professor'];
9-
$pg{specialPGEnvironmentVars}{PRINT_FILE_NAMES_FOR} = ['admin'];
10-
115
# The following hashes control which users are allowed to see students from which
126
# sections. This is typically used for large multi-section classes with many students, ta's and
137
# professors. When set users will only be allowed to see students from the appropriate section in the following:

lib/WeBWorK/ContentGenerator/CourseAdmin.pm

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -376,9 +376,6 @@ sub do_add_course ($c) {
376376
}
377377
}
378378

379-
push @{ $courseOptions{PRINT_FILE_NAMES_FOR} },
380-
map { $_->[0]->user_id } grep { $_->[2]->permission >= $ce->{userRoles}{professor} } @users;
381-
382379
# Include any optional arguments, including a template course and the course title and course institution.
383380
my %optional_arguments;
384381
if ($copy_from_course ne '') {

lib/WeBWorK/ContentGenerator/Hardcopy.pm

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -118,10 +118,7 @@ async sub pre_header_initialize ($c) {
118118
die 'Parameter "user" not defined -- this should never happen' unless defined $userID;
119119

120120
# Check to see if the user is authorized to view source file paths.
121-
$c->{can_show_source_file} =
122-
($db->getPermissionLevel($userID)->permission >=
123-
$ce->{pg}{specialPGEnvironmentVars}{PRINT_FILE_NAMES_PERMISSION_LEVEL})
124-
|| (grep { $_ eq $userID } @{ $ce->{pg}{specialPGEnvironmentVars}{PRINT_FILE_NAMES_FOR} });
121+
$c->{can_show_source_file} = $authz->hasPermissions($userID, 'print_path_to_problem');
125122

126123
if ($generate_hardcopy) {
127124
my $validation_failed = 0;
@@ -996,7 +993,8 @@ async sub write_set_tex ($c, $FH, $TargetUser, $themeTree, $setID) {
996993
{
997994
print $FH '\\def\\webworkReducedScoringDate{'
998995
. ($c->formatDateTime($MergedSet->{reduced_scoring_date}, $ce->{studentDateDisplayFormat}) =~
999-
s/\x{202f}/ /gr) . "}%\n";
996+
s/\x{202f}/ /gr)
997+
. "}%\n";
1000998
}
1001999

10021000
# write set header (theme presetheader, then PG header, then theme postsetheader)
@@ -1169,10 +1167,10 @@ async sub write_problem_tex ($c, $FH, $TargetUser, $MergedSet, $themeTree, $prob
11691167
problemID => $MergedProblem->problem_id,
11701168
),
11711169
$MergedProblem->problem_id == 0
1172-
# link for a fake problem (like a header file)
1170+
# link for a fake problem (like a header file)
11731171
? (params =>
11741172
{ sourceFilePath => $MergedProblem->source_file, problemSeed => $MergedProblem->problem_seed })
1175-
# link for a real problem
1173+
# link for a real problem
11761174
: (),
11771175
);
11781176

lib/WeBWorK/ContentGenerator/Problem.pm

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -906,10 +906,7 @@ sub page_title ($c) {
906906

907907
# This uses the permission level and user id of the user assigned to the problem.
908908
my $problemUser = $problem->user_id;
909-
my $inList = grep { $_ eq $problemUser } @{ $ce->{pg}{specialPGEnvironmentVars}{PRINT_FILE_NAMES_FOR} };
910-
if ($db->getPermissionLevel($problemUser)->permission >=
911-
$ce->{pg}{specialPGEnvironmentVars}{PRINT_FILE_NAMES_PERMISSION_LEVEL} || $inList)
912-
{
909+
if ($c->authz->hasPermissions($problemUser, 'print_path_to_problem')) {
913910
$subheader .= ' ' . $problem->source_file;
914911
}
915912

lib/WeBWorK/ContentGenerator/ShowMeAnother.pm

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -252,10 +252,7 @@ sub page_title ($c) {
252252

253253
# This uses the permission level and user id of the user assigned to the problem.
254254
my $problemUser = $problem->user_id;
255-
if ($c->db->getPermissionLevel($problemUser)->permission >=
256-
$ce->{pg}{specialPGEnvironmentVars}{PRINT_FILE_NAMES_PERMISSION_LEVEL}
257-
|| grep { $_ eq $problemUser } @{ $ce->{pg}{specialPGEnvironmentVars}{PRINT_FILE_NAMES_FOR} })
258-
{
255+
if ($c->authz->hasPermissions($problemUser, 'print_path_to_problem')) {
259256
$subheader .= ' ' . $problem->source_file;
260257
}
261258

lib/WeBWorK/Utils/CourseManagement.pm

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -152,10 +152,6 @@ environment.
152152
153153
$courseOptions is a reference to a hash containing the following options:
154154
155-
PRINT_FILE_NAMES_FOR => $pg{specialPGEnvironmentVars}{PRINT_FILE_NAMES_FOR}
156-
157-
C<PRINT_FILE_NAMES_FOR> is a reference to an array.
158-
159155
$users is a list of arrayrefs, each containing a User, Password, and
160156
PermissionLevel record for a single user:
161157
@@ -1199,26 +1195,6 @@ sub writeCourseConf {
11991195
# This file is used to override the global WeBWorK course environment for this course.
12001196
12011197
EOF
1202-
1203-
print $fh <<'EOF';
1204-
# Users for whom to label problems with the PG file name (global value typically "professor")
1205-
# For users in this list, PG will display the source file name when rendering a problem.
1206-
# defaults.config values:
1207-
EOF
1208-
1209-
if (defined $ce->{pg}{specialPGEnvironmentVars}{PRINT_FILE_NAMES_FOR}) {
1210-
print $fh "# \t", '$pg{specialPGEnvironmentVars}{PRINT_FILE_NAMES_FOR} = [',
1211-
join(", ",
1212-
map { "'" . protectQString($_) . "'" } @{ $ce->{pg}{specialPGEnvironmentVars}{PRINT_FILE_NAMES_FOR} }),
1213-
'];', "\n";
1214-
} else {
1215-
print $fh "# \t", '$pg{specialPGEnvironmentVars}{PRINT_FILE_NAMES_FOR} = [ ];', "\n";
1216-
}
1217-
1218-
if (defined $options{PRINT_FILE_NAMES_FOR}) {
1219-
print $fh '$pg{specialPGEnvironmentVars}{PRINT_FILE_NAMES_FOR} = [',
1220-
join(", ", map { "'" . protectQString($_) . "'" } @{ $options{PRINT_FILE_NAMES_FOR} }), '];', "\n";
1221-
}
12221198
}
12231199

12241200
sub get_SeedCE

templates/ContentGenerator/GatewayQuiz.html.ep

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -574,14 +574,7 @@
574574
% }
575575
%
576576
% # This uses the permission level and user id of the user assigned to the set.
577-
% if (
578-
% $db->getPermissionLevel($effectiveUserID)->permission >=
579-
% $ce->{pg}{specialPGEnvironmentVars}{PRINT_FILE_NAMES_PERMISSION_LEVEL}
580-
% || (
581-
% grep { $_ eq $effectiveUserID }
582-
% @{ $ce->{pg}{specialPGEnvironmentVars}{PRINT_FILE_NAMES_FOR} }
583-
% )
584-
% )
577+
% if ( $authz->hasPermissions($effectiveUserID, 'print_path_to_problem') )
585578
% {
586579
<%= $problems->[ $probOrder->[$i] ]->source_file %>
587580
% }

0 commit comments

Comments
 (0)