Class: Decidim::Verifications::AuthorizationsController
- Inherits:
-
ApplicationController
- Object
- DecidimController
- ApplicationController
- ApplicationController
- Decidim::Verifications::AuthorizationsController
- Includes:
- HtmlSafeFlash, UserProfile, Renewable
- Defined in:
- decidim-verifications/app/controllers/decidim/verifications/authorizations_controller.rb
Overview
This controller allows users to create and destroy their authorizations. It shouldn’t be necessary to expand it to add new authorization schemes.
Constant Summary
Constants included from RedesignLayout
RedesignLayout::FALLBACK_LAYOUT
Instance Method Summary collapse
Methods inherited from ApplicationController
Methods included from UserBlockedChecker
#check_user_block_status, #check_user_not_blocked
Methods included from NeedsSnippets
Methods included from HttpCachingDisabler
Methods included from HasStoredPath
Methods included from NeedsOrganization
enhance_controller, extended, included
Instance Method Details
#create ⇒ Object
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'decidim-verifications/app/controllers/decidim/verifications/authorizations_controller.rb', line 40 def create AuthorizeUser.call(handler, current_organization) do on(:ok) do flash[:notice] = t("authorizations.create.success", scope: "decidim.verifications") redirect_to redirect_url || end on(:transferred) do |transfer| = t("authorizations.create.success", scope: "decidim.verifications") if transfer.records.any? flash[:html_safe] = true = <<~HTML <p>#{CGI.escapeHTML()}</p> <p>#{CGI.escapeHTML(t("authorizations.create.transferred", scope: "decidim.verifications"))}</p> #{transfer.presenter.records_list_html} HTML end flash[:notice] = redirect_to redirect_url || end on(:invalid) do flash[:alert] = t("authorizations.create.error", scope: "decidim.verifications") render action: :new end end end |
#first_login ⇒ Object
30 31 32 33 34 35 36 37 38 |
# File 'decidim-verifications/app/controllers/decidim/verifications/authorizations_controller.rb', line 30 def first_login if .length == 1 redirect_to( action: :new, handler: .first.name, redirect_url: decidim.account_path ) end end |
#index ⇒ Object
23 24 25 26 27 28 |
# File 'decidim-verifications/app/controllers/decidim/verifications/authorizations_controller.rb', line 23 def index @granted_authorizations = @pending_authorizations = render layout: redesigned_layout("layouts/decidim/user_profile") end |
#new ⇒ Object
21 |
# File 'decidim-verifications/app/controllers/decidim/verifications/authorizations_controller.rb', line 21 def new; end |