Skip to content

Fix the change_user_id script for the case that a user does not have a password.#2950

Open
drgrice1 wants to merge 1 commit intoopenwebwork:WeBWorK-2.21from
drgrice1:bugfix/change_user_id
Open

Fix the change_user_id script for the case that a user does not have a password.#2950
drgrice1 wants to merge 1 commit intoopenwebwork:WeBWorK-2.21from
drgrice1:bugfix/change_user_id

Conversation

@drgrice1
Copy link
Copy Markdown
Member

It is now the case that a user is not required to have a password record in the database. However, the change_user_id script was never updated for that case. So an exception is thrown if the script is used for a user that does not have a password record (for example a user created via LTI authentication).

Note that perltidy has also been run on the file. The script does not have the .pl extension and so the workflow doesn't check this file and the run-perltidy.pl script doesn't attempt to format it. Hide whitespace changes to see the important change (there is also some clean up of the comments at the beginning of the file).

Also fix the check for the type of a database record in the checkArgs method of lib/WeBWorK/DB.pm. Just because a variable is a ref does not mean that it is an object for which the isa method can be called. The proper check is blessed $obj && $obj->isa('Package'). Note the defined check was unnecessary in any case. This prevented the error in the script from giving more useful information. Instead it complained about the inability to call isa when it should have given the intended error message from this check.

…e a password.

It is now the case that a user is not required to have a password record
in the database.  However, the `change_user_id` script was never updated
for that case.  So an exception is thrown if the script is used for a
user that does not have a password record (for example a user created
via LTI authentication).

Note that perltidy has also been run on the file. The script does not
have the `.pl` extension and so the workflow doesn't check this file and
the `run-perltidy.pl` script doesn't attempt to format it.  Hide
whitespace changes to see the important change (there is also some clean
up of the comments at the beginning of the file).

Also fix the check for the type of a database record in the `checkArgs`
method of `lib/WeBWorK/DB.pm`.  Just because a variable is a `ref` does
not mean that it is an object for which the `isa` method can be called.
The proper check is `blessed $obj && $obj->isa('Package')`.  Note the
defined check was unnecessary in any case. This prevented the error in
the script from giving more useful information.  Instead it complained
about the inability to call `isa` when it should have given the intended
error message from this check.
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

Successfully merging this pull request may close these issues.

1 participant