Class: Decidim::Admin::OrganizationExternalDomainAllowlistController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/decidim/admin/organization_external_domain_allowlist_controller.rb

Instance Method Summary collapse

Methods inherited from ApplicationController

#permission_class_chain, #permission_scope, #user_has_no_permission_path, #user_not_authorized_path

Instance Method Details

#editObject



12
13
14
15
# File 'app/controllers/decidim/admin/organization_external_domain_allowlist_controller.rb', line 12

def edit
  enforce_permission_to :update, :organization, organization: current_organization
  @form = form(OrganizationExternalDomainAllowlistForm).from_model(current_organization)
end

#updateObject



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'app/controllers/decidim/admin/organization_external_domain_allowlist_controller.rb', line 17

def update
  enforce_permission_to :update, :organization, organization: current_organization
  @form = form(OrganizationExternalDomainAllowlistForm).from_params(params)

  UpdateExternalDomainAllowlist.call(@form, current_organization) do
    on(:ok) do
      flash[:notice] = t("domain_allowlist.update.success", scope: "decidim.admin")
      redirect_to edit_organization_external_domain_allowlist_path
    end
    on(:invalid) do
      flash[:notice] = t("domain_allowlist.update.error", scope: "decidim.admin")
      render action: "edit"
    end
  end
end