Main Page/CSC/CSC 517 Spring 2020 Refactor impersonate controller: Difference between revisions

From Expertiza_Wiki
Jump to navigation Jump to search
mNo edit summary
(added intial code pics and usage guide images)
Line 4: Line 4:
1. Instructor login: username -> instructor6, password -> password
1. Instructor login: username -> instructor6, password -> password


when logged in as an instructor, under the manage option in the ribbon, 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, this can be used to revert the impersonation and return to the instructor profile.
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.
 
[[File:Impersonate guide.jpg|figure 1|frame|center]]
       
 
[[File:Non impersonate.jpg|figure 2|frame|center]]
       
[[File:Impersonated view.jpg|figure 3|frame|center]]
       


===About Expertiza===
===About Expertiza===
Line 15: Line 23:
*All functions related to impersonate controller were present in a single method
*All functions related to impersonate controller were present in a single method
*Presence of repetitive code
*Presence of repetitive code
These two issues can be clearly in the code below in figures 4a and 4b, taken from the initial file.
[[File:initial code1.jpg| figure 4a| frame|center]]
[[File:initial code2.jpg| figure 4b| frame|center]]
===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
These two issues have been tackled by
Creating new methods which were called inside the impersonate controller. The new methods were:
Creating new methods which were called inside the impersonate controller. The new methods were:
Line 22: Line 39:
*display_error_msg
*display_error_msg
*clear_session
*clear_session
===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.

Revision as of 18:24, 31 March 2020

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