Class: Decidim::Admin::OfficializationsController
Overview
Controller that allows managing user officializations at the admin panel.
Instance Method Summary
collapse
#permission_class_chain, #permission_scope, #user_has_no_permission_path, #user_not_authorized_path
#disable_http_caching
#default_locale?
#snippets
register_permissions
enhance_controller, extended, included
Instance Method Details
#create ⇒ Object
28
29
30
31
32
33
34
35
36
37
38
39
40
|
# File 'decidim-admin/app/controllers/decidim/admin/officializations_controller.rb', line 28
def create
enforce_permission_to :create, :officialization
@form = form(OfficializationForm).from_params(params)
OfficializeUser.call(@form) do
on(:ok) do |user|
notice = I18n.t("officializations.create.success", scope: "decidim.admin")
redirect_to officializations_path(q: { name_or_nickname_or_email_cont: user.name }), notice:
end
end
end
|
#destroy ⇒ Object
42
43
44
45
46
47
48
49
50
51
52
|
# File 'decidim-admin/app/controllers/decidim/admin/officializations_controller.rb', line 42
def destroy
enforce_permission_to :destroy, :officialization
UnofficializeUser.call(user, current_user) do
on(:ok) do
notice = I18n.t("officializations.destroy.success", scope: "decidim.admin")
redirect_to officializations_path(q: { name_or_nickname_or_email_cont: user.name }), notice:
end
end
end
|
#index ⇒ Object
17
18
19
20
|
# File 'decidim-admin/app/controllers/decidim/admin/officializations_controller.rb', line 17
def index
enforce_permission_to :read, :officialization
@users = filtered_collection
end
|
#new ⇒ Object
22
23
24
25
26
|
# File 'decidim-admin/app/controllers/decidim/admin/officializations_controller.rb', line 22
def new
enforce_permission_to :create, :officialization
@form = form(OfficializationForm).from_model(user)
end
|
#show_email ⇒ Object
54
55
56
57
58
59
60
|
# File 'decidim-admin/app/controllers/decidim/admin/officializations_controller.rb', line 54
def show_email
enforce_permission_to(:show_email, :user, user:)
Decidim.traceability.perform_action! :show_email, user, current_user
render :show_email, layout: false
end
|