From 37385f7795a4d2b4c17cf8d0cf0f2448e9979de4 Mon Sep 17 00:00:00 2001 From: Nathan Wallach Date: Thu, 21 Nov 2024 15:27:58 +0200 Subject: [PATCH 1/2] Create a local name for a permission level which is not defined in the active %userRoles hash. Will prevent Accounts Manager from failing. See https://github.com/openwebwork/webwork2/issues/2625 but when editing a user with such a value, will only allow choosing a defined level. --- .../Instructor/UserList/user_list_field.html.ep | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/ContentGenerator/Instructor/UserList/user_list_field.html.ep b/templates/ContentGenerator/Instructor/UserList/user_list_field.html.ep index 40f5535265..3eefe29265 100644 --- a/templates/ContentGenerator/Instructor/UserList/user_list_field.html.ep +++ b/templates/ContentGenerator/Instructor/UserList/user_list_field.html.ep @@ -51,7 +51,7 @@ id => $fieldName . '_id', class => 'form-select form-select-sm w-auto flex-grow-0', 'aria-labelledby' => 'permission_header' =%> % } else { - <%= maketext((grep { $ce->{userRoles}{$_} eq $value } keys %{ $ce->{userRoles} })[0]) %> + <%= maketext((grep { $ce->{userRoles}{$_} eq $value } keys %{ $ce->{userRoles} })[0] // "PermLevel$value") %> % } % } elsif ($properties->{type} eq 'password') { % # Note that this is only called if in editMode. From 7347812ec19d3e51148d15aa020135bece55fb6e Mon Sep 17 00:00:00 2001 From: Glenn Rice Date: Tue, 17 Dec 2024 20:08:50 -0600 Subject: [PATCH 2/2] Fix the maketext call for an uknown permission level. --- .../Instructor/UserList/user_list_field.html.ep | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/templates/ContentGenerator/Instructor/UserList/user_list_field.html.ep b/templates/ContentGenerator/Instructor/UserList/user_list_field.html.ep index 3eefe29265..c0a842ee0a 100644 --- a/templates/ContentGenerator/Instructor/UserList/user_list_field.html.ep +++ b/templates/ContentGenerator/Instructor/UserList/user_list_field.html.ep @@ -50,8 +50,10 @@ <%= select_field $fieldName => \@values, id => $fieldName . '_id', class => 'form-select form-select-sm w-auto flex-grow-0', 'aria-labelledby' => 'permission_header' =%> + % } elsif (my $roleName = (grep { $ce->{userRoles}{$_} eq $value } keys %{ $ce->{userRoles} })[0]) { + <%= maketext($roleName) %> % } else { - <%= maketext((grep { $ce->{userRoles}{$_} eq $value } keys %{ $ce->{userRoles} })[0] // "PermLevel$value") %> + <%= maketext('Unknown: [_1]', $value) %> % } % } elsif ($properties->{type} eq 'password') { % # Note that this is only called if in editMode.