Class: Decidim::DecidimAwesome::Admin::AdminAuthorizationsController
- Inherits:
-
ApplicationController
- Object
- Admin::ApplicationController
- ApplicationController
- Decidim::DecidimAwesome::Admin::AdminAuthorizationsController
- Includes:
- NeedsAwesomeConfig
- Defined in:
- app/controllers/decidim/decidim_awesome/admin/admin_authorizations_controller.rb
Instance Method Summary collapse
Methods included from NeedsAwesomeConfig
Methods inherited from ApplicationController
Instance Method Details
#destroy ⇒ Object
53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'app/controllers/decidim/decidim_awesome/admin/admin_authorizations_controller.rb', line 53 def destroy = if render_to_string("callout", locals: { i18n_key: "authorization_destroyed", klass: "success" }) else render_to_string("callout", locals: { i18n_key: "authorization_not_destroyed", klass: "alert" }) end render json: { message:, granted: granted?, userId: user.id, handler: workflow.name } end |
#edit ⇒ Object
18 19 20 |
# File 'app/controllers/decidim/decidim_awesome/admin/admin_authorizations_controller.rb', line 18 def edit render "authorization" if end |
#update ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'app/controllers/decidim/decidim_awesome/admin/admin_authorizations_controller.rb', line 22 def update if conflict = render_to_string("conflict") else = render_to_string("callout", locals: { i18n_key: "user_authorized", klass: "success" }) Decidim::Verifications::AuthorizeUser.call(handler, current_organization) do on(:transferred) do |transfer| += render_to_string("callout", locals: { i18n_key: "authorization_transferred", klass: "success" }) if transfer.records.any? end on(:invalid) do if force_verification.present? else callout = render_to_string("callout", locals: { i18n_key: "user_not_authorized", klass: "alert" }, layout: false) = render_to_string("edit", locals: { with_override: true, callout: }) end end on(:ok) do Decidim::ActionLogger.log("admin_creates_authorization", current_user, user, nil, user_id: user.id, handler: workflow.name, handler_name: workflow.fullname) end end end render json: { message:, granted: granted?, userId: user.id, handler: workflow.name } end |