W3cubDocs

/Padrino

Module: Padrino::Admin::Helpers::AuthenticationHelpers

Overview

Common helpers used for authorization within an application.

Instance Method Summary

Instance Method Details

#allowed? ⇒ Boolean

Returns true if the current_account is allowed to see the requested path.

For configure this role please refer to: Padrino::Admin::AccessControl::Base

Returns:

  • (Boolean)

#current_account ⇒ Object

Returns the current_account, it's an instance of Account model.

#logged_in? ⇒ Boolean

Returns true if current_account is logged and active.

Returns:

  • (Boolean)

#login_required ⇒ Object

Returns a helper useful in a before_filter for check if an account are: logged_in? and allowed?

By default this method is used in Admin Apps.

#project_modules ⇒ Object

Returns project modules for the current account.

#redirect_back_or_default(default) ⇒ Object

Redirect the account to the page that requested an authentication or if the account is not allowed/logged return it to a default page.

#set_current_account(account = nil) ⇒ Object

Override the current_account, you must provide an instance of Account model.

Examples:

set_current_account(Account.authenticate(params[:email], params[:password])

#store_location! ⇒ Object

Store in session the env.