oivoodoo / devise_masquerade

Extension for devise, enable login as functionality. Add link to the masquerade_path(resource) and use it.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Why `back` method needs authorization?

lcjury opened this issue · comments

I want to allow admins to masquerade other users, because of this, I override the masquerade_authorized? method with something like:

def masquerade_authorized?
  admin?
end

The "back_masquerade_path" also uses masquerade_authorized?; since I'm masquerading as a non-admin user, I cannot return to my previous user.

I'm doing something wrong?

You could do something like

def masquerade_authorized?
  admin? || params[:action] == 'back'
end