# app/avo/actions/global_report.rb
class Avo::Actions::GlobalReport < Avo::BaseAction
  self.name = "Generate Global Report"
  self.standalone = true
  self.visible = true

  # Or as a block
  self.visible = -> { view.index? }
end
```

The `visible` attribute accepts a boolean or a block.

The block will be executed within the `Avo::ExecutionContext` environment, giving you access to important contextual attributes like:
- `view` - The current view type (index, show, edit)
- `resource` - The current resource instance
- `parent_resource` - The parent resource (if applicable).
  - You can access the `parent_record` by `parent_resource.record`
- Plus all other `Avo::ExecutionContext` default attributes
</Option>

<Option name="`authorize`" headingSize=3>

The `authorize` attribute is used to restrict access to actions based on custom logic.

If an action is unauthorized, it will be hidden. If a bad actor attempts to proceed with the action, the controller will re-evaluate the authorization and block unauthorized requests.

```ruby{2,4-7}
class Avo::Actions::GlobalReport < Avo::BaseAction
  self.authorize = false

  # Or as a block
  self.authorize = -> {
    current_user.is_admin?
  }
end
```

The `authorize` attribute accepts a boolean or a proc.

The block will be executed within the `Avo::ExecutionContext` environment, giving you access to important contextual attributes like:
- `action` - The current action instance
- `resource` - The current resource instance
- `view` - The current view type (index, show, edit)
- All other `Avo::ExecutionContext` attributes

</Option>

<Option name="`close_modal_on_backdrop_click`" headingSize=3>

<VersionReq version="3.14.0" class="mt-4" />

By default, action modals use a dynamic backdrop.

Add `self.close_modal_on_backdrop_click = false` in case you want to prevent the user from closing the modal when clicking on the backdrop.

```ruby{3}