Class: Decidim::Admin::BlockUserController
Instance Method Summary
collapse
#permission_class_chain, #permission_scope, #user_has_no_permission_path, #user_not_authorized_path
Instance Method Details
#create ⇒ Object
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
# File 'app/controllers/decidim/admin/block_user_controller.rb', line 17
def create
enforce_permission_to :block, :admin_user
@form = form(BlockUserForm).from_params(params)
BlockUser.call(@form) do
on(:ok) do
flash[:notice] = I18n.t("officializations.block.success", scope: "decidim.admin")
redirect_to moderated_users_path(blocked: true), notice:
end
on(:invalid) do
flash[:alert] = I18n.t("officializations.block.error", scope: "decidim.admin")
render :new
end
end
end
|
#destroy ⇒ Object
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
# File 'app/controllers/decidim/admin/block_user_controller.rb', line 35
def destroy
enforce_permission_to :block, :admin_user
UnblockUser.call(user, current_user) do
on(:ok) do
flash[:notice] = I18n.t("officializations.unblock.success", scope: "decidim.admin")
end
on(:invalid) do
flash[:alert] = I18n.t("officializations.unblock.error", scope: "decidim.admin")
end
end
redirect_to moderated_users_path, notice:
end
|
#new ⇒ Object
10
11
12
13
14
15
|
# File 'app/controllers/decidim/admin/block_user_controller.rb', line 10
def new
enforce_permission_to :block, :admin_user
@form = form(BlockUserForm).from_model(user)
@form.hide = params[:hide] || false
end
|