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

[MNOE-909]Removed trackable for impersonation requests #648

Open
wants to merge 2 commits into
base: 4.0
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions api/app/controllers/mno_enterprise/impersonate_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ module MnoEnterprise
class ImpersonateController < ApplicationController
include MnoEnterprise::ImpersonateHelper

before_filter :skip_trackable, only: [:create]
before_filter :authenticate_user!, except: [:destroy]
before_filter :current_user_must_be_admin!, except: [:destroy]

Expand Down Expand Up @@ -39,6 +40,10 @@ def destroy

private

def skip_trackable
Copy link
Contributor

Choose a reason for hiding this comment

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

This part is not needed, the function is already defined in the ApplicationController

Copy link
Contributor Author

@iseessel iseessel Feb 8, 2018

Choose a reason for hiding this comment

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

@ouranos
Ah I see.

I'm a little confused as to why this is in the application_controller. Trackables are only updated when the user signs in, correct? I see several before_filter :authenticate_user!, does it have to do with that?

Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry this was added in #578 and hasn't made to the 4.0 branch yet.
The method is in the ApplicationController so it can be called from any controller that might requires it.

Added more details in JIRA

request.env["devise.skip_trackable"] = true
end

def current_user_must_be_admin!
unless current_user.admin_role.present?
flash[:error] = "You don't have access to this section."
Expand Down