Skip to content

Commit

Permalink
Change checkbox list of user roles on config page to depend on %userR…
Browse files Browse the repository at this point in the history
…oles rather than be hard-coded
  • Loading branch information
dlglin committed Oct 14, 2024
1 parent 193ff38 commit 1cba711
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions lib/WeBWorK/ConfigObject/permission_checkboxlist.pm
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,9 @@ sub comparison_value ($self, $val) {
}

sub entry_widget ($self, $default, $is_secret = 0) {
my $c = $self->{c};
$default = role_and_above($self->{c}->ce->{userRoles}, $default) unless ref($default) eq 'ARRAY';
my $c = $self->{c};
my $userRoles = $self->{c}->ce->{userRoles};
$default = role_and_above($userRoles, $default) unless ref($default) eq 'ARRAY';
return $c->c(
map {
$c->tag(
Expand All @@ -72,7 +73,7 @@ sub entry_widget ($self, $default, $is_secret = 0) {
)->join('')
)
)
} ('guest', 'student', 'login_proctor', 'grade_proctor', 'ta', 'professor', 'admin')
} grep { $_ ne 'nobody' } sort { $userRoles->{$a} <=> $userRoles->{$b} } keys(%$userRoles)
)->join('');
}

Expand Down

0 comments on commit 1cba711

Please sign in to comment.