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

Change the LTI launch message, if user is not a course member #1417

Merged
merged 4 commits into from
Sep 1, 2022

Conversation

pushyamig
Copy link
Contributor

Fixes #1381

@pushyamig pushyamig requested a review from jonespm August 31, 2022 19:05
@@ -192,7 +192,7 @@ def check_if_instructor(roles, username, course_id):
def course_user_roles(roles, username):
user_membership_roles = set([role for role in roles if role.find(COURSE_MEMBERSHIP) == 0])
if not user_membership_roles:
logger.info(f'User {username} does not have course membership roles, must be admin {roles}')
logger.error(f'User {username} does not have course membership roles, but has {roles} roles')
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I just let the role print out as part of the message. But I am ok to remove it.

User Janedoe does not have course membership roles, but has ['http://purl.imsglobal.org/vocab/lis/v2/institution/person#Administrator', 'http://purl.imsglobal.org/vocab/lis/v2/institution/person#Instructor', 'http://purl.imsglobal.org/vocab/lis/v2/institution/person#Student', 'http://purl.imsglobal.org/vocab/lis/v2/system/person#User'] roles

Copy link
Member

Choose a reason for hiding this comment

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

Okay thanks. I don't think this need to be bumped up to an error. In many cases they may be an administrator. But I think the problem came up on the certification tests of

However they said this would pass, it's just the message was confusing.

  • Launch Instructor with Short Role Value
[2022-05-05 15:26:24 -0400] [INFO] [lti_new.py:194] User l.c.hutton@district1.com does not have course membership roles, must be admin ['Instructor']
  • Launch Instructor with Unknown Role
[2022-05-05 15:28:46 -0400] [INFO] [lti_new.py:194] User l.c.hutton@district1.com does not have course membership roles, must be admin ['http://purl.imsglobal.org/vocab/lis/v2/unknown/unknown#Helper' 
  • Launch Instructor with No Role
[2022-05-05 15:31:46 -0400] [INFO] [lti_new.py:194] User l.c.hutton@district1.com does not have course membership roles, must be admin ['']

Copy link
Member

@jonespm jonespm Aug 31, 2022

Choose a reason for hiding this comment

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

I think our search for

COURSE_MEMBERSHIP = 'http://purl.imsglobal.org/vocab/lis/v2/membership'

Was where this was failing. So it doesn't find course membership roles but there are some roles. I don't know if we need to do anything for the No Role, even though they say it's fine for certification.

I'm not even sure what this course_user_roles method is used for here? It looks like the only thing it does is remove the role if the user is TA and INSTRUCTOR? It seems like this could just be removed and that logic be in the check_if_instructor method since that's the only place it's used.

    user_roles = course_user_roles(roles, username)
    is_instructor = check_if_instructor(user_roles, username, course_id)

(user_roles is unused after this)

Copy link
Contributor Author

@pushyamig pushyamig Sep 1, 2022

Choose a reason for hiding this comment

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

I changed the logic of how instructor only is checked. I log message only if he is an instructor.

This check was in place since we only allow instructors to enable the data extraction process in MyLA after the very initial launch of the tool. Apart from that, we also allow MyLA Admin to enable the data extraction process ( or to say have a course entry in course table.

Below user roles we need to test with

  1. Admins in Canvas
  2. Instructor in a course
  3. Instructor and TA in a course
  4. TA only
  5. Admin In MyLA

Copy link
Member

@jonespm jonespm left a comment

Choose a reason for hiding this comment

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

I think this change looks good! Thanks. Could you update the original issue with a test plan. This should be able to be tested by @jennlove-um by just trying to launch as a few different user types.

@pushyamig
Copy link
Contributor Author

I added the test plan to the issues, Merging now

@pushyamig pushyamig merged commit cb389fb into tl-its-umich-edu:master Sep 1, 2022
jonespm pushed a commit to jonespm/student-dashboard-django that referenced this pull request Sep 20, 2022
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.

Change the way instructor is identified during the LTI launch to avoid a misleading log message
2 participants