Sha256: d4a8a5c46fbef773895d30f15202b7448c997c9fb0b50b23221cd90f589d6984
Contents?: true
Size: 1.05 KB
Versions: 1
Compression:
Stored size: 1.05 KB
Contents
# frozen_string_literal: true module Macros class Auth # Sign out users of all scopes # # @example # step Macros::Auth::SignOutAllScopes() # # @example specify scopes to skip sign out from # step Macros::Auth::SignOutAllScopes(except: [:admin]) class SignOutAllScopes < Macros::Base # @return [Macros::Auth::SignOutAllScopes] step macro instance # @param expect [Array] list of scopes to skip sign out def initialize(except: []) @except = except.is_a?(Array) ? except : [except] end # Performs a step by sign out users # @param ctx [Trailblazer::Skill] tbl context hash def call(ctx, **) warden = ctx[:warden] if @except.empty? warden.logout else (Devise.mappings.keys - @except).each do |scope| warden.logout(scope) if warden.authenticated?(scope: scope) end end Macros::Auth::ExpireSessionData.new.call(ctx) warden.clear_strategies_cache! warden.lock! end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
ff-tbl-macros-2.0.2 | lib/macros/auth/sign_out_all_scopes.rb |