Sha256: dc4a3438c15f9055f39765970d29e7635f8ef57a668c31827b9074bdbab9e807

Contents?: true

Size: 439 Bytes

Versions: 1

Compression:

Stored size: 439 Bytes

Contents

module Martinet
  module Impersonation
    def impersonate!(user, impersonator_scope: nil)
      impersonator = current_user(scope: impersonator_scope)
      sign_in!(impersonator, scope: :impersonator)
      sign_in!(user)
    end

    def impersonating?
      signed_in?(scope: :impersonator)
    end

    def unmask!
      impersonator = current_user(scope: :impersonator)
      sign_out!
      sign_in!(impersonator)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
martinet-0.0.4 lib/martinet/impersonation.rb