Sha256: 30fc4702ce209a915fe00e572225b01bf9ac33b3f000de997ddeeff42cb34f95

Contents?: true

Size: 1.03 KB

Versions: 19

Compression:

Stored size: 1.03 KB

Contents

## Setup

Enable authorization in your application by calling `active_element.authenticate_with` and `active_element.authorize_with` from a `prepend_before_action`. For example, if you are using [Devise](https://github.com/heartcombo/devise):

```ruby
# app/controllers/application_controller.rb

class ApplicationController < ActionController::Base
  prepend_before_action :configure_authentication

  private

  def configure_authentication
    active_element.authenticate_with { authenticate_user! }
    active_element.authorize_with { current_user }
  end
end
```

Adjust the provided example to suit your application's authentication framework.

As long as the following conditions are met then your application is ready to use _ActiveElement's_ authorization system:

* The method in the block sent to `active_element.authenticate_with` renders or redirects on authentication failure.
* The method in the block sent to `active_element.authorize_with` returns an object that implements a `#permissions` method which returns an array of strings.


Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
active_element-0.0.31 rspec-documentation/pages/020-Access Control/020-Authorization/Setup.md
active_element-0.0.30 rspec-documentation/pages/020-Access Control/020-Authorization/Setup.md
active_element-0.0.29 rspec-documentation/pages/020-Access Control/020-Authorization/Setup.md
active_element-0.0.28 rspec-documentation/pages/020-Access Control/020-Authorization/Setup.md
active_element-0.0.27 rspec-documentation/pages/020-Access Control/020-Authorization/Setup.md
active_element-0.0.26 rspec-documentation/pages/020-Access Control/020-Authorization/Setup.md
active_element-0.0.24 rspec-documentation/pages/020-Access Control/020-Authorization/Setup.md
active_element-0.0.23 rspec-documentation/pages/020-Access Control/020-Authorization/Setup.md
active_element-0.0.22 rspec-documentation/pages/020-Access Control/020-Authorization/Setup.md
active_element-0.0.21 rspec-documentation/pages/020-Access Control/020-Authorization/Setup.md
active_element-0.0.19 rspec-documentation/pages/020-Access Control/020-Authorization/Setup.md
active_element-0.0.18 rspec-documentation/pages/020-Access Control/020-Authorization/Setup.md
active_element-0.0.17 rspec-documentation/pages/020-Access Control/020-Authorization/Setup.md
active_element-0.0.16 rspec-documentation/pages/020-Access Control/020-Authorization/Setup.md
active_element-0.0.15 rspec-documentation/pages/020-Access Control/020-Authorization/Setup.md
active_element-0.0.14 rspec-documentation/pages/020-Access Control/020-Authorization/Setup.md
active_element-0.0.13 rspec-documentation/pages/020-Access Control/020-Authorization/Setup.md
active_element-0.0.12 rspec-documentation/pages/020-Access Control/020-Authorization/Setup.md
active_element-0.0.11 rspec-documentation/pages/020-Access Control/020-Authorization/Setup.md