Don't create users for LTI users that do not have permission to login. #2799
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Currently if
$permissionLevels{login} = 'professor'
and a user signs in via LTI that would be assigned the role of "student", then webwork2 creates the user and signs the user in. However, on subsequent LTI logins authentication fails. This refuses to create a user if the requested role would not have permission to login. @somiaj pointed this out recently in Slack.Clean up the error messages some. There is a lot of work left to do on this. The LTIAdvance.pm module has an extremely poor design for error handling and messaging to go with those errors. The LTIAdvantage.pm module is only a tad better (I largely just copied the poor design of the LTIAdvanced.pm module). The
log_error
key is set and appended to numerous times, frequently resulting in a long run on message that doesn't really make sense. Also, there were some of these errors that were adding "LOGIN FAILED". That was removed because TheAuthen.pm
code always prepends that and that resulted in logs with "LOGIN FAILED LOGIN FAILED ...".The
authenticate
method is expected to return either 1 or a message indicating the failure. Currently it returns either 1 or 0. As a result the messages that are set in theauthenticate
method go into the abyss. Those messages should be returned instead of setting$self->{error}
. Note that the method can still return 0 if no message should be set (as in the case of the OAuth token failing to verify for LTI 1.1).For LTI 1.3 make sure that the fallback_source_of_username is set before attempting to use it. Otherwise the claim extraction fails and it results in a database error later.