Class: Decidim::AuthorizationsController
Overview
This controller allows users to create and destroy their authorizations. It shouldn’t be necessary to expand it to add new authorization schemes.
Instance Method Summary
collapse
#available_authorization_handlers
Instance Method Details
#create ⇒ Object
35
36
37
38
39
40
41
42
43
44
45
46
47
|
# File 'app/controllers/decidim/authorizations_controller.rb', line 35
def create
AuthorizeUser.call(handler) do
on(:ok) do
flash[:notice] = t("authorizations.create.success", scope: "decidim")
redirect_to params[:redirect_url] || stored_location_for(current_user) || authorizations_path
end
on(:invalid) do
flash[:alert] = t("authorizations.create.error", scope: "decidim")
render action: :new
end
end
end
|
#first_login ⇒ Object
25
26
27
28
29
30
31
32
33
|
# File 'app/controllers/decidim/authorizations_controller.rb', line 25
def first_login
if handlers.length == 1
redirect_to(
action: :new,
handler: handlers.first.handler_name,
redirect_url: account_path
)
end
end
|
#handler ⇒ Object
49
50
51
|
# File 'app/controllers/decidim/authorizations_controller.rb', line 49
def handler
@handler ||= AuthorizationHandler.handler_for(handler_name, handler_params)
end
|
#index ⇒ Object
21
22
23
|
# File 'app/controllers/decidim/authorizations_controller.rb', line 21
def index
@authorizations = current_user.authorizations
end
|
#new ⇒ Object
19
|
# File 'app/controllers/decidim/authorizations_controller.rb', line 19
def new; end
|