Sha256: f6314cf33b157399dda7d6266364e3e7ecfa82b0fab4f6757545ed11317a1d46

Contents?: true

Size: 1.12 KB

Versions: 11

Compression:

Stored size: 1.12 KB

Contents

# typed: true

# 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

11 entries across 11 versions & 1 rubygems

Version Path
sqreen-1.22.0-java lib/sqreen/actions/block_user.rb
sqreen-1.22.0 lib/sqreen/actions/block_user.rb
sqreen-1.21.1-java lib/sqreen/actions/block_user.rb
sqreen-1.21.1 lib/sqreen/actions/block_user.rb
sqreen-1.21.0-java lib/sqreen/actions/block_user.rb
sqreen-1.21.0 lib/sqreen/actions/block_user.rb
sqreen-1.20.4-java lib/sqreen/actions/block_user.rb
sqreen-1.20.4 lib/sqreen/actions/block_user.rb
sqreen-1.21.0.beta3-java lib/sqreen/actions/block_user.rb
sqreen-1.21.0.beta3 lib/sqreen/actions/block_user.rb
sqreen-1.20.4.beta1 lib/sqreen/actions/block_user.rb