Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 1 addition & 8 deletions conf/defaults.config
Original file line number Diff line number Diff line change
Expand Up @@ -797,7 +797,7 @@ $authen{admin_module} = ['WeBWorK::Authen::Basic_TheLastOption'];
can_check_and_submit_answers => "ta",
can_use_show_me_another_early => "ta",
create_new_set_version_when_acting_as_student => undef,
print_path_to_problem => "professor", # see "Special" PG environment variables
print_path_to_problem => "professor",
always_show_hint => "professor",
always_show_solution => "professor",
record_set_version_answers_when_acting_as_student => undef,
Expand Down Expand Up @@ -1175,13 +1175,6 @@ $pg{URLs}{localHelpURL} = "$pg_htdocs_url/helpFiles";

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

# Users for whom to print the file name of the PG file being processed.
$pg{specialPGEnvironmentVars}{PRINT_FILE_NAMES_FOR} = [ "professor", ];

# File names are also printed for anyone with this permission or higher
$pg{specialPGEnvironmentVars}{PRINT_FILE_NAMES_PERMISSION_LEVEL} =
$userRoles{ $permissionLevels{print_path_to_problem} };

# whether to use javascript for rendering Live3D graphs
$pg{specialPGEnvironmentVars}{use_javascript_for_live3d} = 1;

Expand Down
6 changes: 0 additions & 6 deletions courses.dist/modelCourse/course.conf
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,6 @@

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

# Users for whom to label problems with the PG file name (global value typically "professor")
# For users in this list, PG will display the source file name when rendering a problem.
# defaults.config values:
# $pg{specialPGEnvironmentVars}{PRINT_FILE_NAMES_FOR} = ['professor'];
$pg{specialPGEnvironmentVars}{PRINT_FILE_NAMES_FOR} = ['admin'];

# The following hashes control which users are allowed to see students from which
# sections. This is typically used for large multi-section classes with many students, ta's and
# professors. When set users will only be allowed to see students from the appropriate section in the following:
Expand Down
3 changes: 0 additions & 3 deletions lib/WeBWorK/ContentGenerator/CourseAdmin.pm
Original file line number Diff line number Diff line change
Expand Up @@ -376,9 +376,6 @@ sub do_add_course ($c) {
}
}

push @{ $courseOptions{PRINT_FILE_NAMES_FOR} },
map { $_->[0]->user_id } grep { $_->[2]->permission >= $ce->{userRoles}{professor} } @users;

# Include any optional arguments, including a template course and the course title and course institution.
my %optional_arguments;
if ($copy_from_course ne '') {
Expand Down
5 changes: 1 addition & 4 deletions lib/WeBWorK/ContentGenerator/Hardcopy.pm
Original file line number Diff line number Diff line change
Expand Up @@ -118,10 +118,7 @@ async sub pre_header_initialize ($c) {
die 'Parameter "user" not defined -- this should never happen' unless defined $userID;

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

if ($generate_hardcopy) {
my $validation_failed = 0;
Expand Down
5 changes: 1 addition & 4 deletions lib/WeBWorK/ContentGenerator/Problem.pm
Original file line number Diff line number Diff line change
Expand Up @@ -906,10 +906,7 @@ sub page_title ($c) {

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

Expand Down
5 changes: 1 addition & 4 deletions lib/WeBWorK/ContentGenerator/ShowMeAnother.pm
Original file line number Diff line number Diff line change
Expand Up @@ -252,10 +252,7 @@ sub page_title ($c) {

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

Expand Down
24 changes: 0 additions & 24 deletions lib/WeBWorK/Utils/CourseManagement.pm
Original file line number Diff line number Diff line change
Expand Up @@ -152,10 +152,6 @@ environment.

$courseOptions is a reference to a hash containing the following options:

PRINT_FILE_NAMES_FOR => $pg{specialPGEnvironmentVars}{PRINT_FILE_NAMES_FOR}

C<PRINT_FILE_NAMES_FOR> is a reference to an array.

$users is a list of arrayrefs, each containing a User, Password, and
PermissionLevel record for a single user:

Expand Down Expand Up @@ -1199,26 +1195,6 @@ sub writeCourseConf {
# This file is used to override the global WeBWorK course environment for this course.

EOF

print $fh <<'EOF';
# Users for whom to label problems with the PG file name (global value typically "professor")
# For users in this list, PG will display the source file name when rendering a problem.
# defaults.config values:
EOF

if (defined $ce->{pg}{specialPGEnvironmentVars}{PRINT_FILE_NAMES_FOR}) {
print $fh "# \t", '$pg{specialPGEnvironmentVars}{PRINT_FILE_NAMES_FOR} = [',
join(", ",
map { "'" . protectQString($_) . "'" } @{ $ce->{pg}{specialPGEnvironmentVars}{PRINT_FILE_NAMES_FOR} }),
'];', "\n";
} else {
print $fh "# \t", '$pg{specialPGEnvironmentVars}{PRINT_FILE_NAMES_FOR} = [ ];', "\n";
}

if (defined $options{PRINT_FILE_NAMES_FOR}) {
print $fh '$pg{specialPGEnvironmentVars}{PRINT_FILE_NAMES_FOR} = [',
join(", ", map { "'" . protectQString($_) . "'" } @{ $options{PRINT_FILE_NAMES_FOR} }), '];', "\n";
}
}

sub get_SeedCE
Expand Down
9 changes: 1 addition & 8 deletions templates/ContentGenerator/GatewayQuiz.html.ep
Original file line number Diff line number Diff line change
Expand Up @@ -574,14 +574,7 @@
% }
%
% # This uses the permission level and user id of the user assigned to the set.
% if (
% $db->getPermissionLevel($effectiveUserID)->permission >=
% $ce->{pg}{specialPGEnvironmentVars}{PRINT_FILE_NAMES_PERMISSION_LEVEL}
% || (
% grep { $_ eq $effectiveUserID }
% @{ $ce->{pg}{specialPGEnvironmentVars}{PRINT_FILE_NAMES_FOR} }
% )
% )
% if ( $authz->hasPermissions($effectiveUserID, 'print_path_to_problem') )
% {
<%= $problems->[ $probOrder->[$i] ]->source_file %>
% }
Expand Down
Loading