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
Instance Method Details
#create ⇒ Object
26
27
28
29
30
31
32
33
34
35
36
37
38
|
# File 'app/controllers/decidim/admin/officializations_controller.rb', line 26
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: notice
end
end
end
|
#destroy ⇒ Object
40
41
42
43
44
45
46
47
48
49
50
|
# File 'app/controllers/decidim/admin/officializations_controller.rb', line 40
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: notice
end
end
end
|
#index ⇒ Object
15
16
17
18
|
# File 'app/controllers/decidim/admin/officializations_controller.rb', line 15
def index
enforce_permission_to :read, :officialization
@users = filtered_collection
end
|
#new ⇒ Object
20
21
22
23
24
|
# File 'app/controllers/decidim/admin/officializations_controller.rb', line 20
def new
enforce_permission_to :create, :officialization
@form = form(OfficializationForm).from_model(user)
end
|
#show_email ⇒ Object
52
53
54
55
56
57
58
|
# File 'app/controllers/decidim/admin/officializations_controller.rb', line 52
def show_email
enforce_permission_to :show_email, :user, user: user
Decidim.traceability.perform_action! :show_email, user, current_user
render :show_email, layout: false
end
|