<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.expertiza.ncsu.edu/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Papatil</id>
	<title>Expertiza_Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.expertiza.ncsu.edu/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Papatil"/>
	<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=Special:Contributions/Papatil"/>
	<updated>2026-05-18T20:59:57Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.41.0</generator>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2023_-_E2377._Reimplement_impersonating_users_(functionality_within_impersonate_controller.rb)&amp;diff=151353</id>
		<title>CSC/ECE 517 Fall 2023 - E2377. Reimplement impersonating users (functionality within impersonate controller.rb)</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2023_-_E2377._Reimplement_impersonating_users_(functionality_within_impersonate_controller.rb)&amp;diff=151353"/>
		<updated>2023-11-14T22:27:19Z</updated>

		<summary type="html">&lt;p&gt;Papatil: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Expertiza==&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is a [http://rubyonrails.org/ 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.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
The current expertiza platform allows authorized users to impersonate others, utilizing session-based authentication. The challenge is to reimplement this feature in the new expertiza backend (https://github.com/expertiza/reimplementation-back-end), which employs JWT token authentication.&lt;br /&gt;
&lt;br /&gt;
Key challenges include adapting the existing session-based logic to work seamlessly with JWT tokens and transitioning from a Model-View-Controller (MVC) architecture to an API-only setup, requiring responses in JSON format. The goal is to ensure the smooth integration of the impersonation feature into the new backend while addressing authentication changes and architectural shifts.&lt;br /&gt;
&lt;br /&gt;
== Solution ==&lt;br /&gt;
&lt;br /&gt;
We plan to convert the impersonate users functionality from the MVC pattern in Expertiza to match the Rails API specification for the reimplementation backend repository. To do this we will reimplement the impersonate_controller.rb file located within expertiza/app/controllers/. The link to the original controller within expertizsa can be found at this link: [https://github.com/expertiza/expertiza/blob/main/app/controllers/impersonate_controller.rb Original Controller] &lt;br /&gt;
This is not the only file that we will be editing. We will be using JWT Tokens for authentication. The front end will still be responsible for storing the original user to get the original user back in function. Our code will work to change the current user as and when necessary in the API. Will also ensure that user privileges are checked to authorize only the relevant users to impersonate student users. Users that are super admin, TAs for other users or recursively parents of the user they are trying to impersonate can impersonate the user. &lt;br /&gt;
We will also ensure that we have the supporting methods in the User class are implemented. One such example of a method that we may need to reimplement is “can_impersonate?” within the User class. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Design ==&lt;br /&gt;
== Methods Reimplemented ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Original&lt;br /&gt;
  &amp;lt;pre&amp;gt;def action_allowed?&lt;br /&gt;
    # Check for TA privileges first since TA's also have student privileges.&lt;br /&gt;
    if ['Student'].include? current_role_name&lt;br /&gt;
      !session[:super_user].nil?&lt;br /&gt;
    else&lt;br /&gt;
      ['Super-Administrator',&lt;br /&gt;
       'Administrator',&lt;br /&gt;
       'Instructor',&lt;br /&gt;
       'Teaching Assistant'].include? current_role_name&lt;br /&gt;
    end&lt;br /&gt;
  end&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Updated&lt;br /&gt;
-- we will remove the session and store the user with a JWT token to authenticate&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Original&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;pre&amp;gt;def auto_complete_for_user_name&lt;br /&gt;
    @users = session[:user].get_available_users(params[:user][:name])&lt;br /&gt;
    render inline: &amp;quot;&amp;lt;%= auto_complete_result @users, 'name' %&amp;gt;&amp;quot;, layout: false&lt;br /&gt;
  end&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Updated&lt;br /&gt;
&lt;br /&gt;
--instead of using session we will just access the current user&lt;br /&gt;
-- we will remove the inline rendering and return a JSON instead&lt;br /&gt;
&lt;br /&gt;
Original&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;pre&amp;gt;&lt;br /&gt;
  def start&lt;br /&gt;
    flash[:error] = &amp;quot;This page doesn't take any query string.&amp;quot; unless request.GET.empty?&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Updated&lt;br /&gt;
--we will remove the flash error as it will not work in the new implementation&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Original:&lt;br /&gt;
 &amp;lt;pre&amp;gt; def generate_session(user)&lt;br /&gt;
    AuthController.clear_user_info(session, nil)&lt;br /&gt;
    session[:original_user] = @original_user&lt;br /&gt;
    session[:impersonate] = true&lt;br /&gt;
    session[:user] = user&lt;br /&gt;
  end&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Updated:&lt;br /&gt;
-- We will not be using sessions so we will be using JWT tokens to authenticate users instead of making a traditional session&lt;br /&gt;
&lt;br /&gt;
 Original&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;pre&amp;gt;def overwrite_session&lt;br /&gt;
    if params[:impersonate].nil?&lt;br /&gt;
      user = real_user(params[:user][:name])&lt;br /&gt;
      session[:super_user] = session[:user] if session[:super_user].nil?&lt;br /&gt;
      generate_session(user)&lt;br /&gt;
    elsif !params[:impersonate][:name].empty?&lt;br /&gt;
      user = real_user(params[:impersonate][:name])&lt;br /&gt;
      generate_session(user)&lt;br /&gt;
    else&lt;br /&gt;
      session[:user] = session[:super_user]&lt;br /&gt;
      session[:super_user] = nil&lt;br /&gt;
    end&lt;br /&gt;
  end&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Updated&lt;br /&gt;
--instead, we will just update the current User but we will authenticate the user with a JWT token instead. &lt;br /&gt;
&lt;br /&gt;
Original&lt;br /&gt;
  &amp;lt;pre&amp;gt;def check_if_input_is_valid&lt;br /&gt;
    if params[:user] &amp;amp;&amp;amp; warn_for_special_chars(params[:user][:name], 'Username')&lt;br /&gt;
      flash[:error] = 'Please enter valid user name'&lt;br /&gt;
      redirect_back fallback_location: root_path&lt;br /&gt;
    elsif params[:impersonate] &amp;amp;&amp;amp; warn_for_special_chars(params[:impersonate][:name], 'Username')&lt;br /&gt;
      flash[:error] = 'Please enter valid user name'&lt;br /&gt;
      redirect_back fallback_location: root_path&lt;br /&gt;
    end&lt;br /&gt;
  end&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Updated:&lt;br /&gt;
-- in this method we will remove the flash errors&lt;br /&gt;
&lt;br /&gt;
 Original&lt;br /&gt;
  &amp;lt;pre&amp;gt;def check_if_user_impersonateable&lt;br /&gt;
    if params[:impersonate].nil?&lt;br /&gt;
      user = real_user(params[:user][:name])&lt;br /&gt;
      unless @original_user.can_impersonate? user&lt;br /&gt;
        @message = &amp;quot;You cannot impersonate '#{params[:user][:name]}'.&amp;quot;&lt;br /&gt;
        temp&lt;br /&gt;
        AuthController.clear_user_info(session, nil)&lt;br /&gt;
      else&lt;br /&gt;
        overwrite_session&lt;br /&gt;
      end&lt;br /&gt;
    else&lt;br /&gt;
      unless params[:impersonate][:name].empty?&lt;br /&gt;
        overwrite_session&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&amp;lt;/pre&amp;gt;&lt;br /&gt;
Updated:&lt;br /&gt;
&lt;br /&gt;
--we will change the session to a JWT token in this method&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  Original &lt;br /&gt;
&lt;br /&gt;
  &amp;lt;pre&amp;gt;&lt;br /&gt;
def impersonate&lt;br /&gt;
    begin&lt;br /&gt;
      @original_user = session[:super_user] || session[:user]&lt;br /&gt;
      if params[:impersonate].nil?&lt;br /&gt;
        @message = &amp;quot;You cannot impersonate '#{params[:user][:name]}'.&amp;quot;&lt;br /&gt;
        @message = 'User name cannot be empty' if params[:user][:name].empty?&lt;br /&gt;
        user = real_user(params[:user][:name])&lt;br /&gt;
        check_if_user_impersonateable if user&lt;br /&gt;
      elsif !params[:impersonate][:name].empty?&lt;br /&gt;
        # Impersonate a new account&lt;br /&gt;
        @message = &amp;quot;You cannot impersonate '#{params[:impersonate][:name]}'.&amp;quot;&lt;br /&gt;
        user = real_user(params[:impersonate][:name])&lt;br /&gt;
        check_if_user_impersonateable if user&lt;br /&gt;
      # Revert to original account when currently in the impersonated session&lt;br /&gt;
      elsif !session[:super_user].nil?&lt;br /&gt;
        AuthController.clear_user_info(session, nil)&lt;br /&gt;
        session[:user] = session[:super_user]&lt;br /&gt;
        user = session[:user]&lt;br /&gt;
        session[:super_user] = nil&lt;br /&gt;
      end&lt;br /&gt;
      # Navigate to user's home location as the default landing page after impersonating or reverting&lt;br /&gt;
      AuthController.set_current_role(user.role_id, session)&lt;br /&gt;
      redirect_to action: AuthHelper.get_home_action(session[:user]),&lt;br /&gt;
                  controller: AuthHelper.get_home_controller(session[:user])&lt;br /&gt;
    rescue StandardError&lt;br /&gt;
      flash[:error] = @message&lt;br /&gt;
      redirect_back fallback_location: root_path&lt;br /&gt;
    end&lt;br /&gt;
  end&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Updated:&lt;br /&gt;
-- we will change the session to a JWT token and flash message from this method. &lt;br /&gt;
&lt;br /&gt;
Original:&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;pre&amp;gt;def real_user(name)&lt;br /&gt;
    if User.anonymized_view?(session[:ip])&lt;br /&gt;
      user = User.real_user_from_anonymized_name(name)&lt;br /&gt;
    else&lt;br /&gt;
      user = User.find_by(name: name)&lt;br /&gt;
    end&lt;br /&gt;
    return user&lt;br /&gt;
  end&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Updated:&lt;br /&gt;
-- we will implement a JWT token instead of using a session here&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
For the testing of this project, we will first test all functionality using the Postman API. If everything works as expected, we will then start testing our program using the RSwag tool. This will allow us to test and explore operations using a UI and directly from the rspec integration tests. &amp;lt;br&amp;gt;&lt;br /&gt;
The video links for these testing methods will be posted here when we complete it.&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
'''Mentor''' &amp;lt;br&amp;gt;&lt;br /&gt;
Renji Joseph Sabu &amp;lt;rsabu@ncsu.edu&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Students'''&amp;lt;br&amp;gt;&lt;br /&gt;
Manoj Ayyappan &amp;lt;mayyapp@ncsu.edu&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Pradeep Patil &amp;lt;papatil@ncsu.edu&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Maya Patel &amp;lt;mdpatel2@ncsu.edu&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Pull Request==&lt;br /&gt;
Changes for this project are under Expertiza Pull Request&lt;/div&gt;</summary>
		<author><name>Papatil</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2023_-_E2377._Reimplement_impersonating_users_(functionality_within_impersonate_controller.rb)&amp;diff=151351</id>
		<title>CSC/ECE 517 Fall 2023 - E2377. Reimplement impersonating users (functionality within impersonate controller.rb)</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2023_-_E2377._Reimplement_impersonating_users_(functionality_within_impersonate_controller.rb)&amp;diff=151351"/>
		<updated>2023-11-14T22:19:58Z</updated>

		<summary type="html">&lt;p&gt;Papatil: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Expertiza==&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is a [http://rubyonrails.org/ 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.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
The current expertiza platform allows authorized users to impersonate others, utilizing session-based authentication. The challenge is to reimplement this feature in the new expertiza backend (https://github.com/expertiza/reimplementation-back-end), which employs JWT token authentication.&lt;br /&gt;
&lt;br /&gt;
Key challenges include adapting the existing session-based logic to work seamlessly with JWT tokens and transitioning from a Model-View-Controller (MVC) architecture to an API-only setup, requiring responses in JSON format. The goal is to ensure the smooth integration of the impersonation feature into the new backend while addressing authentication changes and architectural shifts.&lt;br /&gt;
&lt;br /&gt;
== Solution ==&lt;br /&gt;
&lt;br /&gt;
We plan to convert the impersonate users functionality from the MVC pattern in Expertiza to match the Rails API specification for the reimplementation backend repository. To do this we will reimplement the impersonate_controller.rb file located within expertiza/app/controllers/. The link to the original controller within expertizsa can be found at this link: [https://github.com/expertiza/expertiza/blob/main/app/controllers/impersonate_controller.rb Original Controller] &lt;br /&gt;
This is not the only file that we will be editing. We will be using JWT Tokens for authentication. The front end will still be responsible for storing the original user to get the original user back in function. Our code will work to change the current user as and when necessary in the API. Will also ensure that user privileges are checked to authorize only the relevant users to impersonate student users.  &lt;br /&gt;
We will also ensure that we have the supporting methods in the User class are implemented. One such example of a method that we may need to reimplement is “can_impersonate?” within the User class. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Design ==&lt;br /&gt;
== Methods Reimplemented ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Original&lt;br /&gt;
  &amp;lt;pre&amp;gt;def action_allowed?&lt;br /&gt;
    # Check for TA privileges first since TA's also have student privileges.&lt;br /&gt;
    if ['Student'].include? current_role_name&lt;br /&gt;
      !session[:super_user].nil?&lt;br /&gt;
    else&lt;br /&gt;
      ['Super-Administrator',&lt;br /&gt;
       'Administrator',&lt;br /&gt;
       'Instructor',&lt;br /&gt;
       'Teaching Assistant'].include? current_role_name&lt;br /&gt;
    end&lt;br /&gt;
  end&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Updated&lt;br /&gt;
-- we will remove the session and store the user with a JWT token to authenticate&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Original&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;pre&amp;gt;def auto_complete_for_user_name&lt;br /&gt;
    @users = session[:user].get_available_users(params[:user][:name])&lt;br /&gt;
    render inline: &amp;quot;&amp;lt;%= auto_complete_result @users, 'name' %&amp;gt;&amp;quot;, layout: false&lt;br /&gt;
  end&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Updated&lt;br /&gt;
&lt;br /&gt;
--instead of using session we will just access the current user&lt;br /&gt;
-- we will remove the inline rendering and return a JSON instead&lt;br /&gt;
&lt;br /&gt;
Original&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;pre&amp;gt;&lt;br /&gt;
  def start&lt;br /&gt;
    flash[:error] = &amp;quot;This page doesn't take any query string.&amp;quot; unless request.GET.empty?&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Updated&lt;br /&gt;
--we will remove the flash error as it will not work in the new implementation&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Original:&lt;br /&gt;
 &amp;lt;pre&amp;gt; def generate_session(user)&lt;br /&gt;
    AuthController.clear_user_info(session, nil)&lt;br /&gt;
    session[:original_user] = @original_user&lt;br /&gt;
    session[:impersonate] = true&lt;br /&gt;
    session[:user] = user&lt;br /&gt;
  end&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Updated:&lt;br /&gt;
-- We will not be using sessions so we will be using JWT tokens to authenticate users instead of making a traditional session&lt;br /&gt;
&lt;br /&gt;
 Original&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;pre&amp;gt;def overwrite_session&lt;br /&gt;
    if params[:impersonate].nil?&lt;br /&gt;
      user = real_user(params[:user][:name])&lt;br /&gt;
      session[:super_user] = session[:user] if session[:super_user].nil?&lt;br /&gt;
      generate_session(user)&lt;br /&gt;
    elsif !params[:impersonate][:name].empty?&lt;br /&gt;
      user = real_user(params[:impersonate][:name])&lt;br /&gt;
      generate_session(user)&lt;br /&gt;
    else&lt;br /&gt;
      session[:user] = session[:super_user]&lt;br /&gt;
      session[:super_user] = nil&lt;br /&gt;
    end&lt;br /&gt;
  end&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Updated&lt;br /&gt;
--instead, we will just update the current User but we will authenticate the user with a JWT token instead. &lt;br /&gt;
&lt;br /&gt;
Original&lt;br /&gt;
  &amp;lt;pre&amp;gt;def check_if_input_is_valid&lt;br /&gt;
    if params[:user] &amp;amp;&amp;amp; warn_for_special_chars(params[:user][:name], 'Username')&lt;br /&gt;
      flash[:error] = 'Please enter valid user name'&lt;br /&gt;
      redirect_back fallback_location: root_path&lt;br /&gt;
    elsif params[:impersonate] &amp;amp;&amp;amp; warn_for_special_chars(params[:impersonate][:name], 'Username')&lt;br /&gt;
      flash[:error] = 'Please enter valid user name'&lt;br /&gt;
      redirect_back fallback_location: root_path&lt;br /&gt;
    end&lt;br /&gt;
  end&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Updated:&lt;br /&gt;
-- in this method we will remove the flash errors&lt;br /&gt;
&lt;br /&gt;
 Original&lt;br /&gt;
  &amp;lt;pre&amp;gt;def check_if_user_impersonateable&lt;br /&gt;
    if params[:impersonate].nil?&lt;br /&gt;
      user = real_user(params[:user][:name])&lt;br /&gt;
      unless @original_user.can_impersonate? user&lt;br /&gt;
        @message = &amp;quot;You cannot impersonate '#{params[:user][:name]}'.&amp;quot;&lt;br /&gt;
        temp&lt;br /&gt;
        AuthController.clear_user_info(session, nil)&lt;br /&gt;
      else&lt;br /&gt;
        overwrite_session&lt;br /&gt;
      end&lt;br /&gt;
    else&lt;br /&gt;
      unless params[:impersonate][:name].empty?&lt;br /&gt;
        overwrite_session&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&amp;lt;/pre&amp;gt;&lt;br /&gt;
Updated:&lt;br /&gt;
&lt;br /&gt;
--we will change the session to a JWT token in this method&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  Original &lt;br /&gt;
&lt;br /&gt;
  &amp;lt;pre&amp;gt;&lt;br /&gt;
def impersonate&lt;br /&gt;
    begin&lt;br /&gt;
      @original_user = session[:super_user] || session[:user]&lt;br /&gt;
      if params[:impersonate].nil?&lt;br /&gt;
        @message = &amp;quot;You cannot impersonate '#{params[:user][:name]}'.&amp;quot;&lt;br /&gt;
        @message = 'User name cannot be empty' if params[:user][:name].empty?&lt;br /&gt;
        user = real_user(params[:user][:name])&lt;br /&gt;
        check_if_user_impersonateable if user&lt;br /&gt;
      elsif !params[:impersonate][:name].empty?&lt;br /&gt;
        # Impersonate a new account&lt;br /&gt;
        @message = &amp;quot;You cannot impersonate '#{params[:impersonate][:name]}'.&amp;quot;&lt;br /&gt;
        user = real_user(params[:impersonate][:name])&lt;br /&gt;
        check_if_user_impersonateable if user&lt;br /&gt;
      # Revert to original account when currently in the impersonated session&lt;br /&gt;
      elsif !session[:super_user].nil?&lt;br /&gt;
        AuthController.clear_user_info(session, nil)&lt;br /&gt;
        session[:user] = session[:super_user]&lt;br /&gt;
        user = session[:user]&lt;br /&gt;
        session[:super_user] = nil&lt;br /&gt;
      end&lt;br /&gt;
      # Navigate to user's home location as the default landing page after impersonating or reverting&lt;br /&gt;
      AuthController.set_current_role(user.role_id, session)&lt;br /&gt;
      redirect_to action: AuthHelper.get_home_action(session[:user]),&lt;br /&gt;
                  controller: AuthHelper.get_home_controller(session[:user])&lt;br /&gt;
    rescue StandardError&lt;br /&gt;
      flash[:error] = @message&lt;br /&gt;
      redirect_back fallback_location: root_path&lt;br /&gt;
    end&lt;br /&gt;
  end&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Updated:&lt;br /&gt;
-- we will change the session to a JWT token and flash message from this method. &lt;br /&gt;
&lt;br /&gt;
Original:&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;pre&amp;gt;def real_user(name)&lt;br /&gt;
    if User.anonymized_view?(session[:ip])&lt;br /&gt;
      user = User.real_user_from_anonymized_name(name)&lt;br /&gt;
    else&lt;br /&gt;
      user = User.find_by(name: name)&lt;br /&gt;
    end&lt;br /&gt;
    return user&lt;br /&gt;
  end&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Updated:&lt;br /&gt;
-- we will implement a JWT token instead of using a session here&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
For the testing of this project, we will first test all functionality using the Postman API. If everything works as expected, we will then start testing our program using the RSwag tool. This will allow us to test and explore operations using a UI and directly from the rspec integration tests. &amp;lt;br&amp;gt;&lt;br /&gt;
The video links for these testing methods will be posted here when we complete it.&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
'''Mentor''' &amp;lt;br&amp;gt;&lt;br /&gt;
Renji Joseph Sabu &amp;lt;rsabu@ncsu.edu&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Students'''&amp;lt;br&amp;gt;&lt;br /&gt;
Manoj Ayyappan &amp;lt;mayyapp@ncsu.edu&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Pradeep Patil &amp;lt;papatil@ncsu.edu&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Maya Patel &amp;lt;mdpatel2@ncsu.edu&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Pull Request==&lt;br /&gt;
Changes for this project are under Expertiza Pull Request&lt;/div&gt;</summary>
		<author><name>Papatil</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2023_-_E2377._Reimplement_impersonating_users_(functionality_within_impersonate_controller.rb)&amp;diff=151340</id>
		<title>CSC/ECE 517 Fall 2023 - E2377. Reimplement impersonating users (functionality within impersonate controller.rb)</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2023_-_E2377._Reimplement_impersonating_users_(functionality_within_impersonate_controller.rb)&amp;diff=151340"/>
		<updated>2023-11-14T21:56:37Z</updated>

		<summary type="html">&lt;p&gt;Papatil: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Expertiza==&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is a [http://rubyonrails.org/ 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.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
== Solution ==&lt;br /&gt;
== Design ==&lt;br /&gt;
== Methods Reimplemented ==&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
'''Mentor''' &amp;lt;br&amp;gt;&lt;br /&gt;
Renji Joseph Sabu &amp;lt;rsabu@ncsu.edu&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Students'''&amp;lt;br&amp;gt;&lt;br /&gt;
Manoj Ayyappan &amp;lt;mayyapp@ncsu.edu&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Pradeep Patil &amp;lt;papatil@ncsu.edu&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Maya Patel &amp;lt;mdpatel2@ncsu.edu&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Pull Request==&lt;br /&gt;
Changes for this project are under Expertiza Pull Request&lt;/div&gt;</summary>
		<author><name>Papatil</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2023_-_E2377._Reimplement_impersonating_users_(functionality_within_impersonate_controller.rb)&amp;diff=151339</id>
		<title>CSC/ECE 517 Fall 2023 - E2377. Reimplement impersonating users (functionality within impersonate controller.rb)</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2023_-_E2377._Reimplement_impersonating_users_(functionality_within_impersonate_controller.rb)&amp;diff=151339"/>
		<updated>2023-11-14T21:55:06Z</updated>

		<summary type="html">&lt;p&gt;Papatil: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Expertiza==&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is a [http://rubyonrails.org/ 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.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
== Methods Reimplemented ==&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
'''Mentor''' &amp;lt;br&amp;gt;&lt;br /&gt;
Renji Joseph Sabu &amp;lt;rsabu@ncsu.edu&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Students'''&amp;lt;br&amp;gt;&lt;br /&gt;
Manoj Ayyappan &amp;lt;mayyapp@ncsu.edu&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Pradeep Patil &amp;lt;papatil@ncsu.edu&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Maya Patel &amp;lt;mdpatel2@ncsu.edu&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Pull Request==&lt;br /&gt;
Changes for this project are under Expertiza Pull Request&lt;/div&gt;</summary>
		<author><name>Papatil</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2023_-_E2377._Reimplement_impersonating_users_(functionality_within_impersonate_controller.rb)&amp;diff=151338</id>
		<title>CSC/ECE 517 Fall 2023 - E2377. Reimplement impersonating users (functionality within impersonate controller.rb)</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2023_-_E2377._Reimplement_impersonating_users_(functionality_within_impersonate_controller.rb)&amp;diff=151338"/>
		<updated>2023-11-14T21:54:29Z</updated>

		<summary type="html">&lt;p&gt;Papatil: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Expertiza==&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is a [http://rubyonrails.org/ 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.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
== Methods Reimplemented ==&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
'''Mentor''' &amp;lt;br&amp;gt;&lt;br /&gt;
Renji Joseph Sabu &amp;lt;rsabu@ncsu.edu&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Students'''&amp;lt;br&amp;gt;&lt;br /&gt;
Manoj Ayyappan &amp;lt;mayyapp@ncsu.edu&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Pradeep Patil &amp;lt;papatil@ncsu.edu&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Maya Patel &amp;lt;mdpatel2@ncsu.edu&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Pull Request==&lt;br /&gt;
Changes for this project are under Expertiza Pull Request&lt;/div&gt;</summary>
		<author><name>Papatil</name></author>
	</entry>
</feed>