Class: Decidim::AccessRequests::Verification::Admin::GrantedAuthorizationsController
- Inherits:
-
Decidim::Admin::ApplicationController
- Object
- Decidim::Admin::ApplicationController
- Decidim::AccessRequests::Verification::Admin::GrantedAuthorizationsController
show all
- Includes:
- DetectableVerificationManifest
- Defined in:
- app/controllers/decidim/access_requests/verification/admin/granted_authorizations_controller.rb
Instance Method Summary
collapse
#verification_manifest, #verification_manifest_handle
Instance Method Details
#create ⇒ Object
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
# File 'app/controllers/decidim/access_requests/verification/admin/granted_authorizations_controller.rb', line 44
def create
enforce_permission_to :create, :authorization, authorization: @authorization
@form = RequestForm.new(
handler_handle: verification_manifest.name
).with_context(current_organization: current_organization)
ConfirmUserAccessRequest.call(authorization, @form) do
on(:ok) do
flash[:notice] = t("pending_authorizations.update.success", scope: "decidim.access_requests.verification.admin")
redirect_to granted_authorizations_path
end
on(:invalid) do
flash[:alert] = t("pending_authorizations.update.error", scope: "decidim.access_requests.verification.admin")
redirect_to granted_authorizations_path
end
end
end
|
#destroy ⇒ Object
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
|
# File 'app/controllers/decidim/access_requests/verification/admin/granted_authorizations_controller.rb', line 64
def destroy
enforce_permission_to :destroy, :authorization, authorization: authorization
DestroyAuthorization.call(authorization) do
on(:ok) do
flash[:notice] = t("granted_authorizations.destroy.success", scope: "decidim.access_requests.verification.admin")
redirect_to granted_authorizations_path
end
on(:invalid) do
flash[:alert] = t("granted_authorizations.destroy.error", scope: "decidim.access_requests.verification.admin")
redirect_to granted_authorizations_path
end
end
end
|
#index ⇒ Object
18
19
20
21
22
|
# File 'app/controllers/decidim/access_requests/verification/admin/granted_authorizations_controller.rb', line 18
def index
enforce_permission_to :index, :authorization
@granted_authorizations = granted_authorizations
end
|
#new ⇒ Object
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
# File 'app/controllers/decidim/access_requests/verification/admin/granted_authorizations_controller.rb', line 24
def new
enforce_permission_to :read, :authorization
@query = params[:q]
@state = params[:state]
authorized_user_ids = granted_authorizations.pluck(:decidim_user_id)
@users =
Decidim::Admin::UserFilter.for(
current_organization.users.not_deleted
.where.not(
id: authorized_user_ids
),
@query,
@state
)
.page(params[:page])
.per(15)
end
|