Class: Decidim::Verifications::Admin::VerificationsController

Inherits:
Admin::ApplicationController show all
Defined in:
decidim-verifications/app/controllers/decidim/verifications/admin/verifications_controller.rb

Instance Method Summary collapse

Methods inherited from Admin::ApplicationController

#permission_class_chain, #permission_scope, #user_has_no_permission_path, #user_not_authorized_path

Methods included from HttpCachingDisabler

#disable_http_caching

Methods included from NeedsSnippets

#snippets

Methods included from RegistersPermissions

register_permissions

Methods included from NeedsOrganization

enhance_controller, extended, included

Instance Method Details

#destroy_allObject


24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'decidim-verifications/app/controllers/decidim/verifications/admin/verifications_controller.rb', line 24

def destroy_all
  enforce_permission_to :destroy, :authorization
  RevokeAllAuthorizations.call(current_organization, current_user) do
    on(:ok) do
      flash[:notice] = t("authorization_revocation.destroy_ok", scope: "decidim.admin.menu")
      redirect_to decidim_admin.authorization_workflows_url
    end
    on(:invalid) do
      flash.now[:alert] = t("authorization_revocation.destroy_nok", scope: "decidim.admin.menu")
      redirect_to decidim_admin.authorization_workflows_url
    end
  end
end

#destroy_before_dateObject


7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'decidim-verifications/app/controllers/decidim/verifications/admin/verifications_controller.rb', line 7

def destroy_before_date
  enforce_permission_to :destroy, :authorization
  return unless params.has_key?(:revocations_before_date)

  form = RevocationsBeforeDateForm.from_params(params[:revocations_before_date])
  RevokeByConditionAuthorizations.call(current_organization, current_user, form) do
    on(:ok) do
      flash[:notice] = t("authorization_revocation.destroy_ok", scope: "decidim.admin.menu")
      redirect_to decidim_admin.authorization_workflows_url
    end
    on(:invalid) do
      flash.now[:alert] = t("authorization_revocation.destroy_nok", scope: "decidim.admin.menu")
      redirect_to decidim_admin.authorization_workflows_url
    end
  end
end