hyrax 2.1.0.beta2 → 2.1.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/CODE_OF_CONDUCT.md +5 -5
- data/.github/CONTRIBUTING.md +2 -2
- data/.rubocop.yml +1 -0
- data/.rubocop_fixme.yml +2 -0
- data/Gemfile +1 -0
- data/README.md +3 -2
- data/app/actors/hyrax/actors/collections_membership_actor.rb +3 -0
- data/app/actors/hyrax/actors/create_with_remote_files_actor.rb +4 -3
- data/app/actors/hyrax/actors/default_admin_set_actor.rb +9 -6
- data/app/assets/javascripts/hyrax.js +3 -0
- data/app/assets/javascripts/hyrax/app.js.erb +14 -0
- data/app/assets/javascripts/hyrax/batch_edit.js +2 -1
- data/app/assets/javascripts/hyrax/collection_types.es6 +97 -36
- data/app/assets/javascripts/hyrax/collections.js +15 -49
- data/app/assets/javascripts/hyrax/collections_utils.es6 +116 -0
- data/app/assets/javascripts/hyrax/collections_v2.es6 +57 -0
- data/app/assets/javascripts/hyrax/content_blocks.js +1 -13
- data/app/assets/javascripts/hyrax/nav_safety.js +41 -0
- data/app/assets/javascripts/hyrax/turbolinks_events.js +3 -0
- data/app/assets/stylesheets/hyrax/_collection_types.scss +46 -2
- data/app/assets/stylesheets/hyrax/_work-show.scss +6 -9
- data/app/assets/stylesheets/hyrax/dashboard.scss +2 -0
- data/app/assets/stylesheets/hyrax/sidebar.scss +4 -0
- data/app/controllers/concerns/hyrax/works_controller_behavior.rb +10 -2
- data/app/controllers/hyrax/admin/admin_sets_controller.rb +2 -9
- data/app/controllers/hyrax/admin/collection_types_controller.rb +1 -1
- data/app/controllers/hyrax/batch_edits_controller.rb +30 -4
- data/app/controllers/hyrax/dashboard/collection_members_controller.rb +1 -0
- data/app/controllers/hyrax/dashboard/collections_controller.rb +4 -1
- data/app/controllers/hyrax/downloads_controller.rb +7 -1
- data/app/forms/hyrax/forms/admin/collection_type_form.rb +1 -1
- data/app/indexers/hyrax/repository_reindexer.rb +1 -1
- data/app/jobs/attach_files_to_work_job.rb +8 -4
- data/app/jobs/import_url_job.rb +11 -5
- data/app/models/admin_set.rb +25 -3
- data/app/models/concerns/hyrax/collection_behavior.rb +23 -11
- data/app/models/concerns/hyrax/collection_nesting.rb +22 -3
- data/app/models/hyrax/permission_template_access.rb +7 -4
- data/app/presenters/hyrax/admin_set_presenter.rb +21 -0
- data/app/presenters/hyrax/collection_presenter.rb +23 -1
- data/app/presenters/hyrax/dashboard/user_presenter.rb +4 -0
- data/app/presenters/hyrax/presents_attributes.rb +6 -2
- data/app/presenters/hyrax/work_show_presenter.rb +4 -0
- data/app/renderers/hyrax/renderers/attribute_renderer.rb +14 -0
- data/app/services/hyrax/adapters/nesting_index_adapter.rb +19 -39
- data/app/services/hyrax/admin_set_create_service.rb +1 -1
- data/app/services/hyrax/collection_types/create_service.rb +4 -0
- data/app/services/hyrax/collections/migration_service.rb +25 -2
- data/app/services/hyrax/collections/nested_collection_persistence_service.rb +8 -3
- data/app/services/hyrax/collections/nested_collection_query_service.rb +3 -3
- data/app/services/hyrax/default_middleware_stack.rb +3 -3
- data/app/services/hyrax/multiple_membership_checker.rb +4 -2
- data/app/views/catalog/_index_header_list_collection.html.erb +1 -1
- data/app/views/catalog/_search_form.html.erb +0 -4
- data/app/views/hyrax/admin/admin_sets/_show_actions.html.erb +27 -0
- data/app/views/hyrax/admin/admin_sets/show.html.erb +1 -25
- data/app/views/hyrax/admin/collection_types/_form.html.erb +17 -6
- data/app/views/hyrax/admin/collection_types/_form_appearance.html.erb +5 -0
- data/app/views/hyrax/admin/collection_types/_form_participant_table.html.erb +1 -1
- data/app/views/hyrax/admin/collection_types/_form_participants.html.erb +56 -52
- data/app/views/hyrax/admin/collection_types/edit.html.erb +9 -7
- data/app/views/hyrax/admin/collection_types/index.html.erb +1 -1
- data/app/views/hyrax/base/_attribute_rows.html.erb +15 -14
- data/app/views/hyrax/base/_form.html.erb +1 -0
- data/app/views/hyrax/base/_form_collections_error.html.erb +1 -0
- data/app/views/hyrax/base/_items.html.erb +3 -2
- data/app/views/hyrax/base/_metadata.html.erb +5 -7
- data/app/views/hyrax/base/_relationships.html.erb +3 -5
- data/app/views/hyrax/base/_relationships_parent_row.html.erb +4 -5
- data/app/views/hyrax/base/_relationships_parent_rows.html.erb +2 -1
- data/app/views/hyrax/base/_show_actions.html.erb +11 -1
- data/app/views/hyrax/batch_edits/edit.html.erb +57 -17
- data/app/views/hyrax/collections/_list_collections.html.erb +1 -1
- data/app/views/hyrax/collections/show.html.erb +1 -1
- data/app/views/hyrax/content_blocks/_form.html.erb +8 -7
- data/app/views/hyrax/dashboard/_index_partials/_current_proxy_rights.html.erb +17 -0
- data/app/views/hyrax/dashboard/collections/_collection_title.html.erb +1 -3
- data/app/views/hyrax/dashboard/collections/_default_group.html.erb +30 -0
- data/app/views/hyrax/dashboard/collections/_form_branding.html.erb +2 -2
- data/app/views/hyrax/dashboard/collections/_form_for_select_collection.html.erb +1 -1
- data/app/views/hyrax/dashboard/collections/_form_share.html.erb +2 -2
- data/app/views/hyrax/dashboard/collections/_list_collections.html.erb +13 -2
- data/app/views/hyrax/dashboard/show_user.html.erb +10 -9
- data/app/views/hyrax/my/collections/_list_collections.html.erb +10 -3
- data/app/views/hyrax/my/collections/_modal_add_subcollection.html.erb +1 -1
- data/app/views/hyrax/my/collections/_modal_add_to_collection.html.erb +1 -1
- data/app/views/hyrax/my/collections/_modal_delete_collections_deny.html.erb +14 -0
- data/app/views/hyrax/my/collections/index.html.erb +1 -0
- data/app/views/shared/_nav_safety_modal.html.erb +12 -0
- data/config/features.rb +4 -0
- data/config/initializers/samvera-nesting_indexer_initializer.rb +1 -0
- data/config/locales/hyrax.de.yml +26 -11
- data/config/locales/hyrax.en.yml +21 -6
- data/config/locales/hyrax.es.yml +17 -2
- data/config/locales/hyrax.fr.yml +17 -2
- data/config/locales/hyrax.it.yml +17 -2
- data/config/locales/hyrax.pt-BR.yml +17 -2
- data/config/locales/hyrax.zh.yml +17 -2
- data/config/locales/simple_form.en.yml +6 -27
- data/hyrax.gemspec +2 -2
- data/lib/generators/hyrax/assets_generator.rb +4 -0
- data/lib/generators/hyrax/install_generator.rb +10 -0
- data/lib/generators/hyrax/templates/app/assets/images/unauthorized.png +0 -0
- data/lib/generators/hyrax/templates/config/locales/hyrax.en.yml +6 -5
- data/lib/generators/hyrax/templates/config/tinymce.yml +12 -7
- data/lib/generators/hyrax/templates/db/migrate/20180406202557_add_badge_color_to_collection_types.rb.erb +5 -0
- data/lib/hyrax/configuration.rb +1 -1
- data/lib/hyrax/version.rb +1 -1
- data/spec/actors/hyrax/actors/collections_membership_actor_spec.rb +24 -0
- data/spec/actors/hyrax/actors/create_with_remote_files_actor_spec.rb +19 -1
- data/spec/actors/hyrax/actors/default_admin_set_actor_spec.rb +41 -8
- data/spec/actors/hyrax/actors/file_set_actor_spec.rb +4 -12
- data/spec/actors/hyrax/actors/generic_work_actor_spec.rb +3 -7
- data/spec/controllers/hyrax/admin/strategies_controller_spec.rb +13 -2
- data/spec/controllers/hyrax/batch_edits_controller_spec.rb +83 -8
- data/spec/controllers/hyrax/dashboard/collections_controller_spec.rb +3 -0
- data/spec/controllers/hyrax/downloads_controller_spec.rb +26 -5
- data/spec/controllers/hyrax/file_sets_controller_spec.rb +3 -6
- data/spec/controllers/hyrax/generic_works_controller_json_spec.rb +4 -4
- data/spec/controllers/hyrax/generic_works_controller_spec.rb +3 -23
- data/spec/controllers/hyrax/transfers_controller_spec.rb +1 -1
- data/spec/factories/admin_sets_lw.rb +215 -0
- data/spec/factories/collections.rb +10 -10
- data/spec/factory_tests/adminsets_factory_spec.rb +132 -0
- data/spec/factory_tests/collections_factory_spec.rb +3 -3
- data/spec/features/batch_create_spec.rb +5 -8
- data/spec/features/batch_edit_spec.rb +49 -2
- data/spec/features/collection_multi_membership_spec.rb +29 -14
- data/spec/features/collection_type_spec.rb +9 -2
- data/spec/features/create_work_admin_spec.rb +1 -1
- data/spec/features/create_work_spec.rb +1 -1
- data/spec/features/dashboard/collection_spec.rb +16 -12
- data/spec/features/edit_content_block_admin_spec.rb +29 -12
- data/spec/features/embargo_spec.rb +55 -0
- data/spec/features/proxy_spec.rb +3 -1
- data/spec/features/work_show_spec.rb +20 -4
- data/spec/forms/hyrax/forms/admin/collection_type_form_spec.rb +1 -0
- data/spec/indexers/hyrax/repository_reindexer_spec.rb +1 -1
- data/spec/jobs/attach_files_to_work_job_spec.rb +15 -3
- data/spec/jobs/batch_create_job_spec.rb +6 -6
- data/spec/jobs/create_work_job_spec.rb +1 -1
- data/spec/models/admin_set_spec.rb +10 -8
- data/spec/models/collection_spec.rb +1 -1
- data/spec/models/concerns/hyrax/collection_nesting_spec.rb +6 -3
- data/spec/models/flipflop_spec.rb +8 -0
- data/spec/models/hyrax/work_behavior_spec.rb +1 -1
- data/spec/presenters/hyrax/admin_set_presenter_spec.rb +70 -0
- data/spec/presenters/hyrax/collection_presenter_spec.rb +66 -0
- data/spec/renderers/hyrax/renderers/attribute_renderer_spec.rb +19 -0
- data/spec/services/hyrax/adapters/nesting_index_adapter_spec.rb +31 -21
- data/spec/services/hyrax/collection_types/create_service_spec.rb +7 -4
- data/spec/services/hyrax/collections/migration_service_spec.rb +204 -17
- data/spec/services/hyrax/collections/nested_collection_persistence_service_spec.rb +1 -1
- data/spec/services/hyrax/collections/permissions_create_service_spec.rb +1 -1
- data/spec/services/hyrax/collections/permissions_service_spec.rb +4 -0
- data/spec/services/hyrax/default_middleware_stack_spec.rb +1 -1
- data/spec/services/hyrax/multiple_membership_checker_spec.rb +4 -4
- data/spec/services/hyrax/workflow/grant_edit_to_depositor_spec.rb +1 -1
- data/spec/services/hyrax/workflow/grant_read_to_depositor_spec.rb +1 -1
- data/spec/services/hyrax/workflow/revoke_edit_from_depositor_spec.rb +1 -1
- data/spec/spec_helper.rb +35 -2
- data/spec/support/features/batch_edit_actions.rb +1 -1
- data/spec/support/selectors.rb +15 -0
- data/spec/views/hyrax/admin/admin_sets/_show_actions.html.erb_spec.rb +66 -0
- data/spec/views/hyrax/admin/admin_sets/show.html.erb_spec.rb +5 -34
- data/spec/views/hyrax/admin/collection_types/_form.html.erb_spec.rb +3 -1
- data/spec/views/hyrax/admin/collection_types/_form_appearance.html.erb_spec.rb +22 -0
- data/spec/views/hyrax/admin/collection_types/_form_participants.html.erb_spec.rb +11 -3
- data/spec/views/hyrax/base/_items.html.erb_spec.rb +46 -0
- data/spec/views/hyrax/base/_relationships.html.erb_spec.rb +1 -1
- data/spec/views/hyrax/base/_show_actions.html.erb_spec.rb +4 -2
- data/spec/views/hyrax/dashboard/collections/_default_group.html.erb_spec.rb +43 -0
- data/spec/views/hyrax/dashboard/collections/_list_collections.html.erb_spec.rb +51 -0
- data/spec/views/hyrax/dashboard/collections/show.html.erb_spec.rb +1 -0
- data/spec/views/hyrax/dashboard/show_user_spec.rb +5 -2
- data/spec/views/hyrax/my/collections/_list_collections.html.erb_spec.rb +2 -0
- data/template.rb +1 -1
- metadata +30 -13
- data/app/views/hyrax/content_blocks/_modal_content_block.html.erb +0 -15
@@ -1,8 +1,10 @@
|
|
1
1
|
module Hyrax
|
2
2
|
module Adapters
|
3
3
|
module NestingIndexAdapter
|
4
|
-
|
4
|
+
FULL_REINDEX = "full".freeze
|
5
|
+
LIMITED_REINDEX = "limited".freeze
|
5
6
|
|
7
|
+
# @!group Providing interface for a Samvera::NestingIndexer::Adapter
|
6
8
|
# @api public
|
7
9
|
# @param id [String]
|
8
10
|
# @return Samvera::NestingIndexer::Document::PreservationDocument
|
@@ -38,19 +40,10 @@ module Hyrax
|
|
38
40
|
coerce_solr_document_to_index_document(original_solr_document: solr_document, id: id)
|
39
41
|
end
|
40
42
|
|
41
|
-
# @api public
|
42
|
-
# @deprecated
|
43
|
-
# @yield Samvera::NestingIndexer::Document::PreservationDocument
|
44
|
-
# rubocop:disable Lint/UnusedMethodArgument
|
45
|
-
def self.each_preservation_document(&block)
|
46
|
-
raise NotImplementedError
|
47
|
-
end
|
48
|
-
# rubocop:enable Lint/UnusedMethodArgument
|
49
|
-
|
50
43
|
# @api public
|
51
44
|
# @yieldparam id [String]
|
52
45
|
# @yieldparam parent_id [Array<String>]
|
53
|
-
# Samvera::NestingIndexer.reindex_all!
|
46
|
+
# Samvera::NestingIndexer.reindex_all!(extent: FULL_REINDEX)
|
54
47
|
# rubocop:disable Lint/UnusedMethodArgument
|
55
48
|
def self.each_perservation_document_id_and_parent_ids(&block)
|
56
49
|
ActiveFedora::Base.descendant_uris(ActiveFedora.fedora.base_uri, exclude_uri: true).each do |uri|
|
@@ -70,22 +63,6 @@ module Hyrax
|
|
70
63
|
end
|
71
64
|
# rubocop:enable Lint/UnusedMethodArgument
|
72
65
|
|
73
|
-
# @api public
|
74
|
-
# @deprecated
|
75
|
-
#
|
76
|
-
# From the given parameters, we will need to add them to the underlying SOLR document for the object
|
77
|
-
#
|
78
|
-
# @param id [String]
|
79
|
-
# @param parent_ids [Array<String>]
|
80
|
-
# @param ancestors [Array<String>]
|
81
|
-
# @param pathnames [Array<String>]
|
82
|
-
# @return Hash - the attributes written to the indexing layer
|
83
|
-
# rubocop:disable Lint/UnusedMethodArgument
|
84
|
-
def self.write_document_attributes_to_index_layer(id:, parent_ids:, ancestors:, pathnames:, deepest_nested_depth:)
|
85
|
-
raise NotImplementedError, "This method is deprecated as of v1.0.0 of samvera-nesting_indexer, prefer instead .write_nesting_document_to_index_layer"
|
86
|
-
end
|
87
|
-
# rubocop:enable Lint/UnusedMethodArgument
|
88
|
-
|
89
66
|
# @api public
|
90
67
|
#
|
91
68
|
# From the nesting_document, we will need to add the nesting attributes to the underlying SOLR document for the object
|
@@ -126,12 +103,14 @@ module Hyrax
|
|
126
103
|
|
127
104
|
# @api public
|
128
105
|
# @param document [Samvera::NestingIndexer::Documents::IndexDocument]
|
106
|
+
# @param extent [String] if not "full" or nil, doesn't yield children for reindexing
|
129
107
|
# @param solr_field_name_for_ancestors [String] The SOLR field name we use to find children
|
130
108
|
# @yield Samvera::NestingIndexer::Documents::IndexDocument
|
131
|
-
def self.each_child_document_of(document:, &block)
|
109
|
+
def self.each_child_document_of(document:, extent:, &block)
|
132
110
|
raw_child_solr_documents_of(parent_document: document).each do |solr_document|
|
133
111
|
child_document = coerce_solr_document_to_index_document(original_solr_document: solr_document, id: solr_document.fetch('id'))
|
134
|
-
|
112
|
+
# during light reindexing, we want to reindex the child only if fields aren't already there
|
113
|
+
block.call(child_document) if full_reindex?(extent: extent) || child_document.pathnames.empty?
|
135
114
|
end
|
136
115
|
end
|
137
116
|
# @!endgroup
|
@@ -165,14 +144,10 @@ module Hyrax
|
|
165
144
|
end
|
166
145
|
|
167
146
|
class << self
|
168
|
-
delegate :solr_field_name_for_storing_pathnames,
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
SOLR_FIELD_NAME_FOR_DEEPEST_NESTED_DEPTH = 'nesting_collection__deepest_nested_depth_isi'.freeze
|
173
|
-
|
174
|
-
def self.solr_field_name_for_deepest_nested_depth
|
175
|
-
SOLR_FIELD_NAME_FOR_DEEPEST_NESTED_DEPTH
|
147
|
+
delegate :solr_field_name_for_storing_pathnames,
|
148
|
+
:solr_field_name_for_storing_ancestors,
|
149
|
+
:solr_field_name_for_storing_parent_ids,
|
150
|
+
:solr_field_name_for_deepest_nested_depth, to: :nesting_configuration
|
176
151
|
end
|
177
152
|
|
178
153
|
# @api private
|
@@ -180,12 +155,17 @@ module Hyrax
|
|
180
155
|
# @return [Hash] A raw response document from SOLR
|
181
156
|
# @todo What is the appropriate suffix to apply to the solr_field_name?
|
182
157
|
def self.raw_child_solr_documents_of(parent_document:)
|
183
|
-
# query Solr for all of the documents included as a member_of_collection parent.
|
158
|
+
# query Solr for all of the documents included as a member_of_collection parent. Or up to 10000 of them.
|
184
159
|
child_query = ActiveFedora::SolrQueryBuilder.construct_query(member_of_collection_ids_ssim: parent_document.id)
|
185
|
-
ActiveFedora::SolrService.query(child_query)
|
160
|
+
ActiveFedora::SolrService.query(child_query, rows: 10_000.to_i)
|
186
161
|
end
|
187
162
|
private_class_method :raw_child_solr_documents_of
|
188
163
|
|
164
|
+
def self.full_reindex?(extent:)
|
165
|
+
return true if extent == FULL_REINDEX
|
166
|
+
false
|
167
|
+
end
|
168
|
+
private_class_method :full_reindex?
|
189
169
|
# @!endgroup
|
190
170
|
end
|
191
171
|
end
|
@@ -120,7 +120,7 @@ module Hyrax
|
|
120
120
|
|
121
121
|
# Gives deposit access to registered users to default AdminSet
|
122
122
|
def create_default_access_for(permission_template:, workflow:)
|
123
|
-
permission_template.access_grants.create(agent_type: 'group', agent_id:
|
123
|
+
permission_template.access_grants.create(agent_type: 'group', agent_id: ::Ability.registered_group_name, access: Hyrax::PermissionTemplateAccess::DEPOSIT)
|
124
124
|
deposit = Sipity::Role[Hyrax::RoleRegistry::DEPOSITING]
|
125
125
|
workflow.update_responsibilities(role: deposit, agents: Hyrax::Group.new('registered'))
|
126
126
|
end
|
@@ -22,6 +22,7 @@ module Hyrax
|
|
22
22
|
require_membership: false,
|
23
23
|
assigns_workflow: false,
|
24
24
|
assigns_visibility: false,
|
25
|
+
badge_color: "#663333",
|
25
26
|
participants: [{ agent_type: Hyrax::CollectionTypeParticipant::GROUP_TYPE, agent_id: ::Ability.admin_group_name, access: Hyrax::CollectionTypeParticipant::MANAGE_ACCESS },
|
26
27
|
{ agent_type: Hyrax::CollectionTypeParticipant::GROUP_TYPE, agent_id: ::Ability.registered_group_name, access: Hyrax::CollectionTypeParticipant::CREATE_ACCESS }]
|
27
28
|
}.freeze
|
@@ -39,6 +40,7 @@ module Hyrax
|
|
39
40
|
require_membership: false,
|
40
41
|
assigns_workflow: false,
|
41
42
|
assigns_visibility: false,
|
43
|
+
badge_color: "#663333",
|
42
44
|
participants: [{ agent_type: Hyrax::CollectionTypeParticipant::GROUP_TYPE, agent_id: ::Ability.admin_group_name, access: Hyrax::CollectionTypeParticipant::MANAGE_ACCESS },
|
43
45
|
{ agent_type: Hyrax::CollectionTypeParticipant::GROUP_TYPE, agent_id: ::Ability.registered_group_name, access: Hyrax::CollectionTypeParticipant::CREATE_ACCESS }]
|
44
46
|
}.freeze
|
@@ -56,6 +58,7 @@ module Hyrax
|
|
56
58
|
require_membership: true,
|
57
59
|
assigns_workflow: true,
|
58
60
|
assigns_visibility: true,
|
61
|
+
badge_color: "#663333",
|
59
62
|
participants: [{ agent_type: Hyrax::CollectionTypeParticipant::GROUP_TYPE, agent_id: ::Ability.admin_group_name, access: Hyrax::CollectionTypeParticipant::MANAGE_ACCESS },
|
60
63
|
{ agent_type: Hyrax::CollectionTypeParticipant::GROUP_TYPE, agent_id: ::Ability.admin_group_name, access: Hyrax::CollectionTypeParticipant::CREATE_ACCESS }]
|
61
64
|
}.freeze
|
@@ -78,6 +81,7 @@ module Hyrax
|
|
78
81
|
# with allow_multiple_membership=false, works can belong to one and only one collection of this type.
|
79
82
|
# @option options [Boolean] :assigns_workflow if true, collections of this type can be used to assign a workflow to a work
|
80
83
|
# @option options [Boolean] :assigns_visibility if true, collections of this type can be used to assign initial visibility to a work
|
84
|
+
# @option options [String] :badge_color a color for the badge to show the user when selecting the collection type
|
81
85
|
# @return [Hyrax::CollectionType] the newly created collection type instance
|
82
86
|
def self.create_collection_type(machine_id:, title:, options: {})
|
83
87
|
opts = DEFAULT_OPTIONS.merge(options).except(:participants)
|
@@ -13,6 +13,11 @@ module Hyrax
|
|
13
13
|
migrate_collection(col)
|
14
14
|
Rails.logger.info " migrating collection - id: #{col.id}, title: #{col.title}"
|
15
15
|
end
|
16
|
+
|
17
|
+
AdminSet.all.each do |adminset|
|
18
|
+
migrate_adminset(adminset)
|
19
|
+
Rails.logger.info " migrating adminset - id: #{adminset.id}, title: #{adminset.title}"
|
20
|
+
end
|
16
21
|
Rails.logger.info "--- Migration Complete"
|
17
22
|
end
|
18
23
|
|
@@ -30,6 +35,20 @@ module Hyrax
|
|
30
35
|
end
|
31
36
|
private_class_method :migrate_collection
|
32
37
|
|
38
|
+
# @api private
|
39
|
+
#
|
40
|
+
# Migrate a single adminset to grant depositors and viewers read access to the admin set unless the grant is for
|
41
|
+
# registered (authenticated users) or public (anyone) groups. The adjustment is being made to adminsets created
|
42
|
+
# before Hyrax 2.1.0. Migrating twice will not adversely impact the adminset.
|
43
|
+
#
|
44
|
+
# @param adminset [AdminSet] adminset object to be migrated
|
45
|
+
def self.migrate_adminset(adminset)
|
46
|
+
Hyrax::PermissionTemplateAccess.find_or_create_by(permission_template_id: adminset.permission_template.id,
|
47
|
+
agent_type: "group", agent_id: "admin", access: "manage")
|
48
|
+
adminset.reset_access_controls!
|
49
|
+
end
|
50
|
+
private_class_method :migrate_adminset
|
51
|
+
|
33
52
|
# @api public
|
34
53
|
#
|
35
54
|
# Validate that migrated collections have both the collection type gid assigned and the permission template with
|
@@ -39,9 +58,13 @@ module Hyrax
|
|
39
58
|
Rails.logger.info "*** Repairing migrated collections"
|
40
59
|
Collection.all.each do |col|
|
41
60
|
repair_migrated_collection(col)
|
42
|
-
Rails.logger.info "
|
61
|
+
Rails.logger.info " repairing collection - id: #{col.id}, title: #{col.title}"
|
43
62
|
end
|
44
|
-
|
63
|
+
AdminSet.all.each do |adminset|
|
64
|
+
migrate_adminset(adminset)
|
65
|
+
Rails.logger.info " repairing adminset - id: #{adminset.id}, title: #{adminset.title}"
|
66
|
+
end
|
67
|
+
Rails.logger.info "--- Repairing Complete"
|
45
68
|
end
|
46
69
|
|
47
70
|
# @api private
|
@@ -11,14 +11,19 @@ module Hyrax
|
|
11
11
|
# @note There is odd permission arrangement based on the NestedCollectionQueryService:
|
12
12
|
# You can nest the child within a parent if you can edit the parent and read the child.
|
13
13
|
# See https://wiki.duraspace.org/display/samvera/Samvera+Tech+Call+2017-08-23 for tech discussion.
|
14
|
+
# @note Adding the member_of_collections method doesn't trigger reindexing of the child so we have to do it manually.
|
15
|
+
# However it save and reindexes the parent unnecessarily!!
|
14
16
|
def self.persist_nested_collection_for(parent:, child:)
|
15
|
-
|
16
|
-
child.
|
17
|
+
parent.reindex_extent = Hyrax::Adapters::NestingIndexAdapter::LIMITED_REINDEX
|
18
|
+
child.member_of_collections.push(parent)
|
19
|
+
child.update_nested_collection_relationship_indices
|
17
20
|
end
|
18
21
|
|
22
|
+
# @note Removing the member_of_collections method doesn't trigger reindexing of the child so we have to do it manually.
|
23
|
+
# However it doesn't save and reindex the parent, as it does when a parent is added!!
|
19
24
|
def self.remove_nested_relationship_for(parent:, child:)
|
20
25
|
child.member_of_collections.delete(parent)
|
21
|
-
child.
|
26
|
+
child.update_nested_collection_relationship_indices
|
22
27
|
true
|
23
28
|
end
|
24
29
|
end
|
@@ -20,7 +20,7 @@ module Hyrax
|
|
20
20
|
@parents = collection_doc[Samvera::NestingIndexer.configuration.solr_field_name_for_storing_parent_ids]
|
21
21
|
@pathnames = collection_doc[Samvera::NestingIndexer.configuration.solr_field_name_for_storing_pathnames]
|
22
22
|
@ancestors = collection_doc[Samvera::NestingIndexer.configuration.solr_field_name_for_storing_ancestors]
|
23
|
-
@depth = collection_doc[
|
23
|
+
@depth = collection_doc[Samvera::NestingIndexer.configuration.solr_field_name_for_deepest_nested_depth]
|
24
24
|
end
|
25
25
|
end
|
26
26
|
|
@@ -154,13 +154,13 @@ module Hyrax
|
|
154
154
|
# note: We need to include works in this search. They are included in the depth validations in
|
155
155
|
# the indexer, so we do NOT use collection search builder here.
|
156
156
|
builder = Hyrax::SearchBuilder.new(scope).where("#{Samvera::NestingIndexer.configuration.solr_field_name_for_storing_pathnames}:/.*#{child.id}.*/")
|
157
|
-
builder.query[:sort] = "#{
|
157
|
+
builder.query[:sort] = "#{Samvera::NestingIndexer.configuration.solr_field_name_for_deepest_nested_depth} desc"
|
158
158
|
builder.query[:rows] = 1
|
159
159
|
query = clean_lucene_error(builder: builder)
|
160
160
|
response = scope.repository.search(query).documents.first
|
161
161
|
|
162
162
|
# Now we have the largest nesting depth for all paths containing this collection
|
163
|
-
descendant_depth = response[
|
163
|
+
descendant_depth = response[Samvera::NestingIndexer.configuration.solr_field_name_for_deepest_nested_depth]
|
164
164
|
|
165
165
|
# => 2) Then we get the stored depth of the child collection itself to eliminate the collections above this one from our count, and add 1 to add back in this collection itself
|
166
166
|
child_depth = NestingAttributes.new(id: child.id, scope: scope).depth
|
@@ -28,6 +28,9 @@ module Hyrax
|
|
28
28
|
# Set the order of the children (works or file_sets)
|
29
29
|
middleware.use Hyrax::Actors::ApplyOrderActor
|
30
30
|
|
31
|
+
# Sets the default admin set if they didn't supply one
|
32
|
+
middleware.use Hyrax::Actors::DefaultAdminSetActor
|
33
|
+
|
31
34
|
# Decode the private/public/institution on the form into permisisons on
|
32
35
|
# the model
|
33
36
|
middleware.use Hyrax::Actors::InterpretVisibilityActor
|
@@ -35,9 +38,6 @@ module Hyrax
|
|
35
38
|
# Handles transfering ownership of works from one user to another
|
36
39
|
middleware.use Hyrax::Actors::TransferRequestActor
|
37
40
|
|
38
|
-
# Sets the default admin set if they didn't supply one
|
39
|
-
middleware.use Hyrax::Actors::DefaultAdminSetActor
|
40
|
-
|
41
41
|
# Copies default permissions from the PermissionTemplate to the work
|
42
42
|
middleware.use Hyrax::Actors::ApplyPermissionTemplateActor
|
43
43
|
|
@@ -60,9 +60,11 @@ module Hyrax
|
|
60
60
|
|
61
61
|
def build_error_message(problematic_collections)
|
62
62
|
error_message_clauses = problematic_collections.map do |gid, list|
|
63
|
-
|
63
|
+
I18n.t('hyrax.admin.collection_types.multiple_membership_checker.error_type_and_collections',
|
64
|
+
type: collection_type_title_from_gid(gid),
|
65
|
+
collections: collection_titles_from_list(list))
|
64
66
|
end
|
65
|
-
"#{I18n.t('hyrax.admin.collection_types.multiple_membership_checker.error_preamble')}
|
67
|
+
"#{I18n.t('hyrax.admin.collection_types.multiple_membership_checker.error_preamble')}#{error_message_clauses.join('; ')}"
|
66
68
|
end
|
67
69
|
|
68
70
|
def collection_type_title_from_gid(gid)
|
@@ -1,4 +1,4 @@
|
|
1
1
|
<div class="search-results-title-row">
|
2
2
|
<h4 class="search-result-title"><%= link_to document.title_or_label, [hyrax, document] %></h4>
|
3
|
-
|
3
|
+
<%= Hyrax::CollectionPresenter.new(document, current_ability).collection_type_badge %>
|
4
4
|
</div>
|
@@ -29,10 +29,6 @@
|
|
29
29
|
<%= link_to t("hyrax.search.form.option.my_collections.label_long"), "#",
|
30
30
|
data: { "search-option" => hyrax.my_collections_path, "search-label" => t("hyrax.search.form.option.my_collections.label_short") } %>
|
31
31
|
</li>
|
32
|
-
<li>
|
33
|
-
<%= link_to t("hyrax.search.form.option.my_shares.label_long"), "#",
|
34
|
-
data: { "search-option" => hyrax.dashboard_shares_path, "search-label" => t("hyrax.search.form.option.my_shares.label_short") } %>
|
35
|
-
</li>
|
36
32
|
<% end %>
|
37
33
|
|
38
34
|
</ul>
|
@@ -0,0 +1,27 @@
|
|
1
|
+
<% if can? :edit, presenter.solr_document %>
|
2
|
+
<div class="panel-heading">
|
3
|
+
<div class="row">
|
4
|
+
<div class="col-sm-8">
|
5
|
+
<h2 class="panel-title display-page"><%= presenter.to_s %></h2>
|
6
|
+
</div>
|
7
|
+
<div class="col-sm-4">
|
8
|
+
<div class="pull-right">
|
9
|
+
<%= link_to edit_admin_admin_set_path(presenter), class: 'btn btn-primary' do %>
|
10
|
+
<span class="fa fa-edit"></span> <%= t(:'helpers.action.edit') %>
|
11
|
+
<% end %>
|
12
|
+
<% if presenter.disable_delete? %>
|
13
|
+
<span title="<%= presenter.disabled_message %>">
|
14
|
+
<%= link_to admin_admin_set_path(presenter), class: 'btn btn-danger disabled' do %>
|
15
|
+
<span class="fa fa-remove"></span> <%= t(:'helpers.action.delete') %>
|
16
|
+
<% end %>
|
17
|
+
</span>
|
18
|
+
<% else %>
|
19
|
+
<%= link_to admin_admin_set_path(presenter), class: 'btn btn-danger', data: { confirm: t('.confirm_delete'), method: :delete } do %>
|
20
|
+
<span class="fa fa-remove"></span> <%= t(:'helpers.action.delete') %>
|
21
|
+
<% end %>
|
22
|
+
<% end %>
|
23
|
+
</div>
|
24
|
+
</div>
|
25
|
+
</div>
|
26
|
+
</div>
|
27
|
+
<% end %>
|
@@ -5,31 +5,7 @@
|
|
5
5
|
<div class="row">
|
6
6
|
<div class="col-md-12">
|
7
7
|
<div class="panel panel-default">
|
8
|
-
|
9
|
-
<div class="row">
|
10
|
-
<div class="col-sm-8">
|
11
|
-
<h2 class="panel-title display-page"><%= @presenter.to_s %></h2>
|
12
|
-
</div>
|
13
|
-
<div class="col-sm-4">
|
14
|
-
<div class="pull-right">
|
15
|
-
<%= link_to edit_admin_admin_set_path(@presenter), class: 'btn btn-primary' do %>
|
16
|
-
<span class="fa fa-edit"></span> <%= t(:'helpers.action.edit') %>
|
17
|
-
<% end %>
|
18
|
-
<% if @presenter.disable_delete? %>
|
19
|
-
<span title="<%= @presenter.disabled_message %>">
|
20
|
-
<%= link_to admin_admin_set_path(@presenter), class: 'btn btn-danger disabled' do %>
|
21
|
-
<span class="fa fa-remove"></span> <%= t(:'helpers.action.delete') %>
|
22
|
-
<% end %>
|
23
|
-
</span>
|
24
|
-
<% else %>
|
25
|
-
<%= link_to admin_admin_set_path(@presenter), class: 'btn btn-danger', data: { confirm: t('.confirm_delete'), method: :delete } do %>
|
26
|
-
<span class="fa fa-remove"></span> <%= t(:'helpers.action.delete') %>
|
27
|
-
<% end %>
|
28
|
-
<% end %>
|
29
|
-
</div>
|
30
|
-
</div>
|
31
|
-
</div>
|
32
|
-
</div>
|
8
|
+
<%= render 'show_actions', presenter: @presenter %>
|
33
9
|
|
34
10
|
<div class="panel-body admin-set row">
|
35
11
|
<div class="col-md-2">
|
@@ -1,19 +1,23 @@
|
|
1
|
+
<%= render "shared/nav_safety_modal" %>
|
1
2
|
<div class="panel panel-default tabs" id="collection-types-controls">
|
2
3
|
<ul class="nav nav-tabs" role="tablist">
|
3
4
|
<li class="active">
|
4
|
-
<a href="#metadata" role="tab" data-toggle="tab"><%= t('hyrax.admin.collection_types.form.tab.metadata') %></a>
|
5
|
+
<a href="#metadata" role="tab" data-toggle="tab" class="nav-safety-confirm"><%= t('hyrax.admin.collection_types.form.tab.metadata') %></a>
|
5
6
|
</li>
|
6
7
|
<% if @form.persisted? %>
|
7
8
|
<li>
|
8
|
-
<a href="#settings" role="tab" data-toggle="tab"><%= t('hyrax.admin.collection_types.form.tab.settings') %></a>
|
9
|
+
<a href="#settings" role="tab" data-toggle="tab" class="nav-safety-confirm"><%= t('hyrax.admin.collection_types.form.tab.settings') %></a>
|
9
10
|
</li>
|
10
11
|
<li>
|
11
|
-
<a href="#participants" role="tab" data-toggle="tab"><%= t('hyrax.admin.collection_types.form.tab.participants') %></a>
|
12
|
-
|
12
|
+
<a href="#participants" role="tab" data-toggle="tab" class="nav-safety-confirm"><%= t('hyrax.admin.collection_types.form.tab.participants') %></a>
|
13
|
+
</li>
|
14
|
+
<li>
|
15
|
+
<a href="#appearance" role="tab" data-toggle="tab" class="nav-safety-confirm"><%= t('hyrax.admin.collection_types.form.tab.appearance') %></a>
|
16
|
+
</li>
|
13
17
|
<% end %>
|
14
18
|
</ul>
|
15
19
|
<% form_url = @form.id.nil? ? hyrax.admin_collection_types_path : hyrax.admin_collection_type_path(@form.id) %>
|
16
|
-
<%= simple_form_for @form, url: form_url, as: :collection_type do |f| %>
|
20
|
+
<%= simple_form_for @form, url: form_url, as: :collection_type, html: {class: 'nav-safety'} do |f| %>
|
17
21
|
<div class="tab-content">
|
18
22
|
<% if @collection_type.admin_set? %>
|
19
23
|
<div id="metadata" class="tab-pane active">
|
@@ -42,12 +46,19 @@
|
|
42
46
|
<% # end of form %>
|
43
47
|
<% # TODO: The participants partial can't sit inside the other form, moved down here temporarily %>
|
44
48
|
<div id="participants" class="tab-pane">
|
45
|
-
<div class="panel panel-default labels">
|
49
|
+
<div class="panel panel-default labels collection-types-edit-participants-tab">
|
46
50
|
<div class="panel-body">
|
47
51
|
<%= render 'form_participants' %>
|
48
52
|
</div>
|
49
53
|
</div>
|
50
54
|
</div>
|
55
|
+
<div id="appearance" class="tab-pane">
|
56
|
+
<div class="panel panel-default labels">
|
57
|
+
<div class="panel-body">
|
58
|
+
<%= render 'form_appearance', f: f %>
|
59
|
+
</div>
|
60
|
+
</div>
|
61
|
+
</div>
|
51
62
|
<div class="panel-footer">
|
52
63
|
<% if params[:action] == "new" %>
|
53
64
|
<%= f.submit t(:'hyrax.admin.collection_types.new.submit'), class: 'btn btn-primary', onclick: "confirmation_needed = false;", id: "create_submit", name: "create_collection_type" %>
|
@@ -15,7 +15,7 @@
|
|
15
15
|
<td data-agent="<%= g.agent_id %>"><%= g.label %></td>
|
16
16
|
<td><%= g.agent_type.titleize %></td>
|
17
17
|
<td>
|
18
|
-
<%=
|
18
|
+
<%= link_to t("helpers.action.remove"), hyrax.admin_collection_type_participant_path(g), method: :delete, class: 'btn btn-sm btn-danger' %>
|
19
19
|
</td>
|
20
20
|
</tr>
|
21
21
|
<% end %>
|
@@ -1,62 +1,66 @@
|
|
1
|
-
<
|
1
|
+
<h3><%= t('.add_participants') %></h3>
|
2
2
|
<p><%= t('.instructions') %></p>
|
3
3
|
<% access_options = options_for_select([['Manager', Hyrax::CollectionTypeParticipant::MANAGE_ACCESS], ['Creator', Hyrax::CollectionTypeParticipant::CREATE_ACCESS]]) %>
|
4
4
|
<% unless @collection_type_participant.nil? %>
|
5
|
-
<%= simple_form_for @collection_type_participant,
|
6
|
-
url: hyrax.admin_collection_type_participants_path,
|
7
|
-
html: { id: 'group-participants-form' },
|
8
|
-
as: :collection_type_participant do |f| %>
|
9
|
-
<div class="clearfix spacer">
|
10
|
-
<div class="form-inline">
|
11
|
-
<label class="col-md-2 col-xs-4 control-label">Add Group</label>
|
12
5
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
6
|
+
<section class="section-participants">
|
7
|
+
<!-- Add group form -->
|
8
|
+
<div class="form-add-participants-wrapper row spacer" data-id="<%= @form.id %>">
|
9
|
+
<%= simple_form_for @collection_type_participant,
|
10
|
+
url: hyrax.admin_collection_type_participants_path,
|
11
|
+
html: { id: 'group-participants-form' },
|
12
|
+
as: :collection_type_participant do |f| %>
|
13
|
+
<div class="form-inline add-participants-form">
|
14
|
+
<label class="col-md-2 col-xs-4 control-label"><%= t('.add_group') %>:</label>
|
15
|
+
|
16
|
+
<div class="col-md-10 col-xs-8 form-group">
|
17
|
+
<%= f.hidden_field :hyrax_collection_type_id, value: @collection_type_participant.hyrax_collection_type_id %>
|
18
|
+
<%= f.hidden_field :agent_type, value: Hyrax::CollectionTypeParticipant::GROUP_TYPE %>
|
19
|
+
<%= f.text_field :agent_id,
|
20
|
+
placeholder: "Search for a group...",
|
21
|
+
class: 'form-control' %>
|
22
|
+
as
|
23
|
+
<%= f.select :access,
|
24
|
+
access_options,
|
25
|
+
{ prompt: "Select a role..." },
|
26
|
+
class: 'form-control' %>
|
24
27
|
|
25
|
-
|
28
|
+
<%= f.submit t('.submit'), class: 'btn btn-info', :disabled => true %>
|
29
|
+
</div>
|
26
30
|
</div>
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
31
|
+
<% end %>
|
32
|
+
</div>
|
33
|
+
|
34
|
+
<!-- Add user form -->
|
35
|
+
<div class="form-add-participants-wrapper row" data-id="<%= @form.id %>">
|
36
|
+
<%= simple_form_for @collection_type_participant,
|
37
|
+
url: hyrax.admin_collection_type_participants_path,
|
38
|
+
html: { id: 'user-participants-form' },
|
39
|
+
as: :collection_type_participant do |f| %>
|
40
|
+
<div class="form-inline add-participants-form">
|
41
|
+
<label class="col-md-2 col-xs-4 control-label"><%= t('.add_user') %>:</label>
|
37
42
|
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
+
<div class="col-md-10 col-xs-8 form-group">
|
44
|
+
<%= f.hidden_field :hyrax_collection_type_id, value: @collection_type_participant.hyrax_collection_type_id %>
|
45
|
+
<%= f.hidden_field :agent_type, value: Hyrax::CollectionTypeParticipant::USER_TYPE %>
|
46
|
+
<%= f.text_field :agent_id,
|
47
|
+
placeholder: "Search for a user..." %>
|
48
|
+
as
|
49
|
+
<%= f.select :access,
|
50
|
+
access_options,
|
51
|
+
{ prompt: "Select a role..." },
|
43
52
|
class: 'form-control' %>
|
44
|
-
as
|
45
|
-
<%= f.select :access,
|
46
|
-
access_options,
|
47
|
-
{ prompt: "Select a role..." },
|
48
|
-
class: 'form-control' %>
|
49
53
|
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
54
|
+
<%= f.submit t('.submit'), class: 'btn btn-info', :disabled => true %>
|
55
|
+
</div>
|
56
|
+
</div>
|
57
|
+
<% end %>
|
58
|
+
</div>
|
59
|
+
</section>
|
60
|
+
|
55
61
|
<% end %>
|
56
|
-
<
|
57
|
-
<
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
</fieldset>
|
62
|
-
</div>
|
62
|
+
<section class="section-current-participants">
|
63
|
+
<legend><%= t('.current_participants') %></legend>
|
64
|
+
<%= render 'form_participant_table', access: 'managers', filter: :manager? %>
|
65
|
+
<%= render 'form_participant_table', access: 'creators', filter: :creator? %>
|
66
|
+
</section>
|