CSC/ECE 517 Spring 2024 - E2421. Reimplement impersonating users (within impersonate controller.rb)

From Expertiza_Wiki
Revision as of 23:43, 23 March 2024 by Mbhande2 (talk | contribs)
Jump to navigation Jump to search

Expertiza

Expertiza is a Ruby on Rails based open source project. Instructors have the ability to add new projects, assignments, etc., as well as edit existing ones. Later on, they can view student submissions and grade them. Students can also use Expertiza to organize into teams to work on different projects and assignments and submit their work. They can also review other students' submissions.

Project Overview

The objective is to reimplement the backend code for the impersonation feature in the new implementation of Expertiza. The current implementation relies on sessions, which won't be compatible with the new implementation using JWT tokens for authentication and returning JSON responses. The challenge lies in transitioning the logic from session-based management to JWT-based authentication while maintaining the functionality of impersonating users. The reimplementation involves planning how the backend will communicate with the frontend, potentially requiring changes in existing or new files beyond the impersonate_controller.rb.

Testing on Postman

Postman was used to manually test the additional method in impersonate_controller.rb, as well as the actions and routes of the corresponding controllers. Before testing any of these methods with Postman, submit a request to /login using the user_name and password fields, which will send an authentication token. This token must be added to Postman's 'Authorization' tab as a 'Bearer token' before any further requests can be made.

  • Login with provided credentials and copy the token

  • In the Expertiza/Authorization paste the token and save

  • Put the id for the user to be impersonated

  • Success message if the user is impersonable

  • Failure message if the user is not impersonable (Here instructor is trying to impersonate admin)

Team

Mentor

  • Chetana Chunduru <cchetan2@ncsu.edu>

Students

  • Devansh Shah <dshah8@ncsu.edu>
  • Jay Patel <jhpatel9@ncsu.edu>
  • Mihir Bhanderi <mbhande2@ncsu.edu>