Main Page/CSC/CSC 517 Spring 2020 Refactor impersonate controller

From Expertiza_Wiki
Revision as of 18:24, 31 March 2020 by Mramani (talk | contribs) (added intial code pics and usage guide images)
Jump to navigation Jump to search

This wiki page describes the work done under E2002 OSS Program for Spring 2020, in the CSC/ECE 517 course.

Peer Review Information

1. Instructor login: username -> instructor6, password -> password

when logged in as an instructor, under the manage option in the ribbon as in Figure 1, select impersonate user. Upon redirected to impersonate page, enter the account which needs to be impersonated. If possible it impersonates that user. Now a new button called revert appears on the ribbon as in figure 3, this can be used to revert the impersonation and return to the instructor profile.

figure 1


figure 2
figure 3


About Expertiza

Expertiza is an open-source project based on Ruby on Rails framework. Expertiza is a complete instructor-student usage website where the instructor can assign assignments, deadlines, grades, etc that is required for the course. Similarly, the students can use this website to perform the tasks required as part of the course like project or assignments submission, forming groups and collaborating with them, as well as reviewing projects and teammates.


Problem Statement

The aim of the project is to refactor the impersonate controller. The pre-existing code had two major issues.

  • All functions related to impersonate controller were present in a single method
  • Presence of repetitive code

These two issues can be clearly in the code below in figures 4a and 4b, taken from the initial file.

figure 4a
figure 4b


About Impersonate Controller

Expertiza allows the administrators, instructors or teaching assistants to impersonate another user (like a student) and access their account. For example, an instructor impersonating a student’s account can view their assignments, stage deadlines, peer reviews and anything else that the student can view. One thing to be noted is that most of these users con only impersonate users for whom they are a parent. For example, instructor6 is a parent of student3841 and not student3836; as a result, instructor6 can impersonate only 3841.


Problem Solution

These two issues have been tackled by Creating new methods which were called inside the impersonate controller. The new methods were:

  • checkif_user_impersonateable
  • display_error_msg
  • clear_session