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

Accounts Manager breaks if a user has a permission level that is not defined in %userRoles #2625

Open
dlglin opened this issue Nov 19, 2024 · 0 comments

Comments

@dlglin
Copy link
Member

dlglin commented Nov 19, 2024

To reproduce: add a user to a course with a permission level that is not defined in the %userRoles hash for that course.

If you visit the Accounts Manager you get the error "maketext requires at least one parameter at /opt/webwork/webwork2/lib/Mojolicious/WeBWorK.pm line 110."

The way I came across this is that I had a course with a new role defined in course.conf, and I created a new course and copied instructors from that course. Now I have a new course with a user with permission level 11, but the new course doesn't have a role associated with that permission level.

The other way this could occur is if you archive a course on a server with custom roles defined, and then unarchive it on a server that is missing those custom roles.

The issue appears to be at

<%= maketext((grep { $ce->{userRoles}{$_} eq $value } keys %{ $ce->{userRoles} })[0]) %>

If there is no entry in the hash associated with the permission level then you end up passing nothing to maketext.

@dlglin dlglin changed the title Accounts Manager breaks if a user has a permission lever that is not defined in %userRoles Accounts Manager breaks if a user has a permission level that is not defined in %userRoles Nov 19, 2024
taniwallach added a commit to taniwallach/webwork2 that referenced this issue Nov 21, 2024
the active %userRoles hash. Will prevent Accounts Manager from failing.
See openwebwork#2625
but when editing a user with such a value, will only allow chosing
a defined level.
taniwallach added a commit to taniwallach/webwork2 that referenced this issue Nov 21, 2024
the active %userRoles hash. Will prevent Accounts Manager from failing.
See openwebwork#2625
but when editing a user with such a value, will only allow choosing
a defined level.
taniwallach added a commit to taniwallach/webwork2 that referenced this issue Nov 21, 2024
the active %userRoles hash. Will prevent Accounts Manager from failing.
See openwebwork#2625
but when editing a user with such a value, will only allow choosing
a defined level.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant