Module: Avo::Concerns::ChecksShowAuthorization

Extended by:
ActiveSupport::Concern
Includes:
ChecksAssocAuthorization
Included in:
Index::ResourceControlsComponent, Index::TableRowComponent
Defined in:
lib/avo/concerns/checks_show_authorization.rb

Instance Method Summary collapse

Methods included from ChecksAssocAuthorization

#authorize_association_for

Instance Method Details

#can_view?Boolean

Returns:

  • (Boolean)


8
9
10
11
12
13
14
15
# File 'lib/avo/concerns/checks_show_authorization.rb', line 8

def can_view?
  return false if Avo.configuration.resource_default_view.edit?

  return authorize_association_for(:show) if @reflection.present?

  # Even if there's a @reflection object present, for show we're going to fallback to the original policy.
  @resource.authorization.authorize_action(:show, raise_exception: false)
end