Sha256: 93d09db82d764f21f3295e163db32b9f2cf7fd4a2fefb6ac190a293ed3fad35d

Contents?: true

Size: 976 Bytes

Versions: 61

Compression:

Stored size: 976 Bytes

Contents

class Avo::Current < ActiveSupport::CurrentAttributes
  attribute :app
  attribute :license
  attribute :context
  attribute :user
  attribute :view_context
  attribute :error_manager
  attribute :resource_manager
  attribute :tool_manager
  attribute :plugin_manager
  attribute :locale

  # The tenant attributes are here so the user can add them on their own will
  attribute :tenant_id
  attribute :tenant

  # Protect from error #<RuntimeError: Missing rack.input> when request is ActionDispatch::Request.empty
  def params
    request.params
  rescue
    {}
  end

  def request
    view_context&.request || ActionDispatch::Request.empty
  end

  def user_is_admin?
    return false unless user&.respond_to?(Avo.configuration.is_admin_method)

    user.send(Avo.configuration.is_admin_method)
  end

  def user_is_developer?
    return false unless user&.respond_to?(Avo.configuration.is_developer_method)

    user.send(Avo.configuration.is_developer_method)
  end
end

Version data entries

61 entries across 61 versions & 1 rubygems

Version Path
avo-3.17.3 lib/avo/current.rb
avo-3.17.5.tw4 lib/avo/current.rb
avo-3.17.4.tw4 lib/avo/current.rb
avo-3.17.3.tw4 lib/avo/current.rb
avo-3.17.2.tw4 lib/avo/current.rb
avo-3.17.2 lib/avo/current.rb
avo-3.17.1.tw4 lib/avo/current.rb
avo-3.17.1 lib/avo/current.rb
avo-3.17.0 lib/avo/current.rb
avo-3.16.6 lib/avo/current.rb
avo-3.16.5 lib/avo/current.rb
avo-3.16.4 lib/avo/current.rb
avo-3.16.3 lib/avo/current.rb
avo-3.16.2 lib/avo/current.rb
avo-3.16.1 lib/avo/current.rb
avo-3.16.0 lib/avo/current.rb
avo-3.15.7 lib/avo/current.rb
avo-3.15.6 lib/avo/current.rb
avo-3.15.5 lib/avo/current.rb
avo-3.15.4 lib/avo/current.rb