Sha256: c41653b66348198a0d7885ea5bfbd278cb2751c2ee0b9298d95c0a2182611176

Contents?: true

Size: 1.12 KB

Versions: 10

Compression:

Stored size: 1.12 KB

Contents

# typed: ignore

# Copyright (c) 2015 Sqreen. All Rights Reserved.
# Please refer to our terms for more information: https://www.sqreen.com/terms.html

require 'sqreen/log'
require 'sqreen/exception'
require 'sqreen/actions/base'
require 'sqreen/actions/user_action_class'

module Sqreen
  module Actions
    # Blocks a user at the point Sqreen::identify()
    # or Sqreen::auth_track() are called
    class BlockUser < Base
      extend UserActionClass

      self.type_name = 'block_user'

      def initialize(id, opts, _params = {})
        super(id, opts)
      end

      def do_run(identity_params)
        Sqreen.log.debug(
          "Will raise due to user being blocked by action #{id}. " \
          "Blocked user identity: #{identity_params}"
        )

        e = Sqreen::AttackBlocked.new(
          "Blocked user with identity #{identity_params} " \
          'due to automatic security response. No action is required'
        )

        {
          :status => :raise,
          :exception => e,
        }
      end

      def event_properties(identity_params)
        { 'user' => identity_params }
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
sqreen-1.25.1 lib/sqreen/actions/block_user.rb
sqreen-1.25.0 lib/sqreen/actions/block_user.rb
sqreen-1.24.3 lib/sqreen/actions/block_user.rb
sqreen-1.24.2 lib/sqreen/actions/block_user.rb
sqreen-1.24.1 lib/sqreen/actions/block_user.rb
sqreen-1.24.0 lib/sqreen/actions/block_user.rb
sqreen-1.23.2 lib/sqreen/actions/block_user.rb
sqreen-1.23.1 lib/sqreen/actions/block_user.rb
sqreen-1.23.0 lib/sqreen/actions/block_user.rb
sqreen-1.22.1 lib/sqreen/actions/block_user.rb