decidim-admin 0.31.7 → 0.31.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/cells/decidim/admin/results_per_page_cell.rb +1 -1
- data/app/commands/decidim/admin/block_user.rb +2 -0
- data/app/commands/decidim/admin/bulk_block_users.rb +2 -0
- data/app/commands/decidim/admin/close_session_managed_user.rb +2 -0
- data/app/commands/decidim/admin/create_participatory_space_private_user.rb +2 -2
- data/app/commands/decidim/admin/participatory_space/create_admin.rb +2 -0
- data/app/commands/decidim/admin/promote_managed_user.rb +1 -1
- data/app/commands/decidim/admin/reorder_taxonomies.rb +2 -2
- data/app/commands/decidim/admin/update_help_sections.rb +4 -0
- data/app/controllers/concerns/decidim/admin/content_blocks/landing_page.rb +5 -5
- data/app/controllers/concerns/decidim/admin/filterable.rb +1 -1
- data/app/controllers/concerns/decidim/admin/global_moderation_context.rb +2 -0
- data/app/controllers/concerns/decidim/admin/participatory_space_admin_context.rb +2 -0
- data/app/controllers/concerns/decidim/admin/participatory_space_export.rb +2 -0
- data/app/controllers/decidim/admin/admin_terms_controller.rb +1 -0
- data/app/controllers/decidim/admin/application_controller.rb +4 -0
- data/app/controllers/decidim/admin/block_user_controller.rb +2 -0
- data/app/controllers/decidim/admin/components/base_controller.rb +12 -7
- data/app/controllers/decidim/admin/components_controller.rb +2 -2
- data/app/controllers/decidim/admin/concerns/has_attachment_collections.rb +2 -0
- data/app/controllers/decidim/admin/concerns/has_attachments.rb +2 -0
- data/app/controllers/decidim/admin/concerns/has_breadcrumb_items.rb +4 -0
- data/app/controllers/decidim/admin/concerns/has_private_users.rb +4 -0
- data/app/controllers/decidim/admin/concerns/has_private_users_csv_import.rb +3 -1
- data/app/controllers/decidim/admin/conflicts_controller.rb +5 -5
- data/app/controllers/decidim/admin/global_moderations/reports_controller.rb +2 -0
- data/app/controllers/decidim/admin/global_moderations_controller.rb +2 -0
- data/app/controllers/decidim/admin/help_sections_controller.rb +3 -3
- data/app/controllers/decidim/admin/impersonations_controller.rb +2 -1
- data/app/controllers/decidim/admin/managed_users/impersonation_logs_controller.rb +1 -1
- data/app/controllers/decidim/admin/moderated_users_controller.rb +3 -0
- data/app/controllers/decidim/admin/moderations_controller.rb +4 -0
- data/app/controllers/decidim/admin/newsletter_templates_controller.rb +4 -1
- data/app/controllers/decidim/admin/newsletters_controller.rb +3 -0
- data/app/controllers/decidim/admin/organization_homepage_controller.rb +7 -3
- data/app/controllers/decidim/admin/resource_permissions_controller.rb +4 -0
- data/app/controllers/decidim/admin/static_pages_controller.rb +27 -25
- data/app/controllers/decidim/admin/taxonomy_filters_controller.rb +2 -2
- data/app/controllers/decidim/admin/taxonomy_filters_selector_controller.rb +1 -1
- data/app/controllers/decidim/admin/taxonomy_items_controller.rb +5 -2
- data/app/jobs/decidim/admin/newsletter_job.rb +0 -1
- data/app/packs/src/decidim/admin/officializations.js +11 -2
- data/app/packs/stylesheets/decidim/admin/_proposal_status.scss +28 -0
- data/app/packs/stylesheets/decidim/admin/_select_picker.scss +1 -1
- data/app/packs/stylesheets/decidim/admin/_sidebar-menu.scss +3 -1
- data/app/permissions/decidim/admin/permissions.rb +16 -0
- data/app/views/decidim/admin/organization/form/_extra_features.html.erb +18 -2
- data/app/views/layouts/decidim/admin/_js_configuration.html.erb +1 -0
- data/config/locales/bg.yml +2 -0
- data/config/locales/ca-IT.yml +4 -0
- data/config/locales/ca.yml +6 -2
- data/config/locales/cs.yml +5 -0
- data/config/locales/de.yml +26 -1
- data/config/locales/en.yml +4 -0
- data/config/locales/es-MX.yml +4 -0
- data/config/locales/es-PY.yml +4 -0
- data/config/locales/es.yml +4 -0
- data/config/locales/eu.yml +57 -53
- data/config/locales/fi-plain.yml +4 -0
- data/config/locales/fi.yml +4 -0
- data/config/locales/fr-CA.yml +4 -0
- data/config/locales/fr.yml +4 -0
- data/config/locales/gl.yml +611 -50
- data/config/locales/ja.yml +4 -0
- data/config/locales/sk.yml +17 -0
- data/config/locales/sv.yml +32 -1
- data/config/routes.rb +0 -1
- data/lib/decidim/admin/import/readers.rb +5 -2
- data/lib/decidim/admin/menu.rb +0 -1
- data/lib/decidim/admin/version.rb +1 -1
- metadata +8 -9
- data/app/controllers/decidim/admin/organization_appearance_controller.rb +0 -34
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 431487687e46389c6feffcf7be74e6ac45e601e3b12d75755857368db48a368f
|
|
4
|
+
data.tar.gz: 3690b60ce67c65b98f6b263839df3b41c65b1202300c2cda1aee773ee059cbf9
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 4d26c54ab7e0a610bbe5eee7dcbd34fb7bee44960c519a889e3399d18f46d9c216f0a3a3f02e4792858aec52a348902882bcb5063e1f5585591af0d3f68f8906
|
|
7
|
+
data.tar.gz: 07a8883c6685b5e14d0ec92dc4d5c25e192d0013522c4b54cf105e6a8ff4fb6a2066a06ceebddec49184a41bf1523207db573f789ec875891813fe85baa2c9bb
|
|
@@ -5,7 +5,7 @@ module Decidim
|
|
|
5
5
|
class ResultsPerPageCell < Decidim::ViewModel
|
|
6
6
|
property :per_page, :per_page_range
|
|
7
7
|
def path_for_num_per_page(num_per_page = per_page_range.first)
|
|
8
|
-
controller.url_for(params
|
|
8
|
+
controller.url_for(decidim_url_params(params, per_page: num_per_page))
|
|
9
9
|
end
|
|
10
10
|
end
|
|
11
11
|
end
|
|
@@ -45,7 +45,9 @@ module Decidim
|
|
|
45
45
|
end
|
|
46
46
|
|
|
47
47
|
def find_or_create_moderation!
|
|
48
|
+
# rubocop:disable Decidim/OrganizationScopedFinder -- form.user is scoped to the current organization
|
|
48
49
|
Decidim::UserModeration.find_or_create_by!(user: form.user)
|
|
50
|
+
# rubocop:enable Decidim/OrganizationScopedFinder
|
|
49
51
|
end
|
|
50
52
|
|
|
51
53
|
def register_justification!
|
|
@@ -49,7 +49,9 @@ module Decidim
|
|
|
49
49
|
def block_all_users!
|
|
50
50
|
form.users.each do |user|
|
|
51
51
|
transaction do
|
|
52
|
+
# rubocop:disable Decidim/OrganizationScopedFinder -- form.users is scoped to the current organization
|
|
52
53
|
Decidim::UserModeration.find_or_create_by!(user:)
|
|
54
|
+
# rubocop:enable Decidim/OrganizationScopedFinder
|
|
53
55
|
|
|
54
56
|
@current_blocking = UserBlock.create!(
|
|
55
57
|
justification: form.justification,
|
|
@@ -32,7 +32,9 @@ module Decidim
|
|
|
32
32
|
private
|
|
33
33
|
|
|
34
34
|
def impersonation_log
|
|
35
|
+
# rubocop:disable Decidim/OrganizationScopedFinder -- admin and user are the current session users
|
|
35
36
|
@impersonation_log ||= Decidim::ImpersonationLog.where(admin: current_user, user:).active.first
|
|
37
|
+
# rubocop:enable Decidim/OrganizationScopedFinder
|
|
36
38
|
end
|
|
37
39
|
|
|
38
40
|
def close_session
|
|
@@ -51,7 +51,7 @@ module Decidim
|
|
|
51
51
|
title: user.name
|
|
52
52
|
}
|
|
53
53
|
) do
|
|
54
|
-
Decidim::ParticipatorySpacePrivateUser.find_or_create_by!(
|
|
54
|
+
Decidim::ParticipatorySpacePrivateUser.find_or_create_by!( # rubocop:disable Decidim/OrganizationScopedFinder -- user and participatory_space are scoped to the current invitation
|
|
55
55
|
user:,
|
|
56
56
|
privatable_to: @private_user_to,
|
|
57
57
|
role: form.role,
|
|
@@ -63,7 +63,7 @@ module Decidim
|
|
|
63
63
|
def existing_user
|
|
64
64
|
return @existing_user if defined?(@existing_user)
|
|
65
65
|
|
|
66
|
-
@existing_user = User.find_by(
|
|
66
|
+
@existing_user = User.find_by( # rubocop:disable Decidim/OrganizationScopedFinder -- user and participatory_space are scoped to the current invitation
|
|
67
67
|
email: form.email.downcase,
|
|
68
68
|
organization: private_user_to.organization
|
|
69
69
|
)
|
|
@@ -120,7 +120,9 @@ module Decidim
|
|
|
120
120
|
def existing_user
|
|
121
121
|
return @existing_user if defined?(@existing_user)
|
|
122
122
|
|
|
123
|
+
# rubocop:disable Decidim/OrganizationScopedFinder -- organization is the participatory space's organization
|
|
123
124
|
@existing_user = User.find_by(email: form.email, organization: participatory_space.organization)
|
|
125
|
+
# rubocop:enable Decidim/OrganizationScopedFinder
|
|
124
126
|
|
|
125
127
|
InviteUserAgain.call(@existing_user, invitation_instructions) if @existing_user&.invitation_pending?
|
|
126
128
|
|
|
@@ -65,11 +65,11 @@ module Decidim
|
|
|
65
65
|
end
|
|
66
66
|
|
|
67
67
|
def collection
|
|
68
|
-
@collection ||=
|
|
68
|
+
@collection ||= organization.taxonomies.where(parent_id: first_item.parent_id)
|
|
69
69
|
end
|
|
70
70
|
|
|
71
71
|
def first_item
|
|
72
|
-
@first_item ||=
|
|
72
|
+
@first_item ||= organization.taxonomies.find(order.first)
|
|
73
73
|
end
|
|
74
74
|
end
|
|
75
75
|
end
|
|
@@ -21,7 +21,9 @@ module Decidim
|
|
|
21
21
|
|
|
22
22
|
Decidim.traceability.perform_action!("update", ContextualHelpSection, current_user, { "resource" => { "title" => section.id.humanize } }) do
|
|
23
23
|
ContextualHelpSection.set_content(@organization, section.id, section.content)
|
|
24
|
+
# rubocop:disable Decidim/OrganizationScopedFinder -- scoped to the given organization and section
|
|
24
25
|
ContextualHelpSection.find_by(organization: @organization, section_id: section.id)
|
|
26
|
+
# rubocop:enable Decidim/OrganizationScopedFinder
|
|
25
27
|
end
|
|
26
28
|
end
|
|
27
29
|
end
|
|
@@ -34,7 +36,9 @@ module Decidim
|
|
|
34
36
|
attr_reader :form
|
|
35
37
|
|
|
36
38
|
def content_has_changed?(section)
|
|
39
|
+
# rubocop:disable Decidim/OrganizationScopedFinder -- scoped to the given organization and section
|
|
37
40
|
return if ContextualHelpSection.find_by(organization: @organization, section_id: section.id).nil? && section.content.compact_blank.blank?
|
|
41
|
+
# rubocop:enable Decidim/OrganizationScopedFinder
|
|
38
42
|
|
|
39
43
|
section.content != ContextualHelpSection.find_content(@organization, section.id).except("machine_translations")
|
|
40
44
|
end
|
|
@@ -9,7 +9,7 @@ module Decidim
|
|
|
9
9
|
helper_method :active_blocks, :active_content_blocks_title, :add_content_block_text, :available_manifests,
|
|
10
10
|
:content_block_destroy_confirmation_text, :content_blocks_title, :inactive_blocks,
|
|
11
11
|
:inactive_content_blocks_title, :resource_content_block_cell, :resource_create_url,
|
|
12
|
-
:resource_sort_url
|
|
12
|
+
:resource_sort_url, :scoped_resource
|
|
13
13
|
def edit
|
|
14
14
|
enforce_permission_to_update_resource
|
|
15
15
|
|
|
@@ -29,10 +29,6 @@ module Decidim
|
|
|
29
29
|
end
|
|
30
30
|
end
|
|
31
31
|
|
|
32
|
-
# Method that specifies the i18n scope for this controller. This can be overwritten in your controller.
|
|
33
|
-
# so that you can pass a different scope to the i18n methods.
|
|
34
|
-
def i18n_scope = "decidim.admin.content_blocks"
|
|
35
|
-
|
|
36
32
|
# Method to be implemented at the controller. Returns a string
|
|
37
33
|
# with the text for the title of content blocks
|
|
38
34
|
#
|
|
@@ -70,6 +66,10 @@ module Decidim
|
|
|
70
66
|
|
|
71
67
|
private
|
|
72
68
|
|
|
69
|
+
# Method that specifies the i18n scope for this controller. This can be overwritten in your controller.
|
|
70
|
+
# so that you can pass a different scope to the i18n methods.
|
|
71
|
+
def i18n_scope = "decidim.admin.content_blocks"
|
|
72
|
+
|
|
73
73
|
# Method to be implemented at the controller. You need to
|
|
74
74
|
# return a symbol that defines the content block scope.
|
|
75
75
|
# Examples of scopes could be `:homepage` or `:landing_page`.
|
|
@@ -195,7 +195,7 @@ module Decidim
|
|
|
195
195
|
|
|
196
196
|
# A tree of Taxonomy IDs. Leaves are `nil`.
|
|
197
197
|
def taxonomy_ids_hash(taxonomies)
|
|
198
|
-
filtered_taxonomies = taxonomies.roots.or(taxonomies.where(id: available_taxonomy_ids))
|
|
198
|
+
filtered_taxonomies = taxonomies.roots.or(taxonomies.where(id: available_taxonomy_ids)) # rubocop:disable Decidim/OrganizationScopedFinder -- taxonomies is scoped to current_organization through available_root_taxonomies
|
|
199
199
|
return nil if filtered_taxonomies.blank?
|
|
200
200
|
|
|
201
201
|
filtered_taxonomies.each_with_object({}) do |taxonomy, hash|
|
|
@@ -8,6 +8,8 @@ module Decidim
|
|
|
8
8
|
extend ActiveSupport::Concern
|
|
9
9
|
|
|
10
10
|
class_methods do
|
|
11
|
+
protected
|
|
12
|
+
|
|
11
13
|
# Public: Called on a controller, it sets up all the surrounding methods to render a
|
|
12
14
|
# participatory space's admin template. It expects the method `current_participatory_space`
|
|
13
15
|
# to be defined, from which it will extract the participatory manifest.
|
|
@@ -6,6 +6,7 @@ module Decidim
|
|
|
6
6
|
# Terms of service agreement.
|
|
7
7
|
class AdminTermsController < Decidim::Admin::ApplicationController
|
|
8
8
|
def accept
|
|
9
|
+
enforce_permission_to :accept, :admin_terms
|
|
9
10
|
current_user.admin_terms_accepted_at = Time.current
|
|
10
11
|
if current_user.save!
|
|
11
12
|
flash[:notice] = t("accept.success", scope: "decidim.admin.admin_terms_of_service")
|
|
@@ -19,6 +19,7 @@ module Decidim
|
|
|
19
19
|
include DisableRedirectionToExternalHost
|
|
20
20
|
include Decidim::Admin::Concerns::HasBreadcrumbItems
|
|
21
21
|
include ActiveStorage::SetCurrent
|
|
22
|
+
include Decidim::UrlHelper
|
|
22
23
|
|
|
23
24
|
helper Decidim::Admin::ApplicationHelper
|
|
24
25
|
helper Decidim::Admin::AttributesDisplayHelper
|
|
@@ -34,6 +35,7 @@ module Decidim
|
|
|
34
35
|
helper Decidim::ComponentPathHelper
|
|
35
36
|
helper Decidim::SanitizeHelper
|
|
36
37
|
helper Decidim::BreadcrumbHelper
|
|
38
|
+
helper Decidim::UrlHelper
|
|
37
39
|
|
|
38
40
|
helper Decidim::Templates::Admin::ApplicationHelper if Decidim.module_installed?(:templates) && defined?(Decidim::Templates::Admin::ApplicationHelper)
|
|
39
41
|
|
|
@@ -44,6 +46,8 @@ module Decidim
|
|
|
44
46
|
register_permissions(::Decidim::Admin::ApplicationController,
|
|
45
47
|
::Decidim::Admin::Permissions)
|
|
46
48
|
|
|
49
|
+
protected
|
|
50
|
+
|
|
47
51
|
def user_has_no_permission_path
|
|
48
52
|
decidim_admin.root_path
|
|
49
53
|
end
|
|
@@ -57,6 +57,7 @@ module Decidim
|
|
|
57
57
|
end
|
|
58
58
|
|
|
59
59
|
def bulk_create
|
|
60
|
+
enforce_permission_to :block, :admin_user
|
|
60
61
|
@form = form(BlockUsersForm).from_params(params)
|
|
61
62
|
|
|
62
63
|
Admin::BulkBlockUsers.call(@form) do
|
|
@@ -73,6 +74,7 @@ module Decidim
|
|
|
73
74
|
end
|
|
74
75
|
|
|
75
76
|
def bulk_destroy
|
|
77
|
+
enforce_permission_to :block, :admin_user
|
|
76
78
|
Admin::BulkUnblockUsers.call(blocked_users, current_user) do
|
|
77
79
|
on(:ok) do
|
|
78
80
|
flash[:notice] = I18n.t("officializations.bulk_action.unblock.success", scope: "decidim.admin")
|
|
@@ -23,13 +23,7 @@ module Decidim
|
|
|
23
23
|
:current_participatory_space,
|
|
24
24
|
:parent_path
|
|
25
25
|
|
|
26
|
-
before_action
|
|
27
|
-
enforce_permission_to :manage, :component, component: current_component unless skip_manage_component_permission
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
before_action on: [:index, :show] do
|
|
31
|
-
enforce_permission_to :read, :component, component: current_component
|
|
32
|
-
end
|
|
26
|
+
before_action :enforce_component_permissions
|
|
33
27
|
|
|
34
28
|
before_action :set_component_breadcrumb_item
|
|
35
29
|
|
|
@@ -68,6 +62,17 @@ module Decidim
|
|
|
68
62
|
false
|
|
69
63
|
end
|
|
70
64
|
|
|
65
|
+
def enforce_component_permissions
|
|
66
|
+
case action_name.to_sym
|
|
67
|
+
when :index, :show
|
|
68
|
+
enforce_permission_to :read, :component, component: current_component
|
|
69
|
+
else
|
|
70
|
+
enforce_permission_to :manage, :component, component: current_component unless skip_manage_component_permission
|
|
71
|
+
end
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
protected
|
|
75
|
+
|
|
71
76
|
def set_component_breadcrumb_item
|
|
72
77
|
context_breadcrumb_items << {
|
|
73
78
|
label: t("components", scope: "decidim.admin.menu"),
|
|
@@ -86,7 +86,7 @@ module Decidim
|
|
|
86
86
|
|
|
87
87
|
Decidim::Commands::SoftDeleteResource.call(trashable_deleted_resource, current_user) do
|
|
88
88
|
on(:ok) do
|
|
89
|
-
Decidim::Reminder.where(component: resource).destroy_all
|
|
89
|
+
Decidim::Reminder.where(component: resource).destroy_all # rubocop:disable Decidim/OrganizationScopedFinder -- resource is the soft-deleted component, already scoped to current_participatory_space via query_scope
|
|
90
90
|
flash[:notice] = I18n.t("soft_delete.success", scope: trashable_i18n_scope, resource_name: human_readable_resource_name.capitalize)
|
|
91
91
|
redirect_to_resource_index
|
|
92
92
|
end
|
|
@@ -135,9 +135,9 @@ module Decidim
|
|
|
135
135
|
end
|
|
136
136
|
|
|
137
137
|
def share
|
|
138
|
+
enforce_permission_to :share, :component
|
|
138
139
|
@component = query_scope.find(params[:id])
|
|
139
140
|
share_token = @component.share_tokens.create!(user: current_user, organization: current_organization)
|
|
140
|
-
|
|
141
141
|
redirect_to share_token.url
|
|
142
142
|
end
|
|
143
143
|
|
|
@@ -82,6 +82,8 @@ module Decidim
|
|
|
82
82
|
redirect_to after_destroy_path
|
|
83
83
|
end
|
|
84
84
|
|
|
85
|
+
protected
|
|
86
|
+
|
|
85
87
|
# Public: Returns a String or Object that will be passed to `redirect_to` after
|
|
86
88
|
# destroying an attachment collection. By default it redirects to the object
|
|
87
89
|
# that holds the attachment collection.
|
|
@@ -7,12 +7,16 @@ module Decidim
|
|
|
7
7
|
extend ActiveSupport::Concern
|
|
8
8
|
|
|
9
9
|
class_methods do
|
|
10
|
+
protected
|
|
11
|
+
|
|
10
12
|
def add_breadcrumb_item_from_menu(target_menu, opts = {})
|
|
11
13
|
before_action -> { secondary_breadcrumb_menus << target_menu }, opts
|
|
12
14
|
end
|
|
13
15
|
end
|
|
14
16
|
|
|
15
17
|
included do
|
|
18
|
+
protected
|
|
19
|
+
|
|
16
20
|
def secondary_breadcrumb_menus
|
|
17
21
|
@secondary_breadcrumb_menus ||= []
|
|
18
22
|
end
|
|
@@ -105,6 +105,7 @@ module Decidim
|
|
|
105
105
|
end
|
|
106
106
|
|
|
107
107
|
def publish_all
|
|
108
|
+
enforce_permission_to :publish_all, :space_private_user
|
|
108
109
|
PublishAllParticipatorySpacePrivateUsers.call(current_participatory_space, current_user) do
|
|
109
110
|
on(:ok) do
|
|
110
111
|
flash[:notice] = I18n.t("participatory_space_private_users.publish_all.success", scope: "decidim.admin")
|
|
@@ -119,6 +120,7 @@ module Decidim
|
|
|
119
120
|
end
|
|
120
121
|
|
|
121
122
|
def unpublish_all
|
|
123
|
+
enforce_permission_to :unpublish_all, :space_private_user
|
|
122
124
|
UnpublishAllParticipatorySpacePrivateUsers.call(current_participatory_space, current_user) do
|
|
123
125
|
on(:ok) do
|
|
124
126
|
flash[:notice] = I18n.t("participatory_space_private_users.unpublish_all.success", scope: "decidim.admin")
|
|
@@ -132,6 +134,8 @@ module Decidim
|
|
|
132
134
|
end
|
|
133
135
|
end
|
|
134
136
|
|
|
137
|
+
protected
|
|
138
|
+
|
|
135
139
|
# Public: Returns a String or Object that will be passed to `redirect_to` after
|
|
136
140
|
# destroying a private user. By default it redirects to the privatable_to.
|
|
137
141
|
#
|
|
@@ -41,10 +41,12 @@ module Decidim
|
|
|
41
41
|
|
|
42
42
|
def destroy_all
|
|
43
43
|
enforce_permission_to :csv_import, :space_private_user
|
|
44
|
-
Decidim::ParticipatorySpacePrivateUser.by_participatory_space(privatable_to).delete_all
|
|
44
|
+
Decidim::ParticipatorySpacePrivateUser.by_participatory_space(privatable_to).delete_all # rubocop:disable Decidim/OrganizationScopedFinder -- by_participatory_space scopes to the current participatory space
|
|
45
45
|
redirect_to new_participatory_space_private_users_csv_imports_path
|
|
46
46
|
end
|
|
47
47
|
|
|
48
|
+
protected
|
|
49
|
+
|
|
48
50
|
# Public: Returns a String or Object that will be passed to `redirect_to` after
|
|
49
51
|
# importing private users. By default it redirects to the privatable_to.
|
|
50
52
|
#
|
|
@@ -18,8 +18,6 @@ module Decidim
|
|
|
18
18
|
def edit
|
|
19
19
|
enforce_permission_to :index, :impersonatable_user
|
|
20
20
|
|
|
21
|
-
conflict = Decidim::Verifications::Conflict.find(params[:id])
|
|
22
|
-
|
|
23
21
|
@form = form(TransferUserForm).from_params(
|
|
24
22
|
user: conflict.current_user,
|
|
25
23
|
managed_user: conflict.managed_user,
|
|
@@ -30,8 +28,6 @@ module Decidim
|
|
|
30
28
|
def update
|
|
31
29
|
enforce_permission_to :index, :impersonatable_user
|
|
32
30
|
|
|
33
|
-
conflict = Decidim::Verifications::Conflict.find(params[:id])
|
|
34
|
-
|
|
35
31
|
@form = form(TransferUserForm).from_params(
|
|
36
32
|
current_user:,
|
|
37
33
|
conflict:,
|
|
@@ -54,6 +50,10 @@ module Decidim
|
|
|
54
50
|
|
|
55
51
|
private
|
|
56
52
|
|
|
53
|
+
def conflict
|
|
54
|
+
@conflict ||= collection.find(params.require(:id))
|
|
55
|
+
end
|
|
56
|
+
|
|
57
57
|
def context_breadcrumb_items
|
|
58
58
|
@context_breadcrumb_items ||= [impersonations_breadcrumb_item]
|
|
59
59
|
end
|
|
@@ -67,7 +67,7 @@ module Decidim
|
|
|
67
67
|
|
|
68
68
|
def collection
|
|
69
69
|
@collection ||= Decidim::Verifications::Conflict.joins(:current_user).where(
|
|
70
|
-
decidim_users: {
|
|
70
|
+
decidim_users: { organization: current_organization }
|
|
71
71
|
)
|
|
72
72
|
end
|
|
73
73
|
|
|
@@ -12,17 +12,17 @@ module Decidim
|
|
|
12
12
|
|
|
13
13
|
helper_method :sections
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
def show
|
|
16
16
|
enforce_permission_to :update, :help_sections
|
|
17
|
-
end
|
|
18
17
|
|
|
19
|
-
def show
|
|
20
18
|
@form = form(HelpSectionsForm).from_model(
|
|
21
19
|
OpenStruct.new(sections:)
|
|
22
20
|
)
|
|
23
21
|
end
|
|
24
22
|
|
|
25
23
|
def update
|
|
24
|
+
enforce_permission_to :update, :help_sections
|
|
25
|
+
|
|
26
26
|
@form = form(HelpSectionsForm).from_params(
|
|
27
27
|
params[:help_sections]
|
|
28
28
|
)
|
|
@@ -52,6 +52,7 @@ module Decidim
|
|
|
52
52
|
end
|
|
53
53
|
|
|
54
54
|
def close_session
|
|
55
|
+
enforce_permission_to :close_session, :managed_user
|
|
55
56
|
CloseSessionManagedUser.call(user, current_user) do
|
|
56
57
|
on(:ok) do
|
|
57
58
|
flash[:notice] = I18n.t("impersonations.close_session.success", scope: "decidim.admin")
|
|
@@ -82,7 +83,7 @@ module Decidim
|
|
|
82
83
|
)
|
|
83
84
|
return nil unless handler.unique_id
|
|
84
85
|
|
|
85
|
-
existing_authorization = Authorization.find_by(
|
|
86
|
+
existing_authorization = Authorization.find_by( # rubocop:disable Decidim/OrganizationScopedFinder -- user: subquery scopes to current_organization
|
|
86
87
|
user: User.where(organization: current_organization),
|
|
87
88
|
name: handler_name,
|
|
88
89
|
unique_id: handler.unique_id
|
|
@@ -11,7 +11,7 @@ module Decidim
|
|
|
11
11
|
def index
|
|
12
12
|
enforce_permission_to :index, :impersonatable_user
|
|
13
13
|
|
|
14
|
-
@impersonation_logs =
|
|
14
|
+
@impersonation_logs = user.impersonation_logs.order(started_at: :desc).page(params[:page]).per(15)
|
|
15
15
|
end
|
|
16
16
|
|
|
17
17
|
private
|
|
@@ -34,6 +34,7 @@ module Decidim
|
|
|
34
34
|
end
|
|
35
35
|
|
|
36
36
|
def bulk_unreport
|
|
37
|
+
enforce_permission_to :unreport, :moderate_users
|
|
37
38
|
Admin::BulkUnreportUsers.call(current_user, reportables) do
|
|
38
39
|
on(:ok) do
|
|
39
40
|
flash[:notice] = I18n.t("reportable.bulk_action.ignore.success", scope: "decidim.moderations.admin")
|
|
@@ -67,6 +68,8 @@ module Decidim
|
|
|
67
68
|
Decidim::Admin::ModerationStats.new(current_user).user_reports
|
|
68
69
|
end
|
|
69
70
|
|
|
71
|
+
protected
|
|
72
|
+
|
|
70
73
|
def collection
|
|
71
74
|
@collection ||= if params[:blocked]
|
|
72
75
|
base_query_finder.blocked
|
|
@@ -73,6 +73,8 @@ module Decidim
|
|
|
73
73
|
end
|
|
74
74
|
|
|
75
75
|
def bulk_action
|
|
76
|
+
enforce_permission_to :bulk_action, authorization_scope
|
|
77
|
+
|
|
76
78
|
Admin::BulkAction.call(current_user, params[:bulk_action], selected_moderations) do
|
|
77
79
|
on(:ok) do |ok, ko|
|
|
78
80
|
flash[:notice] = I18n.t("reportable.bulk_action.#{params[:bulk_action]}.success", scope: "decidim.moderations.admin", count_ok: ok.count) if ok.count.positive?
|
|
@@ -92,6 +94,8 @@ module Decidim
|
|
|
92
94
|
query_params[:q] || { s: "created_at desc" }
|
|
93
95
|
end
|
|
94
96
|
|
|
97
|
+
protected
|
|
98
|
+
|
|
95
99
|
# Private: This method is used by the `Filterable` concern as the base query
|
|
96
100
|
# without applying filtering and/or sorting options.
|
|
97
101
|
def collection
|
|
@@ -12,9 +12,12 @@ module Decidim
|
|
|
12
12
|
enforce_permission_to :index, :newsletter
|
|
13
13
|
end
|
|
14
14
|
|
|
15
|
-
def show
|
|
15
|
+
def show
|
|
16
|
+
enforce_permission_to :index, :newsletter
|
|
17
|
+
end
|
|
16
18
|
|
|
17
19
|
def preview
|
|
20
|
+
enforce_permission_to :index, :newsletter
|
|
18
21
|
email = NewsletterMailer.newsletter(current_user, fake_newsletter, true)
|
|
19
22
|
Premailer::Rails::Hook.perform(email)
|
|
20
23
|
render html: email.html_part.body.decoded.html_safe
|
|
@@ -113,6 +113,7 @@ module Decidim
|
|
|
113
113
|
end
|
|
114
114
|
|
|
115
115
|
def recipients_count
|
|
116
|
+
enforce_permission_to :read, :newsletter, newsletter:
|
|
116
117
|
@form = form(SelectiveNewsletterForm).from_params(newsletter_params)
|
|
117
118
|
render plain: recipients_count_query
|
|
118
119
|
end
|
|
@@ -182,6 +183,8 @@ module Decidim
|
|
|
182
183
|
end
|
|
183
184
|
end
|
|
184
185
|
|
|
186
|
+
protected
|
|
187
|
+
|
|
185
188
|
def collection
|
|
186
189
|
@collection ||= Newsletter.where(organization: current_organization)
|
|
187
190
|
end
|
|
@@ -10,14 +10,18 @@ module Decidim
|
|
|
10
10
|
|
|
11
11
|
add_breadcrumb_item_from_menu :admin_settings_menu
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
:homepage
|
|
15
|
-
end
|
|
13
|
+
helper_method :scoped_resource
|
|
16
14
|
|
|
17
15
|
def scoped_resource
|
|
18
16
|
nil
|
|
19
17
|
end
|
|
20
18
|
|
|
19
|
+
protected
|
|
20
|
+
|
|
21
|
+
def content_block_scope
|
|
22
|
+
:homepage
|
|
23
|
+
end
|
|
24
|
+
|
|
21
25
|
def enforce_permission_to_update_resource
|
|
22
26
|
enforce_permission_to :update, :organization, organization: current_organization
|
|
23
27
|
end
|
|
@@ -10,12 +10,16 @@ module Decidim
|
|
|
10
10
|
helper_method :authorizations, :other_authorizations_for, :resource_params, :resource
|
|
11
11
|
|
|
12
12
|
def edit
|
|
13
|
+
enforce_permission_to :update, :resource_permission, resource:
|
|
14
|
+
|
|
13
15
|
@permissions_form = PermissionsForm.new(
|
|
14
16
|
permissions: permission_forms
|
|
15
17
|
)
|
|
16
18
|
end
|
|
17
19
|
|
|
18
20
|
def update
|
|
21
|
+
enforce_permission_to :update, :resource_permission, resource:
|
|
22
|
+
|
|
19
23
|
@permissions_form = PermissionsForm.from_params(params).with_context(current_organization:)
|
|
20
24
|
|
|
21
25
|
UpdateResourcePermissions.call(@permissions_form, resource) do
|