Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minimal support for custom permission levels in Accounts Manager which are not provided in the userRoles hash #2629

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Changes from all 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
Original file line number Diff line number Diff line change
Expand Up @@ -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") %>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should be

Suggested change
<%= maketext((grep { $ce->{userRoles}{$_} eq $value } keys %{ $ce->{userRoles} })[0] // "PermLevel$value") %>
% if (my $roleName = (grep { $ce->{userRoles}{$_} eq $value } keys %{ $ce->{userRoles} })[0]) {
<%= maketext($roleName) %>
% } else {
<%= maketext("Permission Level [_1]", $value) %>
% }

With this "Permission Level [_1]" will get translated. With your code it will not. I also don't like abbreviations shown in the user interface, so I would rather have "Permission Level" rather than "PermLevel".

Although, I was alternately thinking that maybe "Permission Level" in any form isn't needed. This is the "Permission Level" column in the table. So maybe instead just show the unknown permission level numerically? So perhaps this should be

Suggested change
<%= maketext((grep { $ce->{userRoles}{$_} eq $value } keys %{ $ce->{userRoles} })[0] // "PermLevel$value") %>
% if (my $roleName = (grep { $ce->{userRoles}{$_} eq $value } keys %{ $ce->{userRoles} })[0]) {
<%= maketext($roleName) %>
% } else {
<%= $value %>
% }

Or maybe use maketext('Unknown: [_1]', $value)?

% }
% } elsif ($properties->{type} eq 'password') {
% # Note that this is only called if in editMode.
Expand Down